2

I'm having a problem that I'm not sure how to solve.

In cocos2d 2.0 , the second number on the bottom left drops to a low number like 0.002 and causes lag in my game!!

The second number is the 'Frames Per Second's Milliseconds', or the amount of time it takes to go to the next frame. I got this info from a question similar to mine, here is a link to that question: Cocos2d 2.0 - 3 numbers on the bottom left

The games FPS's Milliseconds usually runs at about 0.016 or 0.021 and there is no lag.

Shouldn't it run smoother at numbers as low as 0.002?

How can I stop this lag?

Is there anybody that knows enough about cocos2d to help me out?

Community
  • 1
  • 1
BigRed
  • 79
  • 10
  • mark user's answers to your previous questions as right if they helped you. at the moment you've accepted only one question. – Morion Nov 28 '12 at 15:01
  • ah, okay I will do that. :) by any chance can you help me out on this question ? – BigRed Nov 28 '12 at 15:02

2 Answers2

2

When your app runs really, really slow (around 10 fps or less) the milliseconds display is no longer accurate and will display a very low number.

You need to find out what's causing the drop in framerate. If the number of draw calls is high (100+) then your problem is that you're rendering too much and/or inefficiently (use sprite batching).

If the number of draw calls is reasonably low (no more than 50) then your problem is not the rendering but your own code. Possibly some time consuming (inefficient?) algorithm or frequently loading/unloading objects and/or data (files), those are the most common cases.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
  • the FPS is at 60 constantly. there is no drop in framerate, technically it is going faster than 1/60 framerate since the FPS's Milliseconds for 1/60 is 0.016 and mine is running at 0.003. BTW: I took away all the objects and draw calls from the scene, and added a simple CCLayerColor to the scene and the FPS's Millisecond sometimes starts at 0.003 and sometimes it starts at 0.016.. – BigRed Nov 29 '12 at 00:48
0

How are you observing/measuring this 'lag' ?

If you are reporting this based on running on a simulator, please go check on a device. Simulator numbers are meaningless. Btw, the number does not CAUSE lag, the number is the result (measure) of resource consumption by the app , ie low FPS is caused by laggy software, not the reverse.

YvesLeBorg
  • 9,070
  • 8
  • 35
  • 48
  • I'm on my device on release mode. I know the number does not cause lag, that's why I asked the question. I want to find out what is causing the lag. – BigRed Nov 29 '12 at 00:51