Stop the player from walling in so tightly that enemies have no way to the base
If every path to the base is blocked, enemies either freeze or smash through walls, and the defence game turns into nonsense. Here is how to refuse a placement that closes the last route, without punishing spawn points that were cut off already.
Why this works
What counts is whether the build changes anything, not whether the map looks fine now. Compare who could reach the base before with who can after, and refuse only a wall that cuts off someone who was connected, so an earlier closed spot never blocks every build.
When not to use it
Don't forbid closing the route in games where blocking is the point and enemies are meant to break through, or where a full wall is a risk the player chooses to take. Then let it happen and give the enemy a way to smash the wall.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- A diagram of every state
- 37 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 "Stop the player from walling in so tightly that enemies have no way to the base" (read_entry survival-wall-must-leave-a-route) 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