The Nature of Machines preview 2

Pathfinding working great!

Updated May 17, 2018

Below is a short video demonstrating the pathfinding that I am doing in "The Nature of Machines".

The path works by following a fairly simple algorithm:

  1. start making an ideal path towards the target location
  2. Incremental checks are made as the path is being built to see if the path is obstructed
  3. if the path is obstructed, the pathfinder starts looking to 90 degrees perpendicular in each direction in a wider and wider check until an open position is found. This point becomes a waypoint along the path.
  4. Once the path is finalized the final path point is put in place.
  5. The final path only includes the target path at the end and any waypoints leading up to it.

This is fairly simple in practice but I'll be honest that it only works well specific to this game. If I was boxed in to a U shape, for example, this algorithm would probably have me ramming in to the wall. But, because most of my box colliders are round and there are programming checks that keep certain objects at a distance, I think I don't have much to worry about a character getting boxed in to an obscure spot.