Jump to content
  • Advertisement
Sign in to follow this  

Measured Progress

This topic is 2943 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. In my learning about game programming, I've seen two different ways to keep the progress of a game constant. Either there is -
A - Constant sleep intervals (10-20ms) while the game update function checks how long it's been since it's last running and advances things based on that (if speed = 2m/s and .21 seconds have passed, move 0.42m.)
B - Varied sleep intervals with an intended updates-per-second (UPS) apart from the FPS. If a frame takes a long time to render then it updates extra times for the frame's rendering.

Mind, these were in Python and Java respectively. So my question is if one is inherently better than the other for a game? Or if one is preferable based on what kind of graphics/game?

Share this post

Link to post
Share on other sites
Both seem the same to me but B is more recognisable.

A = Check the last time Update function was to run

B = Check the amount of time the last frame took to render.

I use B but as long as your "Update" function is part of your game loop then it doesn't really matter either way.

void main() {

float lastUpdate; // These should be somewhere smarter
float difference; // These should be somewhere smarter

while (isRunning == true) {


difference = Ticks-lastUpdate;
lastUpdate = Ticks;



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!