Hi!
After some hours of tinkering and coding I managed to create a deterministic simulation with Box2D (Fixed Timestep, etc). I can restart the program and it yields always the exact result. (I'm using a MD5 hash digested from each bodys position and angle to verify this)
As the simulation appears the be deterministic, I thought i could easily send the state of each body over the network for an arbitrary frame and let the client simulate the next frames. But, as you may guess, it does not work. 🙁 If I send the body data for the first frame to the client, it yields the same result as the server. But if I use a later frame, lets say the 5th, the simulation get off beginning with the 6th. I already verify that the data I receive from the server and there are no rounding errors, etc.
Am I missing some important body state information? Currently, I sync the following:
Thank you!
Mozartkugel
After some hours of tinkering and coding I managed to create a deterministic simulation with Box2D (Fixed Timestep, etc). I can restart the program and it yields always the exact result. (I'm using a MD5 hash digested from each bodys position and angle to verify this)
As the simulation appears the be deterministic, I thought i could easily send the state of each body over the network for an arbitrary frame and let the client simulate the next frames. But, as you may guess, it does not work. 🙁 If I send the body data for the first frame to the client, it yields the same result as the server. But if I use a later frame, lets say the 5th, the simulation get off beginning with the 6th. I already verify that the data I receive from the server and there are no rounding errors, etc.
Am I missing some important body state information? Currently, I sync the following:
- My own representation of the BodyDefinition.
- The position of the body.
- The angle of the body.
- The Angular Velocity.
- The Linear Velocity.
Thank you!
Mozartkugel