[ODE] Record and Playback

Martin C. Martin martin at metahuman.org
Tue Jan 27 07:40:21 MST 2004


Brian Clarkson wrote:

> 
> We are just about to develop a record/playback function for our game. We
> have interactively controlled vehicles
> and dynamic objects within the scenes. Has anybody done this successfully.

Yes, and it's in the FAQ.

> For us it is necessary for the recordings made
> on one machine to be replayed on another. I think a system based on the
> recording of the vehicle control inputs is the simplest
> approach but I think it may be very difficult to guaranty consistent replay
> across machines.

Why?  All Intel CPUs and clones need to have 100% same behaviour, down 
to the roundoff of the floating point.  RTS games typically only send 
user commands between computers, and rely on everything happening in 
lockstep.

> I have a system which records body positions
> and orientations which works fine but this approach is limited to replaying
> the vehicles progress within the original world

So is the "record user input" method.  Wouldn't different user commands 
be needed in different worlds?  I.e. if the user drives around the 
mountain in world 1, and there's no mountain in world 2, then their 
action will seem strange.  More to the point, suppose a certain triangle 
in world 1 causes the vehicle to bounce a little left, and the user 
corrects for that.  If world 2 doesn't have that triangle in exactly the 
same spot, then the vehicle will veer right.  Before long, the straight 
path in world 1 will be a random walk in world 2.

> and memory
> requirements are high if the world is complex.

There are things you can do to lower memory requirements:
- save only the deltas between frames and huffman encode them
That corresponds to predicting that the position at the next timestep is 
the same as the position at the previous timestep, and only sending the 
correction.  You could have more sophisticated predictions, e.g. assume 
velocity is constant, acceleration is constant, etc.

Also, you probably don't need all the digits of a float, either in the 
mantissa or the exponent.  16 bits might be enough, e.g. if you know 
your world will be between -100 -> 100 in all axes, you could use 16 
bits fixed point.  After each call to dWorldStep(), you just convert 
everything to 16 bit fixed point and back again.

> Any body got any comments. Can any one confirm the repeatability of body
> behaviour with repeated input forces and collisions.

Yes, check out the FAQ.  Note that it WON'T be repeatable across 
different compilers, which more-or-less means across different OSes 
(e.g. Linux vs. Windows).

- Martin




More information about the ODE mailing list