Files
opengenesislinkserver/tools/ci/FlightNeighbourPrefetchRegression/Program.cs
T
OpenGenesis (MPL 2.0) 0ed672264c feat(crossing): prewarm child agents for fast region-edge flight (#223)
* feat(crossing): add bounded high-speed edge prediction for child-agent prefetch

* build(crossing): include fast flyer neighbour prefetch policy

* feat(crossing): prewarm neighbour agents at fast flying region approaches

* test(crossing): validate directional speed-bounded neighbour prefetch

* test(crossing): validate directional speed-bounded neighbour prefetch

* ci(crossing): execute directional fast flight prefetch regression

* docs(crossing): document bounded flight prefetch and measurement requirements

* test(crossing): reference OpenMetaverse types for velocity regression

* test(crossing): reference split OpenMetaverseTypes assembly for Vector3

* fix(crossing): use OpenSim uint region dimensions for prefetch policy

* fix(crossing): use OpenSim uint region dimensions for prefetch policy
2026-10-15 00:44:48 +02:00

40 lines
1.9 KiB
C#

using System;
using OpenMetaverse;
using OpenSim.Framework;
internal static class Program
{
private static int count;
private static void Assert(bool result, string label)
{
count++;
if (!result) throw new Exception("Fast region crossing prefetch: " + label);
}
private static bool Pref(bool fly, float x, float y, float vx, float vy,
uint sizeX = 256, uint sizeY = 256) =>
FlightNeighbourPrefetchPolicy.NeedsPrefetch(fly,
new Vector3(x, y, 22), new Vector3(vx, vy, 0), sizeX, sizeY);
public static int Main()
{
Assert(!Pref(false, 250, 50, 60, 0), "ground agents unchanged");
Assert(!Pref(true, 250, 50, 5, 0), "slow flying agents unchanged");
Assert(Pref(true, 235, 50, 30, 0), "fast east-bound approach");
Assert(!Pref(true, 100, 50, 30, 0), "do not prefetch too far ahead");
Assert(Pref(true, 18, 50, -45, 0), "fast west-bound approach");
Assert(Pref(true, 50, 243, 0, 38), "northbound approach");
Assert(Pref(true, 50, 16, 0, -40), "southbound approach");
Assert(!Pref(true, 250, 50, 0, 60), "flight parallel to nearest east edge");
Assert(Pref(true, 242, 245, 65, 65), "diagonal approach");
Assert(!Pref(true, 100, 100, float.NaN, 24), "invalid velocity");
Assert(!Pref(true, -1, 50, -100, 0), "already outside current region");
Assert(!Pref(true, 255, 50, -100, 0), "away from nearest edge");
Assert(Pref(true, 1002, 80, 70, 0, 1024, 1024), "varregion east edge");
Assert(!Pref(true, 500, 80, 70, 0, 1024, 1024), "varregion internal position");
Assert(Pref(true, 131, 100, 120, 0), "bounded high-speed lookahead");
Assert(!Pref(true, 125, 100, 120, 0), "lookahead cap is enforced");
Console.WriteLine("Bounded flight neighbour prefetch: PASS (" + count + " checks)");
return 0;
}
}