Spatial

Navigation (A*)

Server-side pathfinding over the world bounds masks for your game's AI. Server-only.

Server
services.AddCrossplayNavigation();
Depends on
world
Shape
server-only · zero wire

Services you call 1

Crossplay implements these. Resolve them from DI and call them from your own systems.

INavigationService

Zone-aware pathfinding over the SAME areas the bounds layer registered ("drop a map" gives bounds and navigation from one bake): grid-mask zones route with 8-direction A*; convex zones (box/circle) and unbounded zones are trivially straight-line. The framework never knows what walks the path — game AI (NPCs, escorts, patrols) consumes this and drives IServerEntityMovement itself.

  • bool TryFindPath(string zone, float fromX, float fromZ, float toX, float toZ, List<PathPoint> waypoints)

    Computes a walkable route between two positions in zone, writing corner-simplified waypoints into waypoints (cleared first). False when no route exists within the configured search budget.

Configuration 1

Every tunable lives in an options object — there are no magic numbers to hunt for.

NavigationOptions

Configurable navigation parameters (defaults here; never inlined in logic).

  • int MaxExpandedNodes { get; set; }

    Most cells one A* search may expand before giving up — bounds worst-case CPU on huge masks (an unreachable goal otherwise floods the whole grid). Unit: grid cells. Default 20000. Raise it for very large maps where legitimate long routes get truncated; lower it to cap CPU harder.

  • int SnapSearchRadiusCells { get; set; }

    How far (in cells) an endpoint that lands on a blocked/off-grid cell is snapped to the nearest walkable cell before the search runs. Unit: grid cells. Default 8. Raise it to be more forgiving of start/goal points slightly off the walkable area; lower it to reject such requests sooner.