Improve dynamic batching performance on android

Hello guys,

I want to create a zombie game that is close to this one and has the same gameplay idea:
https://play.google.com/store/apps/details?id=net.mountainsheep.minigore2zombies

As you can see on the pictures, there are always a full screen of zombies on the map.
Since all the zombies are dynamic and so getting batched dynamically (since all using same material and texture) the performance is not as good as i expected.

If i have around 30+ zombies on the screen, the fps is decreasing very hard. I am using simple unlit shader and simplest navmesh agent on each zombie. Each zombie is around 500 vertices.

Here is the profiler screenshot (50 zombies on the screen) that was running on a Oneplus One (still high-end):

As you can see, Camera.render takes a hugh amount of time to execute. Also batch.drawdynamic takes up to 14 ms. Which is far to long i think.

Are there any ways to optimize this and make dynamic batching more performant?

I am aiming 100 zombies on the screen for mid-end devices (nexus 4, etc).

I hope this is possible and someone have some tips/ideas.

Thanks,

Ilija

PS: i am running unity 5.2.2f1

1 Like

Any suggestions? Is there maybe a way to have more control of dynamic batching process?

That’s the thing with batching; you’re essentially offloading work from the GPU and passing it onto the CPU. The cost of batching can outweigh any benefit when you’re CPU bound - perhaps address the balance a little? One way could be to duplicate your material, say for times, rename and apply them equally over the 100 zombies which will force them to be batched into smaller groups of 4x25. Alleviating work from the CPU and passing it back to the GPU.

Great looking game, btw :slight_smile: