It has probably been asked before, but I can't find it anywhere...
In videoland, 24 fps and anything above is smooth. Cocos2d seems to be smooth only when its 60 fps or maybe a bit less. Anything between 30 and 50 is certainly not smooth, the fps counter doesn't seem accurate...
Why is this? Or is it only me having this situation?
For most people, 60 FPS is the best frame rate to play at. This isn't only because of the smoothness of the images displayed but also because 60Hz monitors are the most readily available ones. Furthermore, acquiring a GPU that can output 60 FPS in a video game is pretty easy and inexpensive nowadays.
60 fps will lend you incredibly smooth gameplay, but a lower frame rate speed will give you better graphics. The choice is yours, but if you're looking for a stable balance, 45 fps is a good target.
If you experience FPS capped to 30/60 or if your framerate is unstable, it is most likely related to your VSync settings. Enabling VSync will force the game to run maximum at your monitors refresh rate (usually 60 Hz) and will in turn will eliminate tearing.
Advantages of 144 FPS The reason why is because if you're able to get more frames in a given second then you'll be able to see an enemy coming around a corner faster than someone that is capped at 60 FPS which gives you a pretty good advantage.
There are actually several reasons for this behavior, and it's not just cocos2d but an effect seen in any game engine in environments with vertical synchronization (VSYNC) enabled. On iOS VSYNC is always on, on PCs you usually have the option to turn it off to improve framerates if they are consistently below the monitor's rate at the cost of screen tearing. Typically LCDs like iOS devices update their display at 60 Hz, allowing a maximum of 60 fps.
Cocos2D 1.x defaults to using the CADisplayLink class for updates, Cocos2D 2.x uses CADisplayLink exclusively. CADisplayLink causes updates to be synchronized with the screen refresh rate. Meaning a notification is sent when the screen has finished drawing its contents.
When you get 60 fps all is fine. But if the game can't manage to render a frame in time to render 60 fps, it will receive its next update only after the next screen refresh has completed. This effectively halves the framerate as soon as the framerate drops just below 60 fps - or in other words as soon as your update & render cycle takes longer than 16.666 milliseconds to complete. This means you can only have discrete framerates of 60, 30, 20 and 15 fps (60 divided by 1, 2, 3 and 4) on iOS with CADisplayLink updates.
The effect is quite noticeable because a framerate that fluctuates between 60, 30, 20 and 15 fps - even just for a fraction of a second - doesn't feel smooth mainly because it's so unsteady - the unsteadiness is what we notice as "not smooth". If your game is affected by this, you might find that limiting the framerate to 30 fps will actually make the game appear smoother. You also have more time to update & render stuff between frames.
It's the steadyness of the 24 fps movie framerate that is conceived as "smooth", but also movie directors have learned to avoid scenes where the limited framerate becomes all too obvious. For instance, they avoid as hell what games do very often: scroll sideways, ie sideways movements of the camera or sideways movement of objects passing by the camera.
You'll be surprised how much smoother movies can be when you watch The Hobbit - it's the first blockbuster movie to run at 48 fps. You'll immediately notice how much more "real" and "lifelike" the characters in the movie are. To get an impression, check out this unofficial 48 fps The Hobbit trailer.
What cocos2d displays as fps is not an accurate representation of the switch from 60 to 30 to 20 and 15 fps but the average framerate over several frames. Therefore when cocos2d prints "45 fps" it means half the time the game displayed 30 fps, the other half at 60 fps over the past couple frames.
Two main problems.
First is matching the refresh rate of the display - anything else and you get irregular motion which the eye/brain is good at spotting. At least be at a multiple of it.
Second is motion-blur. Film/video tends to have motion blur, which fools the viewer into seeing continuous motion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With