Game Development Community

Multiple Full ImageMaps vs One Cell ImageMap

by Carl Schell Work · in iTorque 2D · 03/11/2009 (1:12 pm) · 5 replies

Hi,
I am working on an iTGB game and I am doing some performance tests on the Device. I have been reading up on State Changes / Draw Calls and I have found a ton of documentation that tells me that Draw Calls are expensive, and rather than having a bunch of individual textures, I should combine them all on a "single / several 1024x1024 texture(s)" to reduce the draw calls. So, I did my first test in which I have two maps:

First map called "Many.t2d", I have about 128 individual objects on the screen, all lined up, all calling 32 individual ImageMaps (4 of each) (Image Mode FULL).

Second map called "One.t2d", I have the same 128 objects on the screen, but they are all calling from a single imageMap (4 of each cell) (8x4 Image Mode CELL).

On the iPhone, when I run the two maps, I am finding that the average framerate for "Many" is ~34.4 fps and for "One" is ~35.9 fps. I would have expected the difference in framerate to be larger since the "Many" map has 31 more drawcalls than the "One" map.

I also did another test, one where I used actual objects from a living room type scene, another "One" vs "Many" map test. The only difference was that on my CELL sprite sheet, some of the objects took up more than one Cell and I had to assemble the objects in the scene like puzzle pieces. This made the "One" map have approx. 15-20 more scene objects than the "Many" map. In this situation, the "Many" map had an average fps of 43.0 fps and the "One" map had an avg of 38.1 fps. Very much the opposite of what I would have expected since again, the "Many" map had about 31 more drawcalls than the "One" map.

Am I missing something, or is it really that the number of scene objects greatly outweighs the number of drawcalls in regards to performance?

#1
03/11/2009 (1:21 pm)
The number of t2dSceneObjects is a big concern, most notably because of physics. Even if you are not doing anything with them, they will still process physics, which will lower performance.

Make sure PUAP_OPTIMIZE is enabled in your project settings, re-compile and then try your tests again. Among other things, PUAP_OPTIMIZE will default all objects to not use physics which should have some affect on your test results.
#2
03/11/2009 (1:35 pm)
Hi Mat,
I have PUAP_OPTIMIZE enabled. Under the Preprocessor Macros, PAUP_OPTIMIZE is listed. Is there anything else I need to check?
#3
03/11/2009 (2:24 pm)
That should be it.
#4
03/12/2009 (5:55 am)
Hi Mat, you mentioned "That should be it" and I agree, but it was already enabled when I did my original tests so everything was default to NOT use physics in my original examples.

So, back to my first post, does anyone have any idea why I may be getting these results? Has anyone had any related experience or tests?
#5
03/16/2009 (5:35 am)
Just another bump here to see if anyone else out there has any idea why I would be getting these results? If not, then I will just have to assume that the scene object count far outweighs the amount of draw calls. I am sure there may be some sort of trade off, or some point where draw calls outweigh the scene objects, but at this point, with the objects in my scene, draw calls don't seem to be as hurtful.