I am developing a top-down perspective restaurant management simulation.
There are 3 different NPCs: Barista, Waiter, and Customer.
Each one avoids different areas, and I use NavmeshCut for these avoidances.
However, sometimes the pathfinding algorithm fails to find a route, and the NPC stands still. I think there are issues both related to and unrelated to NavmeshCut.
If you were making such a game, what kind of graph would you use? How would you dynamically cover the areas that NPCs need to avoid?
When looking at the image above, we can see that the barista is not going where they should, the console continuously displays ‘path failed,’ and the order ready state on the right side remains in pathfinding. The Order Ready State is a condition I created to understand if there is an error in my code and to see where the barista is getting stuck. If this state remains in pathfinding, it indicates that the barista is not going where they are supposed to.
However, the problem doesn’t end there. As you may notice, the barista is not even attempting to go where they should. To determine whether any NPC has arrived at a location, I use the following method:
using Pathfinding;
public static class Utility
{
public static bool HasArrived(AIPath AI)
{
AI.SearchPath();
if (AI.pathPending && AI.reachedDestination) { return true; }
return false;
}
}
What kind of pathfinding should I implement to prevent issues like this or directly for such games?