Problems with seeking, agents run aimlessly in circles

Hi,

I am using the Deathmatch AI Kit with PUN for the bot behaviour tree. I'm having a small problem with getting some of the agents to seek to a destination. Here is a video of the problem:

When the match starts, all agents are assigned a waypoint. The waypoint shows up in the inspector for each agent, and the behaviour trees all show up as executing the Search For Target task. Some of the agents move correctly to their assigned waypoint, others will just get stuck and move around in circles, as shown in the video. I have tried to adjust the turning speed for the agents, but that hasn't helped. This problem happens on and off, some agents will move towards the waypoint correctly, others move and then just stop and run in circles, sometimes all agents move correctly to their waypoint.

Also, the scene demonstrated in the video is a large scene. The agents will always move correctly in a greybox scene I use for testing (made up of primitives), everytime I try to get them to move in a larger and more complex scene (the one shown has stairs for example), these problems start to occur. I have tried rebaking the NavMesh multiple times, but that does nothing. What could be causing this problem, and why would the behaviour be so different across multiple scenes? Thanks.
 
You could try increasing the stopping distance on the NavMeshAgent to see if that helps at all.
 
I increased the stopping distance, the problem still persists. The issue is that the agents that glitch out never reach their final destination, they get stuck at some point and run in circles :unsure:
 
Just to add, here is another video of the issue:

So the behaviour tree seems to be executing the Search For Target task, but the agent doesn't want to move to that waypoint.
 
That's an odd one. Can you reproduce it within the demo scene? Unfortunately this is one of those where I am not sure what is going on.
 
That's an odd one. Can you reproduce it within the demo scene? Unfortunately this is one of those where I am not sure what is going on.
Hey Justin, sorry for the late reply. So I was partially able to reproduce it inside the demo scene. Here is how you can reproduce it:
* Make sure you set the maximum player count to at least 32, set team size to 32 and team count to 1 in the Deathmatch Game prefab.
* In the Team behaviour tree, be sure to set the Force Search Probability to 1, so that the agents don't try to follow the player.
* Remove all waypoints but number 14. This is the furthest waypoint so it should give some time to check how the agents behave.
* When joining the Spark room, select the Team option and spawn in.

You'll notice that the agents "swarm" before they start moving. Then, what happens is that once they start moving, some of them just stop, run around in circles, and then keep moving. You may have to replay several times to observe this. I attached another video of what it looks like inside one of my scenes, it's sort of a similar behaviour.

I'm following the same procedure to setup my agents as demonstrated in the tutorial video. I even recreated the entire project and recreated the bots from scratch, but this issue still keeps happening, regardless of whether or not they are a PUN agent or a non-networked agent.


An interesting thing to note, when I had only 5 or so bots, this problem didn't actually happen. If I start increasing the number, then this problem starts happening. If you adjust the team size in the demo scene to something much smaller, you'll see that the agents move correctly and don't "swarm" or randomly run in circles. In my case, I am using the Solo behaviour tree, in the demo scene, it is the Team behaviour tree, so the issue occurs across both beheaviour trees.

To be honest, I'm sort of a bit lost with this issue, or how to even address this. Any further suggestions would be much appreciated. Thank you (y)
 
Last edited:
Thanks, I was able to see what you're referring to. It looks like the agents are correctly moving according to the NavMeshAgent velocity. Maybe there is a limit to the number of NavMeshAgents and navmesh size? You could try switching to A* but the Deathmatch AI Kit isn't currently integrated with it.
 
Thanks, I was able to see what you're referring to. It looks like the agents are correctly moving according to the NavMeshAgent velocity. Maybe there is a limit to the number of NavMeshAgents and navmesh size? You could try switching to A* but the Deathmatch AI Kit isn't currently integrated with it.
Hi Justin, sorry for the late reply. After just over 2 months and submitting a bug report to Unity, they got back to me and successfully reproduced the problem. I'm not sure exactly what the problem is, whether its performance-related as you mentioned, or if its something else. It was hard to explain it, but eventually they were able to reproduce it. The bug tracker is available here: https://issuetracker.unity3d.com/product/unity/issues/guid/1418739

Hopefully they can get it fixed in the near future (y)

EDIT: So now that the link is fully active, it appears the issue occurs when NavMeshAgents collide with each other, causing them to stop navigating to their target destinations.
 
Last edited:
Top