johnbakers
johnbakers

Reputation: 24750

cocos2D frame rate is only 30, without any actions?

I have this in my app delegate: [director setAnimationInterval:1.0/60];

Despite this my app is running around 30 fps. What is weird is that it is currently doing absolutely nothing. the init for my only layer does nothing more than add 6 sprites based on images, and no actions or running, they are merely displaying on the screen. The total size of these sprites is around 500 KB total. In simulator or on device the FPS displays around 30.

What could cause such a low frame rate when nothing else is going on in the app at all? There are no scheduled updates and nothing running at all; just displayed sprites.

Upvotes: 1

Views: 817

Answers (1)

CodeSmile
CodeSmile

Reputation: 64478

If your sprites are large, and possibly rotated or scaled or with opacity < 255, and you're running this on an older device (1st or 2nd generation), then you may have simply run into the performance limitation of these devices.

You may be able to improve performance in particular if you use large sprites, or sprites that are rotated and scaled, by using CCSpriteBatchNode and a texture atlas to which you add each of the sprite's images. You can also reduce the color bit depth of the textures from 32-bit to 16-bit or even PVR compressed.

If you changed any of the default startup settings: for example changing the frame buffer from 16 bit to 32 bit or enabling depth buffering can also decrease performance.

Since you only have 6 sprites, wouldn't it be interesting to test what happens if you run your sample app with 5, 4, 3, 2, 1 and no sprites?

Upvotes: 1

Related Questions