[ODE] Framerate problem *again*

Marco Bancale F104 at softhome.net
Mon Feb 10 18:40:02 2003


Hi all!

I've read all the threads about which tecnique to use to keep the
simulation time as much "real" as possible.
I know I have to use little timesteps (5 - 10 ms) for dWorldStep().
I know it should be constant and indipendent from the framerate.
I know someone uses a separated thread and someone uses an
"integration tecnique".

Maybe I know all? :) No, sure, because my game has very different
behaviors depending on frame rates. I can also run it in two different
screen modes (with different refresh rates (60 and 85)) on the same
(mine) computer and it seems to be two different games!!!

So... here I post the code around dWorldStep() I use:

//! Run the physic
lCurrentTick=pTimer.GetCurrentTicks();	// current real ticks
while (lSimTime<lCurrentTick) {
	fDelta=lCurrentTick-lSimTime;
	if (fDelta>=SIM_TICK*1000) {
		dWorldStep(odeWorld, SIM_TICK);
		lSimTime+=SIM_TICK*1000;
	}
	else {
		dWorldStep(odeWorld, fDelta/1000);
		lSimTime+=fDelta;
	}
}

lSimTime is the accumulated simulation time;
SIMTICK is defined as 0.01 secs (10 ms);
As you can see I use the integration tecnique, but it doesn't work.
Do you see something really wrong about that code?

Please help... thank you!

	Bye Bye
	Marco