Engine: Unity
Language: C#

For my 3D Supergirl game I needed to implement a pathfinding algorithm for the AI in the game to allow the enemies to find the player. For a bit of fun I thought I would have a go at writing my own implementation!

I have used the quads in the scene as my own nav points. The red cells are inaccessible. Once the path has been found the cells in the path light up and you can see the character will follow the path, ignoring no-go areas.

My implementation uses A*. To calculate my H score, I used the Manhattan algorithm. For the G score I used a value of 10 for the straight cell-cell transitions, and 14 for the diagonal, as in this reference:

You can see it in action in the video below!