So I’ve been doing some work on building pathfinding in an arbitrary environment which is only generated as the player wanders around in it. Outside of the immediate world where the player is in there is no data. When an AI has system in place to have the environment tell it where to go you need to come up with a more automatic system of pathfinding. I came up with a system which uses feelers it scatters around in the world to determine clear paths to which to go to. That looks a bit like this:
The current implementation is considerably cleaner, but this looked cooler.
This is a mesh of nodes grown by a simple recursive tree algorithm. The branches reach out and around in a zig-zag pattern within a given range. This means if the AI or if the target is behind a wall then it’s likely that there’s at least one node that is close to the target. The nodes in the above image are represented by the red blue green axis markers. The cyan indicates the connectivity between the nodes.
This is similar to the sensors that simple sensors that robots use, like in the link below.
The pathfinding here is still using some pre-baked understanding of the world. The sensors then scan the world after a short path has been found like in his previous article here:
This connects nodes by distance values where the shortest path is the one with the lowest sum. Pretty simple stuff. For my system I don’t necessarily know that much about the complete environment, so I needed another way to generate nodes based on where the AI is. Hopefully this will work out.
More updates to come.