Static Batch vs Object Pool

So your an experienced game developer and you know what your doing (unlike me) :frowning:

your working on a level for an auto runner ios game and you have about 50 instances of an object. You intuitively know that…

A: Its better to just position them all out and make the static for static batching

…or…

B: stick about 10 of them in an object pool and re position them as the player move through the level

Thanks!

J

Correct answer wins a random emoji

The 2 sort of have different scenarios for usage…

static batching - reduces draw calls for drawing geometry for large number of objects that are identical
results in faster draw times (cpu cycles reduced
at the limitation of requiring that all objects be static (un moving)
benefits are mostly seen when all those objects are on screen at the same time (there’s ways to cull out objects off screen, so there is no draw time for them either)

object pooling - reduce memory foot print by reusing a small number of objects to simulate the idea that there are a lot of them when only a small number are on screen at the same time
results in smaller memory foot print
at the limitation of anticipating number of objects that can be on screen at same time
benefits are mostly seen when small numbers of objects are on screen at once, but lots are used through out the level

So, if by ‘auto runner’, you mean an ‘infinite runner’… this is a situation where you have a relatively small number of duplicate entities on screen. That is relative to the total number in the level (which is infinite… hence the name infinite runner). Static batching isn’t really an option for you, and the memory saving of pooling is obvious (you don’t have infinite memory do you?)

If by auto runner, you mean the world is of static size, and it just auto scrolls. Well… then the benefits of either are harder to judge. Are you seeing more issue with processing slow down because the objects in scene are so highly detailed (you’re using meshes with large poly counts)? If so, try static batching.

Where as if your scene is suffering from memory issues. Because the scene is so large that all the entities on scene are making for bad load times. Well then pool those objects.

If you’re not seeing any problems at all… don’t fix what ain’t broke.

1 Like

Wow thanks!

"benefits are mostly seen when all those objects are on screen at the same time"
“Where as if your scene is suffering from memory issues. Because the scene is so large that all the entities on scene are making for bad load times.”

did not know that. now i do. thanks! looking forward to the day i know all this stuff.

Here is your prize!..

:hushed: