Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Randomness in solvers
#1
dear obi community and obi experts

I have a question: we are trying to synchronize two softbody actors over network, as suggested on this thread.


As a start we made two identical obi softbody setups running in the same unity application.

One setup involves:
- one obi solver
- two actors (spheres) with slightly different properties.
- obi colliders as a bounding box

We copied the setup within the unity hierarchy and placed it next to the original setup, in PlayMode we noticed that the two setups behave differently after already a few seconds.

The image attached shows the problematic. The setups run side by side with the same parameter values but already differ after a few seconds. Where is the randomness?

According to my understanding the softbody physiscs engine should be deterministic and therefore should behave identical when an identical copy is running on the same machine. Am I wrong?


thank you


Attached Files Thumbnail(s)
   
Reply
#2
(26-09-2024, 10:55 AM)aivenhoe Wrote: According to my understanding the softbody physiscs engine should be deterministic

Hi,

Most existing physics engines are not deterministic, this includes both Obi and Unity's own engine (PhysX).

The only way to get cross-platform determinism required for networked games (in the same machine and between machines with potentially different architectures as well) is to emulate floating point math - using fixed point or emulating it in software. This comes at a performance cost and often requires the engine to be written with this requirement in mind from the beginning.

For instance, you can find versions of Unity's DOTS physics engine that use software-emulated floating point numbers to achieve determinism.

The reason is that hardware-based floating point math can give slightly different results on different processor architectures. Furthermore, within the same machine multithreading may also yield non-deterministic results as the order in which threads are scheduled change order of operations and hence, floating point accuracy may change results.

This is why physics usually need to be synchronized over the network. Otherwise you'd be good just by making sure world state at time = 0 is the same for server/clients, and then let all devices run the simulation without any synchronization.

kind regards,
Reply