This solution doesn't apply to everything, but there is another level of variable timestep -- variable timestep for each object in the world.
This seems complicated, and it can be, but think of it as modeling your game as a discrete event simulation. Each player movement can be represented as an event which starts when the motion starts, and ends when the motion ends. If there is any interaction that requires the event be split (a collision for instance) the event is canceled and another event pushed onto the event queue (which is probably a priority queue sorted by event end time).
Rendering is totally detached from the event queue. The display engine interpolates points between event start/end times as necessary, and can be as accurate or as sloppy in this estimate as need be.
To see a demonstrationcomplex implementation of this in actionmodel, see the space simulationsimulator EXOFLIGHT. It uses a different execution model from most flight simulators -- an event-based model, rather than the traditional fixed time-slice model. The basic main loop of this type of simulation looks like this, in pseudo-code:
while (game_is_running)
{
world.draw_to_screen();
world.get_player_input();
world.consume_eventsconsume_events_until(current_time + time_step);
current_time += time_step;
}
The main reason for using one in a space simulator is the necessity of providing arbitrary time-acceleration without loss of accuracy. Some missions in EXOFLIGHT may take yearsgame-years to complete, and even a 32x acceleration option would be insufficient. You'd need over 1,000,000x acceleration for a usable sim, which is difficult to do in a time-slice model. With the event-based model, we get arbitrary time rates, from 1 s = 7 ms to 1 s = 1 yr.
Changing the time rate does not change the behavior of the sim, which is a critical feature. If there is not enough CPU power available to run the simulator at the desired rate, the time rate is simply decreasedevents will stack up and we might limit UI refreshing until itthe event queue is low enough forcleared. Similarly, we can fast-forward the sim as much as we want and be sure we're neither wasting CPU to handlenor sacrificing accuracy.
So summing up: We can not only model one vehicle in a long, leisurely orbit (using Runge-Kutta integration) but we can also modeland another vehicle simultaneously bouncing along the ground -- and both vehicles will be simulated at the appropriate accuracy since we do not have a global timestep.
Cons: Complexity, and lack of any off-the-shelf physics engines which support this model :)