Suggestions on having multiple animated enemies.

My game (Necrosis) its a shooter game that should have as objective ,the killing of multiple zombies.
Zombies have to be animated,but blender cant really hold too many of them with anims because i dont know why the heck it slows down the game.

What can i do to have about 15 zombies during gameplay at once,with a decent framerate?
Also,can i somehow command them with a script only,having each zombie executing a script would slow the game down too.

What would you do if you were me?

Thank you!

Well, dude, I seem to have the same problem!
I think the animations have little to do with anything, once you add an armature, the BGE chokes…
You probably plan to add tens or hundreds of animated zombies trolling around!? For some reason, this is still very hard to get (unfortunately for my project as well).
In you case, I’d simplify the armature and the zombies mesh. Also make them as simple as possible. The BGE can handle thousands of non skinned objects, so add such in a distance with simple morph animations in the distance, and replace them with the skinned ones once they get closer, try to have only 8 skinned zombies near by!
Good luck!

Thanks,i dont plan having too many animated while near me,but i guess i should disable anim for when they are far.
MAYBE THIS WILL BE FIXED SOON.Because this is something horrible

How many animated characters do you plan to have in your game? How many bones do they have? Are you animating when you’re not looking at them? There are some optimizations that you can make.

EDIT: And I would command them with a script (having a script on each of them wouldn’t do much worse than running a script for all of them) and optimize when the script runs depending on where your characters are (i.e. not running it, or raising the frequency if the character’s offscreen). How optimized is your game, as a whole? Are you about to lag without any enemies, for example? Would it be better to optimize your game before adding in characters?

I want to have around 8 enemies in front of player with animations.At the momment the logic usage without any enemy is about 6-7%(even lower).
I plan to turn off the animations as they are far away.I plan to suspend anims as i dont look at them.But running a script for multiple enemies is something new for me so i would like to learn a bit of this concept.

Are you using IK on the rigs? That could well be your issue, IK is calculated hundreds of times per bone per frame, whereas normal bone animation is just calculated once per bone per frame. Try to avoid IK if you can. I recommend making one IK armature and one without, making all your animations on the IK armature, and then baking them- the rig without IK is the one that you’ll use in-game.

Nope,not having any IK. I know it really hurts the performance.

Lets see, the enemy are not really close to you…

You need Bullet Physics running if its not close to you ? no
You need Logic running if its not close to you ? no
You need Python running if its not close to you ? no
You need Shadows running if its not close to you ? no
You need Normals running if its not close to you ? no
You need Materials running if its not close to you ? no
You need Big high quality Textures running if its not close to you ? no
You need Collision Mesh running if its not close to you ? no
You need SSAO/Specular running if its not close to you ? no

My Template is on the Resources sub-forum.
Good luck my friend…


As another side-note, how many bones are your character and enemy armatures?

Yes,but since is a zombie game,what of they get near to me …fps would go crazy.
If the logic isnt active and i snipe a zombie,he wouldnt get killed.
I scope a enemy that is far,and because he is far he has no anims,he has no logic either.(i will have to activate the anim and logic as i use the scope i guess.How would they climb hills if the physics are off?
Physics and materials arent a problem,but the animation code that slows down the game.

Here’s an example with 150 models. 9 of them, including the main player has IK with 15 interactions and 2 bones affected. The rest have some basic morph keys to have them perform basic animation They are also very low poly. With 48 less we can have 60 FPS.

For some reason, is the Rasterizer that is slowing the staff down. It might be the deformations, but I expected overhead, animations and logic to be high!

Overhead has nothing to do with this. Overhead is the time spent by pc on calculating debug properties etc.
Have you disabled vsync before you tested this?

Also, it takes a bit from the Rasterizer to draw the physics visualization. If you aren’t debugging physics, you probably shouldn’t have it enabled.

@BlendingBGE - I asked a couple of posts back, but I’m not sure if you saw it - how many bones are you using for your enemies?

The Zombie will get killed, because it still exist but is outside frustrum of camera it will not get rendered,
and you dont need heavy animations, you dont need animations if you are not seeing it,
you can replace it with a far zombie model as simple as a triangle with an animated texture of the zombie walking in the camera direction,
or a very low poly model, when the player get close to it, player will see the normal model of the zombie, killed.

Just look at the screenshot for a minute, NOTHING on the game terrain has physics, is ALL no collision, all,
its just a separated single low poly static physics invisible collision mesh, a limited dissolved copy of the terrain,
with everything take off, no material, no texture, but static physics activated, and toggle invisible.

You SEE the hills far away, when you walk to the hills and can TOUCH it you climb the invisible collision mesh.

Hey, this isnt a game where the player its on earth and zombies are on moon to have animated planes.

Solar, About 16-18 bones.

Its just a random example, i told you, can be a lower poly model, lower poly model animation cost less then hi poly.

Im using 20 bones animated trees at +200 FPS.

You can even let the player set the drawing/culling/frustrum/lod features on game, im using something like:
if keypress: scene.active_camera.far = + 2 # from 2 to 62 BU adjust

So if your computer can run everything on screen, just run everything on screen, as you actually have,
when its near 2 i got +600 FPS and all mayor low poly models, and game still works correctly, just ugly.

use playAction()

in the actuator there some bad bug