The timestep variable is set by getting the arithmetic difference between the current clock time and the clock time of the last frame. Because the time difference between one cycle and another is minute, the FP unit often times cannot accurately record the difference. If your framerate is especially high, the FP unit may record the time difference as 0 and everything in your world will stop.

This is one of the many reasons why games are typically locked to 60fps. It completely prevents these apocalyptic scenarios from happening. wink

Regarding your problem with movement and stuff, though: there isn't any way to totally defeat the problem. But instead of writing this:
Code:
speed = 16 * timestep;


You could write this:
Code:
speed = 16 * max( 1-timestep, 0 );


This tends to return more uniform results.

Another trick is to provide a smooth gradient for these time dependent variables. That is, make your "totalspeed" variable something that is only indirectly affected by timestep through velocity, inertia, and friction variables.

Last edited by Redeemer; 09/02/11 23:14.

Eats commas for breakfast.

Play Barony: Cursed Edition!