Navmesh not working after adding 50+ actors

I have a landscape with a single navmesh covering the entire thing (52000x52000x6000). In the landscape, I have a bunch of enemies with AI which basically run towards the player when in sight range, and attack the player when in attack range. This works great when I have about 30 enemies. I added about 50 more enemies to bring the total to 80, and now only the latest ~30 enemies I added will move - the original 30 just stand there, motionless. If I delete the newly-added enemies, the original ones magically start working again. If I add another 50 enemies (130 total), then they all stop working again except the ~30 most-recently added.

If I walk near the enemies that can’t move, they attack me, so I know the AI is running. I also checked the behavior tree while running and it’s calling the MoveTo node. I’ve been looking everywhere for some kind of information about a maximum number of actors on a single navmesh or something like that, but I can’t find anything that might suggest what’s broken.

edit: after some more testing, it looks like exactly the 50 most recently-added enemys work, and no others do

2 Likes

Thankfully I’ve found the answer here with some smarter search terms (using the 50 actor limit):

Quoting from post:

Problem was in “Max Agents” option in Edit->Project settings->Crowd manager. Default value is 50. Maybe this information will help someone.

3 Likes

maaaaan thank you Very much. You saved me. Thanks.

ho I can modify the max agents limit?

in ue5 go to Edit->Project Settings here
image
then on the left sidebar you can find Crowd Manager section

and there is max agents setting on the bottom:

note: this works only if your AiController class is inherited from Detour Crowd Ai Controller
image

Why this controller is used? It is used to allow pawns avoid each other in combat or on the city streets. It’s limited and has affect on the performance.
But you anyway will have to hide npc’s that are not in your view or far from the current player position.
What this limit means? It means that only 50 npc’s can pathfind(move) at one time. It dosen’t mean that there can’t be more than 50 npcs. It can be. But they can’t move together. Only 50 or … the value you set to Max Agents can move at one time.

2 Likes

king

Man you saved my game… I was searching for 2 months… and now its working… thx