Avoidance, but not local

Hey,

The way I have this implemented is using the ITraversalProvider

Just like the example for the turnbased path checking I have an array of blocked nodes.

The Agent group manager ranks the agents based on distance to the player, and allows the closest one to calculate it’s path first. ( I used BlockUntilCalculated to make sure others don’t calculate their path yet before this one finishes ). Once it’s path has been calculated I add a the current position and a few nodes infront to the blocked list. Then proceed to the next agent.

The ITraversable will block the path finding for other agents on those nodes.

You might still have to alter the GetNearest function to find a new target destination in case an agent is trying to use a blocked node as a destination.
For this you’ll have to work with the NNConstraint You’ll have to make some tweaks to feed the data from the ITraversableProvider into the NNConstraint but it gives great results in tight situations.

Below you can find a screenshot of my implementation. The thin vertical line is the result destination, even though both were fed the position of the capsule.

You can also expand your avoidance nodes based on the size of the agents for example:

This solution is definitely not the best one, you loose a lot of the multi threading performance etc. But you could manually offset path calculations per agent etc. This solution definitely worked for us.

If you have further questions feel free to reach out.
-Wolf

2 Likes