Thaumaturge said:
That is, if for example you want to increase the rate of the simulation to twice the baseline rate, then you simply run twice as many steps per frame.
I did this in a game which used variable timesteps.
The physics where mostly about constant velocity (kind of Breakout), so variable timestep did not cause much problems.
But in some cases it did, e.g. the mapping from accelerator sensors to affect things, which was not linear. For those things i did subdivide time, so the timestep got as close as possible to a fixed target.
Worked well for this simple game.
felix.speagel said:
every article I've read about integration of time in physics simulations says the \Delta tΔt should be constant or a very strange things will happen like bullets going through walls etc.
It's a good advise in general, but not the only option.
For a space game, variable timestep should be quite easy, because physics are very smooth.
If you have stacks of boxes, lots of multi body systems like ragdolls, and complex stuff, supporting a dynamic timestep becomes much harder or just unpractical.
felix.speagel said:
how to make a simulation where one can speed it up/down?
If the speed only varies slightly, e.g. we jitter back and forth between 30 and 60 Hz due to display framerate, using fixed 60Hz for physics (thus doing two physics updates in some frames) is the best option. That's what the ‘fix your timestep’ article proposes, and it is the general case.
But if speed varies a lot like with space travel, variable step is your only option, because you can not do 1000 physics updates per frame. (Well, some racing games do this actually, but that's again a constant small timestep.)
I remember a guy making a space simulator using Newton physics engine (which is a typical game rigid body engine meant to use constant timesteps), and afaik variable timestep worked for him without problems.
Regarding integration and constraint solvers, it surely helps to vary the timestep smoothly and not abruptly. So if you want to speedup by a factor of 100, it might take a second til you get there.
EDIT: In some simulations, e.g. fluid, it is quite common to analyze current state to calculate the biggest timestep we can do. So that's a form of dynamic timestep for optimization needs.
Another example is to diffuse energy over the surface of a triangle mesh. Her we can calculate a maximum ‘timestep’ from the geometry once, and use it for all steps of an iterative solver. Just a single degenerate triangle with a very short edge can increase calculation times by factors of 1000, if we really care bout perfect accuracy.