I'm new to Unity. I am making my first Game and faced with problem. I have a plane and 4 gameobject that has box collider surrounded this plane. there are a few spheres as players inside of the plane.I built the game. I run 2 instances of the game and add force to a sphere and send this force to other client through node server. But border reflection angle differs in 2 clients. I checked value of the force in 2 clients and that is the same. Any help would be appreciated.

  • \$\begingroup\$ What are you synchronizing? Force and Input? \$\endgroup\$ – AlexWei Jan 21 '19 at 9:15
  • \$\begingroup\$ If you want to sync physics instead of "normal states", lockstep could be a help. \$\endgroup\$ – AlexWei Jan 21 '19 at 9:17
  • \$\begingroup\$ @AlexWei thanks. force is synchronizing. When I add force to sphere, send a command to server and server broadcast command to other clients. I think my problem is not on latency of server, it is different behavior of borders to interact with sphere. \$\endgroup\$ – s.john Jan 21 '19 at 10:12
  • \$\begingroup\$ If i'm not wrong, because of the way floating points are calculated, physics are not 100% the same every time you run them. So if you have 2 identical scenes running, with some spheres falling on top of a box, you will have different results. This is enchanted even more if the 2 clients are different platforms, that calculate floating points in a unique way. I don't have much experience in that, so I'm not posting this as an answer. \$\endgroup\$ – TomTsagk Jan 21 '19 at 16:39
  • \$\begingroup\$ Unity's physics engines, PhysX and Box2D, do not make guarantees of determinism (ie. it's possible that running the simulation twice with the same inputs may produce different outputs). That's because they prioritize speed & plausibility over absolute correctness, so they don't handle the extra overhead of eg. ensuring that all objects/events are processed in the same order. The divergence is usually small if you catch it early with additional replicated information, before it has a chance to snowball. \$\endgroup\$ – DMGregory Jan 21 '19 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.