[ODE] CFM and timesteps

amundbørsand amund at c2i.net
Wed Mar 12 12:15:02 2003


"gl" <gl@ntlworld.com> skreiv:
> Well, two reasons (in my case).  a) using variable timesteps, as noted in
> the docs, produces different results; 2 x 0.1s timesteps != 1 x 0.2s
> timestep.  This also means that if you want the simulation to be completely
> deterministic (eg. for replaying events exactly, with just starting
> positions/velocities as input), again you'll need a fixed timestep.

Okay, you've got a point there, I agree, but I don't really need this 
(well, maybe I'll need replays later in my game, but I'm sure that could
be approximated well enough by saving the positions and velocity every
now and then and simulate in between, and correcting from the saved
positions. This is nothing scientific, just a car game that is supposed
to look good and behave realistically.)

> b) In some circumstances (a client/server multiplayer game for example), the
> server would run at a fixed timestep and then synchronize its clients off
> the results.

Yes, good point.

> > Have you thought of how complicated fixed timesteps would be, and how
> Not at all, see my code.
> > inefficient it is to run the physics engine for several times per frame?
> See above.

I didn't mean complicated in code, I meant complicated computationwise.
How much time does ODE take to compute one time step? Maybe not much,
but certainly not so little that you get little to no impact on the
fps-counter from running ODE 10-20 times per frame.

> results.  Also intersection behaves very differently with different
> timesteps.  Example - try spawning a sphere just below a plane at different
> timesteps - the speed it gets kicked out varies heavily with different

Yes, but you're not really supposed to do that, are you? And I thought
ODE finds out where the intersection/collision occurs ahead of time, and
applies forces accordingly, not waiting until *after* objects have
intersected, it's not using penalty methods. The way I see it your
example is an error in the simulation and shouldn't happen. As long as
things move freely they should continue doing so independent of the time
step, and if collisions occur they will be detected and dealt with
*when* they happen.. (or at least AS IF they were delt with when they
happen, only problem being too large timesteps that things can fall
through eachother) or am I fantasizing now? :)