[ODE] simulation steps in a game
Nate W
coding at natew.com
Tue Apr 9 13:59:01 2002
On Tue, 9 Apr 2002 madmax@red-falcon.net wrote:
> I just wondered, what framerate is necessary for smooth and stable
> physics. Shall I double the number of simulation steps if the
> framerate drops below a minimum, say, 50Hz, thus doing 2 simulation
> steps per rendered frame. Or do you use ways of making the physics
> simulation independent of the rendering. (threads ?)
Something like this came up in discussion before, and IIRC the consensus
is that there is no advantage to stepping the world twice for a single
render.
In my application, I step the world and then render the scene as fast as
the CPU will allow. If that rate drops below 40hz, the frame rate
decreases and all motion slows down correspondingly. In other words, I
never call world->step with a time interval of more than 25ms.
I haven't actually tried this, but I have a hunch that increasing the CFM
might help when the time-steps get too large. ODE seems to be a little
more tolerant that way... but the drawback is that joints get sloppy, like
everything is held together with rubber bands.
I think the bottom line is that if you exceed the limits of the CPU,
something has to be sacrified, be it realtime-ness, stability, or
accuracy. I chose to sacrifice realtime behavior, but I have a hunch you
could sacrifice accuracy instead if you want. Instability is probably
intolerable for most applications, though. :-)
--
Nate Waddoups
Redmond WA USA
http://www.natew.com