100+ zombies on screen (TOPDOWN)

Hello everyone, I’m wondering how I could optimize my zombie game.

It’s a wave system game, but I need to have at least 50-100 zombies onscreen at all times. Even though the game is event-based (nothing runs on tick), having the stationary zombies consumes too much of the frame budget (albeit not by much). The game is low poly and it’s all built on blueprints. I’m not using behavior trees. Because The zombies’ logic is to spawn and chase the nearest player (this is very simple). However, whether the logic is on or off, it lags just from having the zombies on screen. How can games like Killing Floor 2 have so many zombies using the Unreal Engine?

I’m aware of the tricks of using LODs (Levels of Detail), even cardboard cutouts for zombies that are far away. However, this game is top-down, so all the zombies on screen are seen at the same distance. Using LODs in this context would be a poor approach if I’m not mistaken.

Do “stat detailed” and see what part is taking more time.

Hey there @Sonia_Bustos! Are you using the character class and nav mesh? I’d recommend against them as they are quite heavy and actually do a significant amount of operations under the hood constantly. As Shun mentioned you can check what tasks are weighing you down, and you still may be able to accomplish up to 100 with careful consideration.

When you want to work with many characters at once, it’s recommended to create your own class for them that does as little as possible to complete their tasks. Try to pare them down to as simple an actor as they can be to fulfill their tasks.

An experimental alternative (depending on if you really need lots of enemies that have logic) is MASS, UE’s answer for data oriented gameplay components. It’s currently in Alpha, so it’s a bit rough around the edges. It’s made to be as efficient per entity as possible, though is limited in complexity. Horde games often go for this style as it’s very efficient for AI crowds. As of 5.2 Mass Entity is ready, but all of the other parts (particularly gameplay) are going to change, so if you go this route, migrating your project later may break that module.

so basically im having a bottleneck on the Game Thread, im a little bit new to using the profiler, here is a picture of how it looks like, i dont know how to identify which asset is causing trouble.

I know tick is killing the perfomance, but nothing really ticks, and even if i turn off the tick on the zombies, disabling it and removing the node, nothing changes that much.

Hrm, I see in the readout that the character ticks do have some weight to them, how is this compared to that map without the zombies instantiated at all? Could we select the WaitForTasks and WaitUntilTasksComplete callers and see what their heaviest callees are?

You’re using Character and CharacterMovementComponent.
You’re also using SkeletalMesh.

The first two questions:

  1. Can you use Pawn, and add a SkeletalMeshComponent to the Pawn, and then move the zombies in some simpler way (such as along a spline)?
  2. How many bones are in the skeleton, and how many components are attached to each skeleton? For best performance, take out unneeded bones like fingers and toes, and only stick one component per skeleton.

Also, is this a profile of a release mode packaged game, or a development mode in-editor game? There’s a significant difference in performance. (Then again – is this your dev machine, and does that have tons of cores and GPU, compared to your target machine?)

1 Like

Tick isn’t just a tick node. A lot of things happening on tick, for example physics, path finding, “is on floor” check… High number of checks happening on movement component. Yes, sometimes turning off tick doesn’t do anything, but what does is setting update rate. Although it can get choppy.

Hey there, thank you so much for your time! Here’s what it looks like: the first screenshot is with the zombies, and the second screenshot is without the zombies.


WaitForTasks and WaitUntilTasksComplete callers opened, the heaviest callees would be WaitForTasks, which i don’t know if that shows anything useful or not


The heaviest frame without zombies performs a lot better, so looks like zombies could be optimized, in some way.

Let me know how could i help you to help me!, and thanks! i am receiving a lot of feedback and useful information!

It is a In Editor Game, not a packaged game.

1, i am using character class, yes, and character movement component,
The logic for the zombie movement is a simple Move To Actor, either on tick or event based it still performs weakly.
I Will do some research on using a pawn class
2. it has the same bones as the UE4 mannequin, with no extra components attached to them, i could remove the fingers.

Ahh yep, it’s going to come down to either handling the zombies in a data oriented manner or cutting them down to simple pawns or actors to get a bit of performance back. This can get a bit complex however considering you’ll need to write your behaviors without the help of all the things the character class does for it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.