Several Enemies on Screen at Once

Has anybody done large numbers of enemies or npc’s on screen at once and would have an estimate of around how many can run smoothly on average computers? My game has a really low poly art style and we can simplify rigs to very few bones if necessary, i’m mostly worried about the logic for all of them, has anyone done anything like this? Specifically in a game, not just putting a bunch of things on screen at once, I know that’s possible if there isn’t a lot of logic. Thanks!

I’ve done a couple of experiments, I could get away with about 26 on my old computer (Which was better than the one I own now). Try my blend file and tell me what your frame rate is with my new test, I would like to know too. I know it’s not full of a lot of logic but you can make pretty good ai with state machine.

PRESS SPACEBAR TO STOP THE FLOW OF NPCs

Here’s the blend:

Attachments

NPC_Count.blend (1.18 MB)

Ubuntu, Core I3, AMCheap HD 5450,
I’ve got 100 before to hit the major bottleneck (~14fps) which is my custom path finding procedure. All animated, moving toward a target location while scanning for enemies to attack, playing step sounds and with the player HUD also tracking targets.

I wouldn’t be surprised to reach 500 with some care and a bit of LOD-ness because I’m still trying to clean up the lines of code that I’ve slapped together.
I don’t think I’ll need that many though, with 50 the screen is quite full already.

The bots are entirely controlled via python code, with… a state machine I think.

Ok, so I think I’ll just limit myself to around 20 npc’s and I’ll optimize them as best as possible. Thanks guys, that helped a lot!

One more question, which is more taxing on blender, logic, being high poly, or having a complicated rig?

I can only answer from my experience but it’s always high poly for me. I haven’t done much testing with complexity of rigs but I’ve never had a problem with logic, despite the fact that I often don’t know what I’m doing and write spaghetti code.

If your not careful with your python code/logic bricks, you can end up with very inefficient logic that can really slow things down. If your careful and use sensible methods, then you can do a lot without taxing the ‘logic system’ much. So be smart with logic and you wont notice much of a performance hit.

I would keep rigs to a minimum number of bones. Also, remember to use the ‘bge’ deform option on rigs as it’s optimized for the game engine.


None and all. You can do horrible things with any of them. I think it helps keeping in mind that you can actually make a game like Doom3 or Quake IV in BGE on a (today’s) low end pc. So if your program looks like crap, behaves worse and drains a lot of system resources then you’re probably doing something very wrong.

imapirateman can you or somebody else tell me your specs and how many NPCs you were able to have in the scene without the frame rate going below 30? So far 16 people have downloaded my file but nobody has told me what they got, could I get a little help please? I don’t know if it’s off topic or not to ask, but I’m building a game too and would like to get a good idea of what people are getting with my setup.

I tested your blend file on three computers actually! While I don’t have specs, two of them were average computers around the level of an average pc user and they ran 35 on screen while maintaining 60 fps. I didn’t look for 30 fps, but based on the tests I did I would guess around 45 would bring you to 30 fps. Maybe a bit less/more. The third computer I tested on is a fairly competent gaming pc but for some reason it dropped to a consistent 30 fps at 35 npc’s almost exactly at 35. I’m not sure why that would be honestly, but its what happened.

exactly 75 npc’s for me, 74 = 60 fps 1 more and boom 30 fps.
i standed in the midle, did at 75 i hit spacebar then there they go running like chickens without a head haha.

when they run and all are around me in center fps drops to 22, didnt see it lower then that. while they run away frames gets back up to 30-32 so generally i have 22-32 fps with 75 npc’s

this is tested with:
cpu: QuadCore AMD Phenom II X4 Black Edition 965 / 3600.1 MHz (origional: 3400 MHz, overclock: 6%)
Video card: XFX Radeon HD 7850 (1Gb version / also a few % clocked)
mem: 8 GB 1333Mhz

hope this helps you out a bit

Hello Geometricity, I saw you wanted people to test your file for you so I took a look. Using blender 2.66 to keep it at or above 30 Fps it looks like 105 is the max anymore and it dips below. With 2.68 i could get that up to 120. and specs if you need them is:

cpu:i5 3570k stock
gpu:HD 7950 stock
ram: 8Gb of 1600mz

Thanks for testing it out and giving me the the info guys! Wow, 105 sounds pretty awesome from where I’m at (20), but I imagine after adding more things to them, like sound, more sensors, etc. the number would go down a bit.

I don’t know why the sudden drop in the frame rate from 60 to 30 would happen, that sounds weird. Could it be that you guys are using an older version of blender? I’m using 2.69. That’s the only thing I can think of because I never experienced a sudden drop like that, unless of course you look at at spot where there are no npc’s and then jerk the camera around and look at a spot where 40 of them are running at. But thanks again guys.

BTW imapiratemon, just out of curiosity how many bones are you going to use for each npc? In my experience the number of bones and the amount of geometry are the most important factors when it comes to the games performance. You could have one bone in a character, but if that bone is moving 300 thousand polys… then, your gonna have a bad day.

My artist isn’t sure yet, there’s only one enemy in particular that there will be a lot of onscreen and right now we’re still designing it. We’d like to simplify to 5 or so bones with only a few animations (obviously this isn’t a human enemy, it’s an original design) We also don’t need it to be particularly smart so logic can be simplified a lot. After that test blend you gave I’m fairly confident we’ll be able to have enough of them on screen for the effect we want.