- Home /
How to achieve cross platform deterministic physics(Android , IOS) ?
HI, We are currently working on a 3D project which is purely based on the physics engine of Unity. We have been able to achieve deterministic results on the same architecture, but sadly its not cross platform deterministic(Android & IOS).
The game is not network based, so we cannot/won't be implementing photon server for this project(network lockstep).
We know that unity is not cross platform deterministic (which is to be rolled out by unity at end of 2021... I guess!!).
We have tried DOTS/ECS/BURST without any luck!
After doing weeks of research we figured out that the problem lies in the floating points of the physics engine, and implementing a FIXED POINT MATH LIBRARY was required to achieve cross platform determinism.
We found a couple of resources on GitHub providing that fixpoint library, but failed to infuse it or override with the physics engine of Unity. Currently the only option seems like to completely make our own Rigidbody system which uses fixed point math (bump!).
Would really appreciate any help or direction in this matter!!
Hello, there are 2 physics engines built for DOTS. have you tested both?
Unity Physics package: the DOTS physics engine you need to install by default to simulate physics in any data-oriented project. Havok Physics for Unity package: an implementation of the Havok physics engine for Unity, to use as an extension of the Unity Physics package. Note that this package is subject to a specific licensing scheme.
Yes, we have tried both physics engine. In both their documentation it says their engine is not cross platform deter$$anonymous$$istic, but deter$$anonymous$$istic on the same architecture provided that the inputs of the system remains same.
Here's what they say on their official page: "Deter$$anonymous$$ism is about getting the same outcome in a physical simulation when it is given the same set of inputs. Both Unity Physics and Havok Physics provide deter$$anonymous$$istic results. However, because different CPU architectures (x86, AR$$anonymous$$, etc.) produce $$anonymous$$or differences in their mathematical calculations, the deter$$anonymous$$istic results of the simulation may be different on different hardware."
$$anonymous$$y fault, thought Float$$anonymous$$ode.deter$$anonymous$$istic was live on. After a sort search in google i found about this engine, but i have no experience with it at all https://github.com/sam-vdp/bepuphysics1int
Answer by Ajax_Studio · Nov 27, 2020 at 07:13 AM
Hey @xxmariofer !! After a lot of researching and tinkering I was able to integrate BepuPhysicsIntV1 into Unity and achieve cross platform deterministic results!!
Greatly appreciate your assistance!
There are a few lot more issues that needs resolving, like the Unity Editor keeps crashing after a few replays. Need to construct custom colliders for rigid bodies. If you have any expertise in this area, your help will be appreciated!!
THANKS AGAIN!!
sure, share the unity editor log related with the crash in case the bring some light into your issue :) you can locate them in
Linux ~/.config/unity3d/upm.log macOS ~/Library/Logs/Unity/upm.log Windows C:\Users\username\AppData\Local\Unity\Editor\upm.log