Nav Mesh zombies - Frame rate drops to low help

Im creating a zombie game and the problem is the frame rate drops to low the more zombies i have

5 zombies - 34 FPS
15 zombies - 18 FPS
30 zombies - 10 FPS
100 zombies - 3 FPS

Whats the point of a zombie game if i cant have more then 10 zombies.

i have the nav mesh agent attached to every zombie and run a update function telling the nav mesh agent where the players position is.

is there a more efficient way to use nav mesh with multiple enemys?
i really want to make a good working zombie game :frowning:

Any ideas?
Thanks
Likdaboo

Path searching every frame for lots of Ai’s can be quite heavy. I suggest you use coroutines and use yield WaitForSeconds(). You don’t really have to path search every frame. I’m no expert but I usually do it every 0.2 - 0.3 seconds and it works just as good. If you have lots of them I suggest creating a manager that handles batch searching to keep the count down.

Good luck with your game :slight_smile:

You could make it so the path search rate is increased the closer you get to the player/move-target, basically what aegget_ said but with a bit more dynamic…ness to it. You could also do NavMesh.CalculatePath, store that and move your zombies along that path as a rigidbody or character controller. The problem I’ve found though is that even if you set 100+ NavMeshAgents to move to a certain point at the same time only once, it will still lag. So the problem is with the NavMeshAgent updating itself too often.

Thanks for your suggestions.

As i realised the nav mesh just was not going to work for me, I switched to an A* path finding script using a grid and now I can have up to 70 zombies with 45 FPS which is fine. But I was able to increase the count of AI by putting the re-path to half a second rather then each frame.

Thanks
Likdaboo

Which one did you switch to? :smile:

Hi

Im using Aron Granbergs A* Project, it works well, but when i have over 50 zombies they have a slight delay on finding a path to me, which is reasonable

My ideal solution to this problem would be to use a point to point Graph, as it can calculate a path so much faster, however when i tried it the zombies were walking into walls to get to me at times.

As you have an A* path finding solution i have a question, how do you set up a point Graph
I put the points on every corner for the zombies, is that correct?

and if this delay begins to annoy me and I cant figure out the points graph on Aron’s then maybe ill give your’s a try :slight_smile: