[ODE] ODE behavior depends on frame rate. How to avoid this?

Shaul Kedem shaul_kedem at yahoo.com
Tue Feb 4 02:17:02 2003


I use 0.1 and 0.3, using 0.01 and 0.03 is not really
playable on my machine (too slow)

--- David McClurg <dmcclurg@pandemicstudios.com.au>
wrote:
> How long is a tick in your simulation?  I was
> thinking 0.01s with a collide every 0.03s.
> 
> -----Original Message-----
> From: Shaul Kedem [mailto:shaul_kedem@yahoo.com]
> Sent: Monday, 3 February 2003 6:20 PM
> To: David McClurg; Sergey; ode@q12.org
> Subject: RE: [ODE] ODE behavior depends on frame
> rate. How to avoid
> this?
> 
> 
> Hi,
>  I tried your method: in my testing environment (
> similar to test_boxstack) I added a tik which every
> 3
> calls to dWorldStep() runs dSpaceCollide() once.
> I observed two things:
> 1. The object were jittering much more. the whole
> system looked less stable (although no exploding
> occurred)
> 2. Boxes in the stack penetrated each other, and the
> collision/physics library couldn't untangle it
> later.
> 
> Shaul
> 
> --- David McClurg <dmcclurg@pandemicstudios.com.au>
> wrote:
> > I just realized that you don't have to run your
> > collisions (dSpaceCollide()) at the same rate as
> > your movement (dWorldStep()).  You could run
> > collisions every other or every third tick since
> > they are so expensive but still run your movement
> > every tick for visual smoothness.
> > 
> > that's a good thing imo for a simple game running
> in
> > a single thread and needing some determinism for
> > network play.
> > 
> > -----Original Message-----
> > From: David McClurg 
> > Sent: Monday, 3 February 2003 10:36 AM
> > To: Sergey; ode@q12.org
> > Subject: RE: [ODE] ODE behavior depends on frame
> > rate. How to avoid
> > this?
> > 
> > what about replacing
> > 
> >  dWorldStep (worldID, fTimeBetweenFrames);
> > 
> > with...
> > 
> >  while (simTime < curTime)
> >  {
> >    dWorldStep (worldID, simTick);
> >    simTime += simTick;
> >  }
> > 
> > where curTime is the current time, simTime is the
> > accumulated simulation time, and simTick is a
> small
> > constant increment.
> > 
> > sometimes with this approach you'll need to
> monitor
> > the number of sim ticks per frame and if they
> > oscillate back and forth like 1,2,1,2,1,2 you need
> > to ideally make your sim tick smaller (1/120.f) or
> > (1/180.f) or add some smoothing so it goes
> > 1,1,1,2,2,2,1,1,1,2,2,2
> > 
> > -----Original Message-----
> > From: Sergey [mailto:sergey_eu@cea.ru]
> > Sent: Sunday, 2 February 2003 5:33 AM
> > To: ode@q12.org
> > Subject: [ODE] ODE behavior depends on frame rate.
> > How to avoid this?
> > 
> > 
> > Hello,
> > 
> > I am creating simple arcade racing game and
> recently
> > have faced the
> > following problem: ODE behavior depends on frame
> > rate because I use
> > dWorldStep (worldID, fTimeBetweenFrames)
> > 
> > I've read suggestion to divide physics and render
> > cycles: use thread
> > for physics step and use main game cycle for
> > rendering, but this won't
> > work in my case because I use modified Windows
> > messaging cycle
> > (PeekMessage () instead of GetMessage ()) and
> > unfortunately threads
> > does not work with PeekMessage () :( 
> > 
> > 
> > How can I avoid dependency on frame rate? Any
> > suggestions are welcome.
> > 
> > Sergei.
> > 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com