500 zombies on the screen - How to improve frame rate?

Here’s a link to a video demonstration:

Besides reducing poly count on the mesh itself, I was just curious if there is a way to improve performance with this many skeletal actors on the screen at once? It sure would be cool.

A LOD level system (which you specified regarding poly count).
Reducing lightmap resolution for each level of LOD, max being the closest.

Simple collision rather than complex (I don’t know howyou’re handling this).

And there should be ways to optimize the way zombies react to player but alas, I have no experience in this area. As you can imagine, a large amount of zombies noticing you at the same time would probably be catastrophic for frames but with your current issue regarding the grouping of them, i’d say you should tackle that first :stuck_out_tongue:

I think there is hard limit to 50 AI instances running at once. So you have only 50 zombies running with AI. I found that yesterday, also making zombie game, 51st spawned AI is never moving.

It looks like to me you need to increase the radius of your spawn box area.

You want your zombies to drop down to the ground from the air, not spawn on the ground.

Thanks for the tips. I actually kind of like how they all bunched up in groups… and was hoping there was a simple way to improve the performance so this many zombies could be a gameplay feature.

Hmm I have some blueprint array woes I’m trying to sort out and you seem advanced in this because you gotten pretty far in your own game already, you already shooting lots of zombies, you got the track player system working. I’m also trying to get my tracer gun to damage my droids in my game but I don’t know where to put the code in for the damage. For blueprint coding is foreign to me its like going off to another country. to live, its that bad because I’m not an unreal blueprint programmer… But yes, let the zombies drop in from the air if your spawn rate is too fast, then it will cause them to hit each other as they are falling down and then start getting all confused where to go and start jamming all up so you don’t want the spawn rate to be too fast otherwise they will get even jammed up in the air as well and it will look funny…

In Scared 2 sometimes my skelies get caught up walking around in the air and when this happens the enemies go around in little circles under them and they start to gather together in little groups. It means that the track player system is getting confused on where the player is. And in Sacred 2 anything that is standing still like enemies in a group because the tracker system is confused over which way to go is good because then you can just step in and mow them all down while they are confused and they can’t do nothing. Because when you summon your skellies, all the enemies are targeting both you and also all your wandering skellies and it confuses the heck out of the enemies after a while.,

I managed to have about 100-200 Mannequins running around my map and yes with lighting on it will slow the frame rate all down to a crawl speed, so thanks for that little tip, which means we can’t have lots of enemies in our maps running all around unless we shut all the lighting down or find some other way to optimise them. For one of the worlds most powerful game engines, I’m surprised the engine just keels over after a hundred or so spawns.

What you could do is set the spawner to spawn in about 10-20 of them at a time everytime you kill about 5-6 or more of them.

What I want to know how to do, you might know how to do it is to Pop up different text on the screen each time you step into the trigger but it chooses the text at random.
to display, I need it for Interactive Dialog in my game, its supposed to be done with an array using draw text

my game project that I’m currently working on can be found here.

I’m a blueprint hack myself. I’m understanding more and more all the time and it feels great to get my mind more and more wrapped around it’s concepts. Blueprint to blueprint communication was a huge hurdle for me at first, but now it’s something I completely understand. I usually look up tutorials for anything I need to know, always trying to understand what’s going on as I go and not just copy.

If you want the text to pop up over the character, there is text component you can add. Then, just make an array of strings and call a random element from that array. You should be able to do a quick search and get the details on how to accomplish this.

How many people are working on your game? Looks p

The dialog text is not supposed to pop up above their heads but is supposed to pop up down below on the screen
on a black background (couple of umg brushes) to make the text more readable. That’s how I do my dialog, but unless I know how to assemble up a string array node, then i can’t add in all the interactive dialog to my game not until I get a basic array to work in this engine. otherwise I am
limited to fixed static dialog in the game which is no fun…

I can’t even do a simple hud counter, like Droids Remaining: 600 as I have 600 to spawn in my map, but they not supposed to spawn all in at once. But I seemed to have lost the Spawn Counter, I can’t seem to find where in the Spawn Blueprint it is to find the max spawn limit setting. Now you kill the droid with your gun, the count number of droids is supposed to decreases down and when it reaches 0 you complete the mission and get a reward. Sounds simple enough don’t it but its not so easy to set this up in blueprints.

For I can’t even do a droid hud kill remaining counter. I couldn’t even get my random credits counter working when picking credits up off the ground credits tht are given a random value and just tally it in the hud either. So I had trouble trying to do hud score counters. There’s so much that I can’t do. was i successful with following all bp tutorials? No, but after several hours of work I was successful in coding a basic space simulator with a chair tutorial though. That did work. But here’s the problem. Now that I spent a couple of hours in coding how to fly around planets in a chair What if you wanted to change the chair now to a proper space ship mesh? so you can fly around in your ship? Well, Problem. If you swap the chair over to a new mesh, then you can’t rotate the mesh back again. the rotate widget is not there to adjust it when its been parented and fixed to the red arrow components of the ship, uh oh, ARRGHHHH. So now I have to delete all the ‘ship’ components and redo them all over again but this time using with the proper spaceship mesh… How stupid, Unreal shoud just allow you to reajust the mesh if you swap it, but no…This is why I don’t like Unreal, it disables things it shouldn’t and dosen’t allow you to easily change things back afterwards when you spent hours coding in it, now the only other problem now with the simulator is the Pitch and yaw controls are way too sensitive and need clamping
down on the values which I don’t know how to do that yet either, because its all heavily involved in all these complex maths vectors…

