Performance issue on draw Calls..

Performance issue on draw Calls..
0.0 0


I have been developing my game using cocos2d-x. I wanted to ask a question about how to decrease the draw calls. In my game enemy target is created every second. There are about 10 different enemy targets and one of them is created. I have read about the CCBatchNode*. Correct me if i am wrong but isn’t it useful only if I have many sprites of the same texture. (Not my case). So, in order to increase performance what should I do?

  • Even when the sprite is removed. The draw calls are not reduced. (this->removeChild(x) Shouldn’t it reduce the draw call?)


Usman, you can utilize the sprite batch code by using a sprite sheet for your enemy sprites. With a single texture for all of your enemies, the batch node will make the draw calls very efficient.

Is this possible in your game?

Otherwise, how many sprites are you able to display before performance degrades?


It happens about three or four minutes: Draw Calls are reach about 200 with about the same no. of sprite on the screen as after 10 seconds.
I will make spritesheet, I am looking for a good-free spritesheet maker right now…
I have added my target images to cache using CCTextureCache::sharedTextureCache()->addImage(“xxx”);
Do you think this would be helpful? And If you know any spritesheet makers let me know.
And thanks Jacob!


Very Inexpensive: Predator
Inexpensive: Texture Packer

I have used both. Predator mostly works, but it doesn’t output the format type for the plist file. It assumes a certain format that is not correct sometimes. Otherwise, it works.


CCTextureCache::sharedTextureCache()->addImage(“xxx”); would this be any useful?


No, that’s not useful in your case. You can to use a single sprite sheet (one texture) and then load the plist and texture together so that you can then pull the sprite as a CCSpriteFrame instance from the sprite sheet. This allows you to use one texture in your batch node, but create hundreds of CCSprite instances from it. Each CCSpriteFrame just refers to a subsection of your texture. That’s how it is so fast.

This call: CCTextureCache::sharedTextureCache()->addImage(“xxx”);

It is used in the processing of your sprite sheet, but for that you use the sprite frame cache.


Got it. Thank you!