[ODE] Re: Deterministic simulation on multiple clients
Sean Butterworth
sean_butterworth at telus.net
Sun Mar 20 10:16:34 MST 2005
I have worked on commercial quality networked games before so I'll add my
two cents.
For starters, yes, the two machines will be deterministic, and will not
experience a difference in rounding errors, if the hardware is the same.
Also, the easiest way to network will be to share the input and have all the
machines deterministically achieve the identical results like you are doing.
Also, the two machines will need to have some sort mechanism for controlling
the sync state, in case one runs slightly faster than the other, which can
happen on identical hardware due to load speeds, background processes, etc.
Something like a lock step protocol, etc.
Its been my experience that the single most important thing is to ensure the
random number generator stays in sync. You cant always just make sure they
are seeded at the same time and forget about them. What is typically done
is the random number generator is reseeded every call with the previous
results. You make a function call that does this, and whenever a random
number is generated that can affect the sync state (ie randomly decide what
direction to move) you use this new call. Whenever you need a random number
for something less important (ie number of particles in an explosion) you
can revert back to the standard call. Any calls buried in libraries, etc
will still be using the standard call. I am no expert on PC games, my
experience being with consoles, but could another process running on the pc
affect the standard random?
Anyways, in your game code, it should call the new random call, which
reseeds itself with the previous call's result. This way, your game's sync
state will not be affected by what libraries you use, or any other process
that is running, that might be also using the standard library random.
I hope this help.
Sean
More information about the ODE
mailing list