Spielerando

Teleporters break the route search and enemies walk past the shortcut

You add a pair of teleporters and the enemies still take the long walk, even though the portal is far quicker. The search was told a rule that portals break. Here is which one, and the one-line change that lets the shortcut win.

Why this works

The search steers by a guess of the distance left, and it only works if that guess is never too big. A teleporter can beat the straight line, so the guess has to include it, or the search settles for a longer route.

When not to use it

Skip it on tiny maps or when portals are one-way traps or random: a plain search that tries everything is fast enough and cannot be misled. Also skip it if enemies should not know about portals, so the player can outwit them.

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 "Teleporters break the route search and enemies walk past the shortcut" (read_entry portal-shortcuts-in-pathfinding) 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