I’m having many issues with navmeshagents. I’m building a game where there are a lot of agents following their leader. I manage to have exactly the behaviour that I’d like pretty easily (all agents set their destination to the leader) but as soon as i have around 80 units, all agents struggle and push themselves away as they all try to reach the exact same destination.
I have tried A LOOOT of things to prevent that, but I cant manage to have the feeling I want to have. Is there a way with the NavMesh to prevent this from happening ? What I want is just a crowd of lets say 500 agents that follow a single target.
Setting different destinations for all agents that are not their leader, but doesn’t give the right feeling.
Setting things kinda like binary trees, I have a leader that can have X units following him, and each units can have up to Y units following them. But this creates a queue and the behaviour does not feel good at all.
And a few other things I don’t even remember.
I was also wondering if switching to A* as pathfinding system would solve the issue (never used it).
Do you have a visual example of the behaviour you’re trying to achieve?
I still think flocking might be the way to go, because it’s suited to get that semi random / semi goal directed action you seem to be after.
Maybe try grouping your units. You could have a couple of large agents, each spanning a circular area big enough to contain a set of smaller ones. The large agents would just be containers, but following some flocking algorithm. The actual small agents would do their own flocking, while being constrained to the areas provided by the large ones.
In the tutorial it is using physics2D and I can’t manage to make it work with the navmesh system. But finally I think this could be a good solution indeed if I can implement it.