Achieving mass NPC count

There’s this game (not a ROBLOX game) coming soon called “World War Z” (the game, not movie obviously) and I was watching a few gameplay footages of the game and saw how much zombies the game could withstand

It looked like there were more than a thousand zombies in the area while the game runs at like 60 FPS or something

I’m curious about how they’ve managed to make thousands (or hundreds) of zombies on screen without lagging?

I’m using GuestCapone’s zombie system for me to mess around with and fix and learn how he did this.
The highest the game can last (for me) without the game lagging hard is around 200 (or 250) zombies.

My goal is to have around 500 to 1000 zombies max in the field

Why would I need around 500 up til 1000 zombies?
I’m planning to add a zombie swarm feature into my upcoming game where if the survivors are causing too much noise or the game is lasting too long, there would be a timer that would appear in the player’s UI that’s counting down then when the timer reaches 0, they get absolutely swarmed for good by hundreds of zombies to kill them off (however, surviving the swarm would be very slim and requires lots of skill and sometimes teamwork)
And the number of zombies that would appear in the swarm would depend on the map. (ex. City = 1000 zombies, a water dam area = 500 zombies or less)

Unless it’s not possible to create something similar the game has achieved in ROBLOX due to the lack of tools to achieve this (maybe)

Why not make extremely high health zombies and reduce the number of zombies?
Well, having a small number of zombies in all direction doesn’t seem that… fun I guess

4 Likes

Take a look at @Crazyman32’s video. He’s running 1000 NPCs at 60 FPS. From memory I believe he does this by controlling NPC positions on the server and letting the client handle all the rendering of the NPCs. NPCs are moved using CFrame, If the NPC isn’t within the users viewport they aren’t rendered and probably some other fancy tricks he explains in the video.

He also has a video later on with animations for each NPC.

24 Likes

I’m guessing he isn’t using humanoids correct?

2 Likes

Correct he’s using anchored objects and CFraming them every frame and uses his own path finding system. However he has the benefit of only needing them to do simple things such as move. Jumping, swimming or climbing would add extra levels of complexity to the system which could potentially put too much load on the server.

How complex do your zombies need to be? What do they need to react to?

If you need more complex actions Humanoids are probably the best option or ‘Luanoids’ which are supposedly more efficient. You can also disable various humanoid states which reduces complexity. You would probably be okay with around 100 humanoids if used efficiently.

3 Likes

Sorta complex actually

I’m planning to make certains features for zombies (some special ones too)
Here are the basic ones:
Walking/running
Jumping
Probably swimming
Climbing
Jumping

Complex ones:
Pathfinding (In the middle of doing that)
Getting knocked-back
Probably custom ragdoll physics
Pounce on survivors
Tripping
Wall climbing/crawling on walls
Searching for any survivors in the area (involving running around relentlessly unless the survivors give away their location with sound or visibility)
They have a chance of mutating if exposed in certain environments
Running and jumping parkour

That’s all I can think of atm

In that case sacrifices may need to be made. Either to the number of NPCs or the complexity of each NPC.

You could have certain types of minority zombies that are more intelligent than others which perform more complex actions.

It’s all a balancing act.

Ragdoll physics on 1,000 zombies doesn’t sound wise. Consider a ragdoll animation or death animation.

Top engines such as Unreal & Unity would struggle to perform what you’re asking.

Death animation is going to be a placeholder while the custom ragdoll physics is being developed to be compatible with the zombie amount. If it cannot be made, then death animations would be a permamant thing. (Not working on custom ragdoll physics atm, probably not anytime soon)

I’ve done 3000+ zombie corpses at one point without my game lagging so much (However, not moving ragdolls though) so I’m somewhat confident that I can do it with this system aswell

The special zombies would not be that common in the swarm, most likely 99% of them would be just regular zombies (Also forgot to mention, players who have died or have become infected are zombies aswell)

The AI zombies would have a really low chance of becoming special infected

Do you know how he handled the positions from the server?
I tried doing the off-screen thing and it still has major performance drops (Definately because of server-side)

Are the performance drops server side or client side?

I imagine on the server RemoteEvents are used to send new NPC locations to the client every few seconds. Make sure you aren’t firing these every frame and that you’re simply moving the NPCs towards the new location every frame.

If client side make sure you’re also not updating the CFrame of the invisible NPCs.

On the Server-Side for sure
I’ve disabled the rendering code on the client-side (So that means nothing is being done on the client-side and the server-side is the only thing operating the zombies)
No difference

Another another edit:
There are no remote events relating to NPC positions, only getting the zombies, getting their state, spawning them, etc (It MIGHT be the spawning event)

Another another another edit:
I’ve disabled all of the events yet it still lags (with the client-side doing nothing)