Extremely low FPS (50 fps without drawing)

Hello.

I’m porting a cocos2d-iphone game from iOS to android cocos2d-x.
I have a parallaxNode there. When I add 5 sprites with repeated texture into it, FPS drops down to 20 on device (Acer A500), and 2 on emulator. (60FPS on ipad)

After some days of experiments I decided to “dive” into cocos2d-x sources: I went to the CCDirector::drawScene() function and commented everything, except calculateDeltaTime() and showFPS(). In showFPS() I added _android_log_print() instead of m_pFPSLabel->draw(), so there is no drawing routines left… And (suprise FPS is 50 instead of 60)

Questions:

  1. Why FPS drops without drawing?
  2. Why FPS drops so much with 5 sprites?

Thank’s.

1 Like
  1. Log output consumes much performance.
  2. I guess you pasted large images in parallaxNode, such as some full-screen stuffs. Most Android devices are not as fast as iOS, that’s what they’re cheaper 50% on price. Your game had to be optimized to fit the middle-end market. For example, merge full-screen sprites into one image, use CCBatchNode, reduce the complexity of AI logic and so on.
  3. About the android emulator, forget it. I never use “emulator” to debug games. You can search the difference between iOS “simulator” and android “emulator”.

Thank’s for reply, but…

  1. My device and ipad1 have the same frequency cpu.
  2. There is no logic in my game yet: I only try to make background. And if I optimize somehow background images (which are not so large, by the way), what would be happen, when I add another 10 game sprites? On ipad FPS will be 60, but on android device it will be, I think, about 10, but it will be a complex physics in the game too…
  3. In addiction to large images cocos2d-x helloworld project shows 50 fps. Why?

Heey… I really need help.

May be, I need some compile options or something else?

Somebody, tell me, what fps you have on Helloworld project?

Hi,
I also have the same problem.
Did you solve this problem?

hdg700 . wrote:

Hello.
>
I’m porting a cocos2d-iphone game from iOS to android cocos2d-x.
I have a parallaxNode there. When I add 5 sprites with repeated texture into it, FPS drops down to 20 on device (Acer A500), and 2 on emulator. (60FPS on ipad)
>
After some days of experiments I decided to “dive” into cocos2d-x sources: I went to the CCDirector::drawScene() function and commented everything, except calculateDeltaTime() and showFPS(). In showFPS() I added _android_log_print() instead of m_pFPSLabel->draw(), so there is no drawing routines left… And (suprise FPS is 50 instead of 60)
>
Questions:

  1. Why FPS drops without drawing?
  2. Why FPS drops so much with 5 sprites?
    >
    Thank’s.

Hello, z z.

I realized, that it’s not a problem, it’s just a fact: android sucks (with it’s rendering priority), nvidia tegra sucks (with it’s 2D rendering problems).
One man on stackoverflow.com explained to me all theese things, and said that everybody has such problems on android and tegra.

May be it’s time to try plain C++ with your own custom engine for your game? I think, it is the only solution.

Good luck! :slight_smile:

Thanks for your replay.

What do you mean “try plain C*+ with your own custom engine for your game”?
I use c*+ in my game for the logic.
In the game,it shows only a scene with two full-screen sprites,the fps is about 25-30.
Than i removed two images,the fps is about 50-60.
I don’t kown how to deal with this fact.
I am looking forward to your help.

Thanks very much.

hdg700 . wrote:

Hello, z z.
>
I realized, that it’s not a problem, it’s just a fact: android sucks (with it’s rendering priority), nvidia tegra sucks (with it’s 2D rendering problems).
One man on stackoverflow.com explained to me all theese things, and said that everybody has such problems on android and tegra.
>
May be it’s time to try plain C++ with your own custom engine for your game? I think, it is the only solution.
>
Good luck! :slight_smile:

ps:
i use the cocos2d-1.0.1-x-0.12.0.

hdg700 . wrote:

Hello, z z.
>
I realized, that it’s not a problem, it’s just a fact: android sucks (with it’s rendering priority), nvidia tegra sucks (with it’s 2D rendering problems).
One man on stackoverflow.com explained to me all theese things, and said that everybody has such problems on android and tegra.
>
May be it’s time to try plain C++ with your own custom engine for your game? I think, it is the only solution.
>
Good luck! :slight_smile:

I think, the problem is that cocos2d-x is very common instrument (too heavy for android, IMHO).
If you really want to make big fps game, I can only recommend to take cocos2d-x ideas (or maybe basic parts) and try to make your custom low-level engine with them.

As for me, I did a lot of experiments then, I tried to make crossplatform application with marmalade sdk + cocos2d-x: ipad had 60 fps, android - 40 in the same application.
You can try to use marmalade without cocos2d-x. I don’t remeber if I tried this.

Do you mean that compile cocos2d-x with marmalade, not use android ndk?

hdg700 . wrote:

I think, the problem is that cocos2d-x is very common instrument (too heavy for android, IMHO).
If you really want to make big fps game, I can only recommend to take cocos2d-x ideas (or maybe basic parts) and try to make your custom low-level engine with them.
>
As for me, I did a lot of experiments then, I tried to make crossplatform application with marmalade sdk + cocos2d-x: ipad had 60 fps, android - 40 in the same application.
You can try to use marmalade without cocos2d-x. I don’t remeber if I tried this.

Did you solve this problem with marmalade + cocos2d-x?
Your test: android - 40 mean 40 fps or 20(60-40) fps?
I use a physics engines(box2d), and low fps will cause unreal physics environment, such as falling slow.

Thanks.:slight_smile:

hdg700 . wrote:

I think, the problem is that cocos2d-x is very common instrument (too heavy for android, IMHO).
If you really want to make big fps game, I can only recommend to take cocos2d-x ideas (or maybe basic parts) and try to make your custom low-level engine with them.
>
As for me, I did a lot of experiments then, I tried to make crossplatform application with marmalade sdk + cocos2d-x: ipad had 60 fps, android - 40 in the same application.
You can try to use marmalade without cocos2d-x. I don’t remeber if I tried this.

I didn’t resolve the problem. Cocos2d-x over marmalade didn’t help.

Thanks, it seems that there is no solution with cocos2d-x.

hdg700 . wrote:

I didn’t resolve the problem. Cocos2d-x over marmalade didn’t help.

Try my solution:
http://www.cocos2d-x.org/boards/6/topics/14871?r=15772

It works for me. You can even try commenting out the entire sleep.

Thanks for your replay, but it did’t help me…
The fps drops a lot(–15fps) as long as i add two large sprites on a adroid device(ViewSonic 10e, a pad).
but other devices ok, such as android phone.

Oren Bengigi wrote:

Try my solution:
http://www.cocos2d-x.org/boards/6/topics/14871?r=15772
>
It works for me. You can even try commenting out the entire sleep.

Try my solution:


It will works.