"Breadcrumb" pathing is waypoint pathing where the waypoints are laid down by watching another unit move. At some interval, your pathing library records a "breadcrumb" of the unit's position, and makes that the next waypoint in the chain. Then your bot follows the breadcrumbs (get it?) to get to the unit you're following.
It's far less sophisticated than something like, say, a nav mesh, but it's FAR easier to code and lighter weight (and, IMO, error prone).
One challenge is how to decide when to lay down a new breadcrumb. Working on my bot this weekend, I had a realization that may seem obvious to some, but it helped me greatly optimize my breadcrumbs algorithm: you only need to deposit a new crumb if the facing of the unit you're following has changed from the previous crumb's facing.
In other words, if the unit I'm following goes from point A to point B and never changes facing, that implies that you B is "reachable" from A by traveling in a straight line. If B is reachable from A by traveling in a straight line, then you don't need to record any of the intermediate points in between A and B. To get from A to B, you simply go to A, face B, and start walking.
One advantage of this -- of using facing changes to trigger breadcrumb deposition (creating new crumbs) -- is that you don't have to do time or distance calculations between crumbs; just check for the combination of (Unit is moving) and (Unit facing changed). If those two conditions happened, drop a crumb. These are simple conditionals -- no sqrt involved!-- so the processing cost of breadcrumb deposition is small.
Another advantage is that turn radiusing (making sure you cut turns at exactly the same rate/angle that the unit you're following does, which can be very important in complex terrain) just happens automatically; you only need to deposit crumbs if the unit's heading changes, so you should track the turn characteristics exactly. Using a distance- or interval-based deposition algorithm often has problems with tightly-radiused turns (or decreasing-radius turns, etc.).
Just figured I'd share that tidbit for anyone who can make use of it and isn't already doing it![]()