A pet that follows the player's footsteps walks every loop and detour twice
Following the exact trail the player walked is cheap and never gets stuck, but it also replays every circle and zigzag. Here is how to cut those out of the trail as it is recorded, and what must happen to a follower standing on a cut piece.
Why this works
Following the exact trail never gets stuck, since the player already walked it. Whenever the player returns next to an earlier spot, everything in between was a detour, so cutting it out gives a shorter trail that is still known to be walkable.
When not to use it
Skip it when the companion should fight, scout or find its own way, or when the player crosses things the companion cannot, like a rope or a jump. Then the trail is not safe for it. Use route search toward the player instead.
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
- 32 lines of example code with 5 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "A pet that follows the player's footsteps walks every loop and detour twice" (read_entry survival-companion-follows-breadcrumbs) 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