Support Forum

Units Avoiding Low-Penalty and Small Node Areas

I am using a recast graph on a very large open world scene that is scattered with a few small very simple villages. Due to the size of the terrain I have used a fairly large tile size which may be contributing to my problems, but I still don’t understand why these issues are occurring.

When I tell AI to path around within the village it works fine and they run to their destination taking a fairly competent path. However if I tell an AI go from just outside the village on one side to just outside the village on the other side, the AI seems to avoid the village like the plague and takes an absurd route around the village.

The first thought I had was that since the nodes around the village are quite a bit larger than the nodes within the village, and since all nodes have a fairly large base penalty, that the pathfinding algorithm was favoring the large nodes over the smaller ones within the village. So I tried fiddling with the penalties and instead of having a uniform penalty on all nodes I scaled the penalties by the size of the nodes so that smaller nodes had significantly smaller penalties. This, however, didn’t seem to affect the pathfinding algorithm at all. Am I missing something?

The AI are using the RichAI script along with the raycast path modifier. The node penalties I currently have assigned are around 1 million for the smaller nodes and go up to 3 million for the larger nodes. The base penalty is large here because there are some roads cut out of the graph that I also want the units to prefer to follow that have no penalty.

I also know that reasonable paths exist through the village, as when I give the AI an intermediate waypoint inside the village it works fine.

Here is an image of a path that the AI chooses when I ask him to path to the other side of the village

I’ve highlighted the path that is shown by the gizmos on the seeker script so that it is more visible.

Hi

This is unfortunately a side effect of how the pathfinding works on triangle meshes with very large size differences of the nodes.
You can read a bit more about it at the bottom of this page: https://arongranberg.com/astar/docs/getstarted2.html#navmeshnotes