This was an issue I ran into when creating a pong clone. I use the SFML library with C++ to once in a while for some game programming. The problem is, if you have a set framerate, the object will be animated at each frame and will move the same distance in each frame. One needs to use time to modify the amount they move, so it's the same regardless of framerate. More specifically, the idea is get the elapsed time from when the last frame occurred, using the GetFrameTime() function of the SFML library.

With the time passed, you then use that as a multiplier to whatever value you were manipulating. So if you were initially moving the x position of a square by 10, you now call:
x += (10 * app.GetFameTime());.
That assumes that your sf::RenderWindow object is named app. What this does is modifies the 10 appropriately so the square moves the same distance regardless of FPS. This is fairly important, especially for a multiplayer game. So players with legacy computer parts arent slower than the players with cutting edge video cards.

This was an issue I ran into when creating a pong clone. I use the SFML library with C++ to once in a while for some game programming. The problem is, if you have a set framerate, the object will be animated at each frame and will move the same distance in each frame. One needs to use time to modify the amount they move, so it's the same regardless of framerate. More specifically, the idea is get the elapsed time from when the last frame occurred, using the GetFrameTime() function of the SFML library.

With the time passed, you then use that as a multiplier to whatever value you were manipulating. So if you were initially moving the x position of a square by 10, you now call: x += (10 * app.GetFameTime());. That assumes that your sf::RenderWindow object is named app. What this does is modifies the 10 appropriately so the square moves the same distance regardless of FPS. This is fairly important, especially for a multiplayer game. So players with legacy computer parts arent slower than the players with cutting edge video cards.