How many sprites on screen?

How many sprites on screen?
0.0 0

#1

So currently I have 6 CCSprites on screen. The FPS says it’s running at 30.0 FPS. Even if I run the game in release, it is still 30.0 FPS.

However, if I move one of the CCSprites off screen, it goes back up to 60.0 FPS.

My question is, how many CCSprites can be on screen at one time before the FPS starts really going down? I’m fine with 30.0 FPS, but I don’t want to add even more (plan to have about 20 CCSprites on screen for this) if the FPS is going to dramatically drop.

And even once I get done with this game, I want to move to animating CCSprites for the next game and there should be a lot more. So another question of mine is how many animating CCSprites can be on screen at one time?


#2

It depends on a lot of things, what platform are you testing on for a start? If you are using mobile emulators
then the framerates shown are unrealistic - I found with the iPad simulator it would drop from 60 to 30 with 1
fullscreen sprite drawn.

A lot of mobile devices are limited by fill rate which means how many pixels can be draw in a second,
so if you had 6 huge sprites all on the screen together (overlapping in the worst case) then you would
suffer a framerate drop as you are drawing LOTS of pixels every frame (where they overlap you could potentially
draw the same pixel numerous times)

However you could draw 100 1x1 sprites and not suffer the same slowdown, although you are limited by
the number of draw commands per second you can send to the GPU. To sort an issue like this out you
need to use the SpriteBatchNode as (I assume?) it batches all of your sprites it created into 1 draw call.

Regards,
James Mintram


#3

Try to use CCSpriteBatchNode and CCSprite::setBlendFunc( (ccBlendFunc){GL_ONE, GL_ZERO} ) to optimize your game.