Understanding framerate independent programming
Posted: Thu May 31, 2012 3:36 am
Hi!
I'm having some trouble wrapping my brain around framerate independent programming. It seems to be worse than using a fixed timestep, iterating multiple times when catching up is needed. My biggest concern is game logic changes based on fps. Example: Pixel A is traveling 1 pixel per second towards pixel B. Both are 1 pixel in size. If the game lags to over a second, pixel A could move faster than 1 pixel per second and jump over pixel B, not colliding. This of course can be avoided by more clever code, but wouldn't it be easier to assume a certain speed in your update loop to avoid programming around these issues? I also feel the need to account for dt being as small as 0.01 or as large as a whole number(worst case) opens up more possibilities for bugs.
What are some of the advantages of using the dt for calculations vs a fixed timesteps? Are there any articles that talk about this kind of stuff?
I'm having some trouble wrapping my brain around framerate independent programming. It seems to be worse than using a fixed timestep, iterating multiple times when catching up is needed. My biggest concern is game logic changes based on fps. Example: Pixel A is traveling 1 pixel per second towards pixel B. Both are 1 pixel in size. If the game lags to over a second, pixel A could move faster than 1 pixel per second and jump over pixel B, not colliding. This of course can be avoided by more clever code, but wouldn't it be easier to assume a certain speed in your update loop to avoid programming around these issues? I also feel the need to account for dt being as small as 0.01 or as large as a whole number(worst case) opens up more possibilities for bugs.
What are some of the advantages of using the dt for calculations vs a fixed timesteps? Are there any articles that talk about this kind of stuff?