Fifty enemies chase the player and the game stutters from searching
Searching a route for every enemy every moment gets slow fast, yet they all want the same place. Here is how to do the heavy work once and let any number of units read their next step from it.
Why this works
When many units want the same place, asking each one the same question is wasted work. Answering it once for every spot on the map turns each unit's decision into a quick glance at its neighbours.
When not to use it
Skip it when units chase different goals or only a few move. One search per unit is simpler there, and the shared map would be rebuilt for no gain.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 35 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Fifty enemies chase the player and the game stutters from searching" (read_entry flow-field-for-a-crowd) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP