A significant problem is as follows:
Your game should be updated depending on the amount of time that has passed since the last rendering, and not how many times it is displayed. Suppose you calculate the position of a sprite based on some speed. The new position should be calculated based on the time between the renders, and not with the assumption that has passed since the last render of 0.002 seconds. This is called independent FPS animation.
So here is a simple example:
The right way to do this is to use the time since the last render and update proportionally. The following code assumes 0.002 is a temporary base.
On a device where rendering takes twice as long, the next update will move the object twice as long, so it will be in the same place as on a faster device.
A side issue, you should not always display the next frame at 0.002 seconds in the future. You should see how long the current frame took for rendering, subtract from 0.002 and use it to plan the next rendering. Naturally, this number will have a minimum value of zero, so on slow devices that you will not begin to plan in the past. For example, if your render function takes exactly 0.002 seconds to render, this will halve the frame rate unnecessarily.
source share