[ODE] Using ODE in a game
Gregor Mückl
GregorMueckl at gmx.de
Fri Aug 15 10:39:01 2003
Hi!
I'm considering to use ODE in a game I'm currently designing. I'm in the
design stage and looking for suitable libraries that can make development
easier for us. However, a look at the ODE documentation braught up one
question:
The game is to be a network game. This makes things a lot more complex than
you might expect. The game will have a client-server architecture where each
client is synchronized against the server. Because of possbile bandwidth
limitations and potential cheating problems only parts of the current server
state can be sent to the client.
However, it takes time until the messages from the server reach the clients.
In order to not appear to be lagging behind the server, the client must
extrapolate the game state using the updates he has recieved from the server.
Otherwise the game would appear very "jumpy".
Updated values being passed from the server affect the game state as it was in
theh past because of the network lag (therefore each value has a time stamp).
Now the client must resimulate parts of it's view of the game state starting
from the time when the update was generated from the server.
The client needs to do the following steps when it recieves an update:
1. go back to the last step before the update's time stamp
2. step forward and try to hit the time given by the time stamp
3. update the value affected by the time stamp
4. step forward until reaching the present time
So the client has to remember past states of the game so it can incorporate
updates properly. Physics simulation in that game would also be affected by
this updating process. So the engine needs to copy (save/restore) ODE states.
How can this be done efficiently?
I think the fastest approach would be to generate a copy of the world each
time ODE executes a step. But that's not possible at the moment and doing a
manual save/restore of each value looks terribly inefficient to me.
Do you have any ideas?
Regards,
Gregor
PS: Maybe I should just wait until I have passed the upcoming theretical
mechanics lecture and write my own simulation to solve this ;-). It can't be
*that* difficult, can it? *g*