Procedural Pathfinding

Hi. I’m looking for a way I can have my enemy follow my player if they enter the room, and continue to follow them out of their sight distance (e.g through a maze) few hours of googling and u still have little idea were to start. I am thinking of somehow dropping way points behind the player for the enemy to follow, but this seems like it would make it impossible for the enemy to ever catch player (maybe continue on path automatically with way point dropped at each turn?) Any help would be appreciated. Looking for more of a idea of how it would work or a tutorial then code (although that’s good as well if anyone has it)

Take a look at this, it explains a finite state machine too simulate awareness with a chase behavior: http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/state-machine-interface

I would simply use an A* algorithm with the target set as the players last known location.

If the built in Navmesh works for you then use it, Navmesh is an implementation of A*

Or maybe implement an A* targeting the expected next steps of the player (considering the direction of the vector velocity) so to 1) improve intelligence of the AI; 2) make the NPC seemingly able to reach the player.

1 Like