i was successful in coding the Tracer Gun weapon, that worked but there’s no damage code to the gun. i was successful in coding the double jump
routine for the player, I was successful in coding a basic mini map camera that worked, I was unsuccessful in coding the advanced
Mini map with Zooming in and out of the map abilities with the red triangles for enemies that didn’t work because I had trouble assembling
up one of the nodes and minimap took 4 hours to assemble up because it had tons of components to it.

So I was successful in some things with the tutorials and not in others.

I’ve heard that skeletal meshes are quite expensive… I wonder how did they achieve something like THIS (3:45 and other scenes) in Days Gone (they use UE!) without dropping frames.

Cool game btw! :slight_smile:

I would be much more cooler if I can beable to get my string array finally working in this engine so I can get to work on doing the dialog system Yes I think Skeletal meshes are expensive to license out for commercial game use. I had to pay for a royal free licenses for my game models… I think the zombie game looks good.

The most important thing when using lots of animated characters, is to only use a few bones per character. You may be able to animate a zombie with 6-7 bones, and certainly shouldn’t use more than about 12.

It’s also important to make each character instance be a single mesh (typically, this means use a single material element – don’t make it of pieces, and don’t use multiple materials)

Then, as a performance optimization, you may be able to build multiple zombies into a single skeleton, where the “root” of each zombie is animated using translation to where the zombie is located. Call it a “hydra” or “forest” of zombies. You still need to keep the number of animated bones to less than whatever can fit in a shader, so depending on shader model, shader implementation, and number of bones per zombie, you can get about 4-16 zombies into a single “mesh.” Again, they have to all use the same material, and you need to build a mesh that contains all the zombies as a single mesh (single mesh in the tool/engine; the don’t need to stick together with triangles.)

Those should be sufficient tricks to get you to 500 on a modern computer with comfortable frame rate.

With the less bones, the animation will become less fluid won’t they? Or can you just have the zombie use retargeting so they all use the same skeleton.

Obviously there is a performance / quality trade-off. You can’t have 500 cinemantic-quality real-time actors on the screen at the same time, because there is not enough CPU / GPU on most computers (or even any computer) to keep up with that currently.

For crowds, theres a few things you need to keep in mind for content creation -

Mainly, beyond skeleton complexity, amount of skinned vertices on screen plays into tanking your frame rate. LODs, generally cheaper meshes, and skinning influences help - but the amount of characters on screen regardless is going to give you issues and something you need to build assets around. Basically, find a budget that works for gameplay and create within that.

Then, the amount of unique assets being called will also lead to framerate issues. So. If you have different models, different materials, different textures, etc. the renderer is making those trips each time. Doing tricks like palette swapping (think L4D did this pretty heavily and actually did a talk on it), model visibility (like you have all elements within one model and toggle visibility on spawn so all of the zombies live in one file…) and texture reuse help out…

On Dead Rising 2, we used a few different techniques to render huge crowds, but you really need to create assets with this plan in mind. Essentially, we had the main group then stand out characters you can’t repeat (like cops or construction workers), the main group had basic clothing altogether and (if I remember correctly) had all of the clothing mapped to 1 or 2 texture sets which were then palette swapped for variety. We also used an incredibly aggressive LOD system that degraded rigged characters into a sea of moving static meshes through code, then sprites (like a card with a texture of a zombie on it way in the back…)

There is a balance to everything, and with crowds this massive you need to concede a bit of quality for quantity - like @jwatte says above. Look at it in context, though, even something like Days Gone is a sea of enemies where a super cheap mesh or light skeleton won’t matter, you’ll never see it. With the chaos and pure number of things trying to kill you on screen to look at, you won’t notice more harsh deformations.

Edit> Oh, and shader complexity LODs. Kill off extra textures and the bells and whistles you won’t notice at a distance. Remove things like forward pass shading (skin, hair, cloth…) and put it as a basic material. Sure, it’s not as cool, but it’s cheaper to render and most people won’t notice unless they really analyze it.

Its strange how I can type up tons of rooms in my batch script for my game being 175k in size, its got over 2,200 arrays in it
that contains all of my game ideas in that script in a runnable storyboard form and its not killing off my machine… Its hardly
affecting performance at all. Because I have word wrapping off, but if you turn word wrap on, performance then suffers.

But if you put 500 cinematic 3d actors on the map all at once Unreal will likely suffer and slow down…

Ok so we can’t have 500 cinematic real-time actors all walking around on the screen at once in the map. But maybe we can use
a invisible spawner ring and just recycle the actors continually by spawning them within the player’s Field of Vision area
and removing them afterwards when they drop out of the area. That way instead of having 500 of them all on the map,
you have 50 of them spawning in and out of the FOV Camera View… Some games also put fog in the distance to hide
the spawning.

**“Nawrot **I think there is hard limit to 50 AI instances running at once. So you have only 50 zombies running with AI. I found that yesterday, also making zombie game, 51st spawned AI is never moving.”

Others have tried to figure this out but they too were stopped with the conclusion of 50 ai actors at once only

It’s CrowdManager’s limit. You can change it via DefaultEngine.ini but it dose nothing they believe, hopefully in future there will be more ai on screen at once all individually thinking and moving around.

make a game like “left 4 dead” or “world war z” the movie crowded zombie action.

Also another question dose dead NPC bodies effect the FPS big time? so say 50 AI on screen and 32 dead NPC’s laying around would that drop the frame rate a lot?