• Register
Post news RSS Dereliction: Dross count and Draw Calls

In an effort to optimize Dereliction to allow hundreds of enemies at once, Ive been experimenting with a few ways to lower the cost of a large swarm of bugs on screen. This is what Ive created so far:

Posted by on

Draw calls and Dross:

Im aiming for this to be short, but who knows.

Ok so, I am using Unity as the game engine for Dereliction, and I have to work within its limits and take advantage of all performance tools it has available.

So I got to thinking about draw Calls. All of the small level parts of the rooms, walls, ceilings, etc in the game so far are instanced from one initial template, and all copies are batched, saving a lot of system resources. So I looked into how I could use this for the enemies in the game.

combat


Any meshes that deform, skinned meshes, use the main thread of the CPU and that will, from what I assume, would heavily bog down the system and require one call per enemy.

Also, when a dross would die, and any limbs were to separate, it would add in the separate mesh and bring up the draw calls further.

Well, since the bugs already have this kind of exo-skeleton and round bending joints for the limbs, Im working around that, and parented the limbs onto an essentially empty animation rig.

Screen Shot 2021 09 04 at 8 15 17 PM


So therea, for example a claw end, a top limb obj, and a bottom limb obj art piece. So thats 3 calls. And these are instanced on the other arm. Theres two leg end pieces, top and bottom, as well as the same limb pieces used in the arm as the legs, so thats two more calls per. As well as several for the body, and the head,

Now, for one bug thats a few calls sure. And even with a LOD system lowering the poly count when its far away, its still a little pricy.

But since this is Dereliction, and, for example in the tablet version theres 800+ enemy dross on screen at once, this issue quickly became a non issue because of all the recycled parts, every bug past the first one was essentially “Free” in terms of system cost.

So, I created a bug pool system with the one initial bug. Each part of the bug recorded its position and rotation to reference later. And then this initial bug was pooled 1000 times. These bugs were hidden, and whenever a spawner requests bugs, they move to the spawner, and toggle on.

Pathing 2Pathing 1


When the bugs are shot and die, and their limbs separate, rigid body components toggle on, etc. and bits go flying. They wait a few seconds, toggle off, reassemble, go back to the pools location.

And since this is done when the game initially loads, the bugs are created before the first level, and only once, being recycled and reused, cutting down on loading times between levels and such.

So I found that all rather cool!

I can easily have over 10,000 bugs animating on screen with minimal frame issues, and I think im mostly limited in enemy limits by the fine navigation on the nav agents and such, But more and more the swarms are getting larger and its feeling closer and closer to how Id like it to feel.

Drone 4


Thanks for reading, Cheers

~Salt

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.