What am I looking at?
- Flow field (
FlowFields): one Dijkstra search from the goal gives every cell its next step; all units share it. The search runs a fixed number of nodes per step, so on a lower budget you can watch it spread, and units head straight for their spot until their cell is reached. Walls and mud invalidate the grid; the field is recomputed in the background and swapped in whole. - Line formation (
lineFormation): on arrival the group forms ranks facing the drag direction (or the direction of travel), in a fixed class order (cavalry in front, siege engines at the back); current positions decide who goes where, so paths do not cross. - Neighbour queries (
BucketGrid): units are sorted into buckets every step and push apart only from units in nearby buckets. - Local A* (
LocalPathfinder): a bounded search for short detours; it gives up when the way round is longer than the limit. - Field of view (
stampDisc): every unit reveals a disc; units in the same cell cost one stamp. - Distance field (
chamferDistance): distance from every cell to the nearest wall, in two passes. - No corner cutting (
cornerFree): diagonal steps never squeeze between two diagonal walls.