Pathfinding implementation

The next step is to set the character to search for the final destination that we want. Let's start by creating a new class, which we will call pathfinding. This class will manage the search for the best path in order to reach the final destination. It will calculate in real time the shortest path that the character needs to follow and it will be updated every second, so if the final destination is moving, it will keep following and recalculating the best path.

We start by adding the AI character into our game editor that will eventually search for another character of the game. For test purposes, we will simply ...

Get Practical Game AI Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.