An enemy runs for the health pack that is closest by air, behind a wall
Several pickups lie around and the units head for the one that looks nearest, then have to go all the way around. Here is how to choose by the real walk, how two enemies avoid fighting over the same one, and what happens when none can be reached.
Why this works
What counts is how long the walk takes, and a wall can turn the closest item in the air into the farthest on foot. One search that spreads outward from the unit meets the goals in walking order, so the first free one is the nearest, and claiming keeps two units apart.
When not to use it
Skip it when units should be a bit dumb or greedy, grabbing whatever they see, or when items are so common that any pick is fine. Also skip it when the best choice depends on need, like picking health only when hurt.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 25 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 "An enemy runs for the health pack that is closest by air, behind a wall" (read_entry nearest-pickup-by-walking) 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