How to sync the rigidbody in a Real Time Multiplayer game?

My idea is disenable other players’s collision and only update position from net, but this could lead to new problems, the player cann’t collision with other players.

Please give me a suggestion !

Hi @Tidus and welcome,

So if you plan to sync a physics simulation over the net you that can be tricky. You will have to make sure the physics is deterministic (Ammo.js requires some tricks to get it to be), and that you can execute each state interaction at the same timestep.

If the simulation is deterministic and you apply all forces/impulses at the same timestep taking into consideration the lag that would be enough to get an accurate replication. You can find some excellent articles on how to network a physics simulation on the following blog:

If you don’t care about precision and you are ok with only partial accuracy (and your clients have a small latency) I’d say you can get away with networking the velocities and doing a partial linear correction on the position/rotation from time to time on all connected clients.

2 Likes