Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d 2.0 - 3 numbers on the bottom left

I have 3 numbers on the bottom left part of the screen on my Cocos2D 2.0 project:

82
0.016
60.0

60 is probably FPS and what about the other two? As I remember, previous versions of Cocos had just the FPS number.

Any clues? thanks

like image 687
Duck Avatar asked Jun 04 '12 23:06

Duck


1 Answers

82    <-- number of draw calls
0.016 <-- time it took to render the frame, here: 1.0/60.0 = 60 fps
60.0  <-- frames per second

The first number (82) is the number of draw calls (which is fairly high). Typically each node that renders something on the screen (sprites, labels, particle fx, etc) increases that number by one. Draw calls are expensive, so it is very important to keep that number down. One way to do so is by batching draw calls - cocos2d v3 does this automatically.

The time it took to render a frame, in seconds. Since you need to draw a new frame every 0.016666666 seconds in order to achieve 60 frames per second (1/60 = 0,0166…) it's just the inverse of the framerate.

The last number is the number of frames per second aka framerate aka fps. This value, like the previous one, is averaged over several frames so that it doesn't fluctuate as much.

Note that iOS devices always have VSynch (vertical synchronization) on. A game can render a frame every 0.0166 seconds - if every frame takes 0.017 seconds to compute, the framerate is effectively halved to 30 fps. You can only have fps in concrete steps: 60, 30, 20, 15, 12, 10 ...

Since the fps display is averaged over a couple frames it hides this fact. So if the display stats show 45 fps would be a sequence of frames where every other frame took longer than 0.0166 seconds. In fps numbers the individual fps of most recent frames would have been: 60, 30, 60, 30, 60, 30.

like image 171
LearnCocos2D Avatar answered Sep 21 '22 02:09

LearnCocos2D