Navigation

When you give a group an order, two systems work together: long-range routing finds the way around walls toward the destination, and local steering (avoidance + the formation) handles the last few metres and agent-to-agent spacing. This page is about the long-range part - the pathfinding backend, chosen with the Navigation → Mode property.

The two backends

Per-goal flow field. For each destination the simulation builds one flow field: a grid where every cell stores the direction to step next toward the goal (a Dijkstra expansion from the goal, around walls). Every agent heading to that goal just samples the field at its cell - so a thousand units sharing one order share one field.

Best for: large groups moving to a shared destination - the classic RTS "select army, right-click" case. Cost is per goal, not per agent.

Flow field debug overlay
Flow field debug overlay

Per-agent grid A* with spatial pruning and a cached route per agent. Each agent gets its own path of waypoints to follow, recomputed only when needed.

Best for: units that need individually distinct routes, or scenarios with many small, separate orders rather than a few big ones.

Spatial A* paths debug overlay
Spatial A* paths debug overlay

Tuning

Property What it does
Mode (PathfindingMode) None, Flow Field, or Spatial A*. None skips routing - agents steer straight at their slot, ignoring walls.
Tile Size (PathTileSize) World units per routing cell. Smaller = finer paths through tight gaps, but more cells to compute.
Smooth Flow (bSmoothFlow) Flow Field only. Gradient flow (continuous heading) vs nearest-of-8-directions. On = smoother diagonal movement.

Near Wall Cost (under Walls) also affects routing: it biases paths away from hugging walls.

How a move order flows through the system

SetAgentsTarget(members, point)
        │
        ▼
  Formation: lay out one slot per member behind the point
        │
        ▼
  Navigation: build/sample the route to the shared goal   ◄── Flow Field or Spatial A*
        │
        ▼
  Avoidance + steering: walk each agent to its slot,
  flowing around walls, each other, and settled units
        │
        ▼
  Settle: agent reaches its slot → OnAgentsReachedGoal

Performance

  • Flow field builds are budgeted - only a couple of new fields are built per tick, so a burst of orders can't stall a frame; the rest build over the next ticks.

  • Flow fields are cached and reused while agents keep heading to the same goal. The cache grows with the world region the crowd spans; you can read its size with GetFlowFieldCount() / GetFlowFieldBytes() for diagnostics.

  • A single cross-map order still pays for its whole field in one build. Time-sliced builds are on the roadmap.

Routing operates on a single 2D plane. Multi-floor / overlapping-geometry maps are not supported in 1.0 - see Limitations.