Hello friends. I have been working with Ode very hard, and now i have it tuned i have developed a multiplayer racing game with great success.
Lot of people are asking how to synchronize all the computers. Well, here is my solution:
Syncronize all computers exactly is almost impossible due to lag. So the way is to synchronize positions with the lag time as difference.
Use the same time for ODE Step in all computers (of course...). Then you can know the lag (calculate the time between messages). The tricky is to send the actual position, rotation and velocities (angular and lineal) and a vector with the changes to the world (keys pressed normally).
Then when the client receives the data, Update the position, rotation, etc of the bodies and use the vector to keep upgrading the bodies until the next packet arrives.
The interpolation is made automatically by ode, because the car (for example a car) will move in response to keys pressed.
If there is too much lag between connections then you should refresh the car's position later, using the lag time. In this case you will see the other car's move later than the original one, but it will move smooth.
I will release a short demo soon. I have tested with two computers connected using ADSL and the results are amazing!
Good Luck!
Lot of people are asking how to synchronize all the computers. Well, here is my solution:
Syncronize all computers exactly is almost impossible due to lag. So the way is to synchronize positions with the lag time as difference.
Use the same time for ODE Step in all computers (of course...). Then you can know the lag (calculate the time between messages). The tricky is to send the actual position, rotation and velocities (angular and lineal) and a vector with the changes to the world (keys pressed normally).
Then when the client receives the data, Update the position, rotation, etc of the bodies and use the vector to keep upgrading the bodies until the next packet arrives.
The interpolation is made automatically by ode, because the car (for example a car) will move in response to keys pressed.
If there is too much lag between connections then you should refresh the car's position later, using the lag time. In this case you will see the other car's move later than the original one, but it will move smooth.
I will release a short demo soon. I have tested with two computers connected using ADSL and the results are amazing!
Good Luck!