Custom route calculation

Hi Aron, I need to calculate a route based on the map nodes as it is currently done, but with a small condition, each agent must ignore the penalties that the node has of its initial position when it begins the calculation of a new route, but these ignored penalties on this node, they should not be applied for the other agents, is it possible to do this?

Yes, you can supply a custom ITraversalProvider which ignores that particular penalty. See Utilities for turn-based games - A* Pathfinding Project

However, note that this will not change the path at all. The penalty for the start node doesn’t matter because all paths will have to use it anyway.

When you say that all routes will try to use it anyway I would like to know what happens when the following example occurs:

Case 1 would be the desired behavior and case 2 the undesired behavior, how would the route be calculated when that example is given, as case 1 or as case 2? or can it be calculated randomly as I think is happening?


I assume the green nodes have a penalty?
In that case route 1 will be calculated as long as the penalty on the green node to the right is greater than the additional cost from having a longer path length in case 1.