Hey, guys.
I am doing a book project on iPad.
And I am very confused why the fps is very slow.
I loaded 4 pictures as CCSPRITE. and every pictures are 1024*768 PNG.
Then the fps slowed down to 30 around.
How can I increase fps?
I think it's very strange.
Thanks.
-YuanMingwei
If I load 4 pictures in one screen, the fps is slow?
(12 posts) (6 voices)-
Posted 1 year ago #
-
This has been asked before but the answer is rather simple actually. Split the pictures into like 4 or 8 pieces each and then add them to a sprite sheet. That should boost up your performance some.
Posted 1 year ago # -
Does this explain why parallax slows after 3 layers also?
Posted 1 year ago # -
I worry about the picture of spriteSheet is too big. You know, every iPad background picture should be 1024 * 768.
4 pictures means there is a 2048*2048 file.Posted 1 year ago # -
I think he meant split each background into 4, not have all four backgrounds on one spritesheet.
Posted 1 year ago # -
sdktutor pointed you in the right direction. Look at this topic to see how you have to split up the images.
Performance wise is loading one 2048 * 2048 image better than 4 of 1024 * 768. Memory wise it's a bit more expensive.
Posted 1 year ago # -
You might be reaching the fill rate limit... very tipical in 2D games.
Try to follow these guidelines: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:best_practices#texturesPosted 1 year ago # -
Missed the part that you displayed 4 full screen sprites at once, thought you were displaying one and loading 4 for some reason. Splitting won't do you much good then. Choosing a less expensive texture format, and rearranging your graphics will have more effect. Do you really need 4 layers of sprites? Maybe you can combine some layers into one, or if some have large transparent areas place the visual items on a spritesheet.
One background layer with smaller sprites on top would be the ideal configuration.
To gain 1 a 2 fps, turn off the blending of your background sprite.
[sprite setBlendFunc:(ccBlendFunc) {GL_ONE,GL_ZERO}];Posted 1 year ago # -
Hey, thanks, guys.
Yes, I have to use 4 full screen sprites at once or more. Because I am trying do something like Parallax.
First of all, I lose 2 - 4 fps if I have 1 full screen background picture.
there is a conjecture:
Someone told me if the problem is there are too many triangles? You know, we are using OpenGL, so maybe the screen is built by many triangles, he told me if there is just 2 triangles, maybe it would be better.
I will read your links too. Maybe something I missed would be the head of problem.
Thank you all again.
-YuanMingweiPosted 1 year ago # -
I tried a solution for the FPS problem. It works magically.
As you know if you want to add a background, you should write like below.
CSprite *sp = [CCSprite spriteWithFile:@"Background.png"]; sp.position = ccp(1024/2, 768/2); [self addChild:sp];but if you build a sprite before you add a back, some magic would be here.
CCSprite *spback = [(CCSprite*)[CCSprite alloc] init]; [self addChild:spback]; CCSprite *sp = [CCSprite spriteWithFile:@"Background.png"]; sp.position = ccp(1024/2, 768/2); [spback addChild:sp];I don't know the reason, but here it is!
Posted 1 year ago #
Reply
You must log in to post.