Pathfinding


Author: Josh Keith

Posted on 11-15-2023

Issue: Pathfinding

The pathfinding was not updating or generating a path to the node correctly. When moving the mouse over other tiles, the pathfinding would break altogether and ruin the game experience for the testers. This was due to not clearing all the queues and containers needed for the pathfinding between each path update. 

Solution:

After debugging with a teacher, I realized I had some issues causing these problems. The first issue was that the containers and queue were not getting cleared each iteration of the pathfinding update. This left some tiles and nodes to be searched along with the new tiles and nodes, causing weird behaviors and errors. I started clearing the queue and container updates to fix this, which removed those problems.  The other issue was the get solution function I had written wasn't getting called correctly because it was not in the correct spot in the code. I was checking for the end node in my update function, and when I found it, I returned out of that function without calling the get solution, causing the path not to appear. The solution was to move that function just before return so that the player could see the path found.

Get Quest for Dominion

Leave a comment

Log in with itch.io to leave a comment.