Cheaper node link ignored in favor of penalized path mesh

We have a NodeLink2 that traverses tagged path mesh (in a Recast Graph).

When that tag is set to not traversable in the AI’s seeker, the AI will follow the node link. However, when the tag is set to traversable with a large penalty (3000), the AI will ignore the node link and walk across the tagged path mesh. This is despite the node link cost factor being set to 1. In this case, shouldn’t the node link be evaluated as a cheaper path and followed?

  • A* version: 5.3.5
  • Unity version: 2022.3.35f1

Hi

I would recommend upgrading to 5.4.x as it has much better cost handling for recast graphs. It will likely work well in that version. I recommend that you reconfigure your costs so that it uses the new “Cost Per World Unit” functionality instead of “Cost Per Node”. You’ll find those settings on the seeker.

See also Upgrade Guide - A* Pathfinding Project

Thanks for the response. I have upgraded to 5.4.4 and it does seem to have fixed the issue. AIs are now using the node link instead of walking over the tagged nav mesh.

I did, however, leave the cost of the node link as a fixed cost per node instead of converting it to a cost per world unit. The reason is that these are for our AIs to jump across, so their cost is largely independent of the distance. Is there any reason not to use the fixed cost in this case? The inspector complains about it.

But it seems to me that node costs still have a role to play?

What I should implement is a fixed cost that can be set per off-mesh link. But yes, you can ignore the second warning for your use case.

I assume the first one refers to the tags that you use specifically for the off-mesh link?

That first warning is still important. If you make a very long off-mesh link, with a relatively small cost, then the pathfinding algorithm may not search it, unless the Heuristic Scale is set low enough. The pathfinding algorithm assumes that it’s not possible to teleport and move extremely cheaply between random points in the world to speed up its search. If that assumption doesn’t hold, then it may calculate suboptimal paths.

Hi Aron, thanks for the continued explanations. Yes, the second warning refers to a “jump” tag which has a zero cost per world unit, but a non-zero cost per node (which is the same as the basic ground per unit cost). I can see how this would cause problems. I guess if we wanted to address this through lowering the heuristic, we would need to set it to return a value equal to the jump node cost when evaluating the heuristic for a distance up to the maximum length of a jump?