Spielerando

A fast patrolling enemy circles a waypoint it can never quite touch

The guard is meant to turn at each marker but overshoots, turns back, overshoots again and dances around it. Here is how to decide that a marker counts as reached, and how the route loops or swings back and forth without a hiccup.

Why this works

A moving unit almost never lands exactly on a point, and a fast one can leap right over a small circle around it. Counting the point as reached once the unit has gone past it along its leg gives a reliable answer at any speed.

When not to use it

Don't use the passed-it test for units that get shoved around, such as in a crowd or a knockback fight, since being pushed forward counts as arriving. There, keep a generous circle and let the guard walk back to the missed point.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • 17 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 fast patrolling enemy circles a waypoint it can never quite touch" (read_entry patrol-waypoint-skipped-at-speed) 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