Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How is this different from the Unity DOTS Physics? #1

Open
nightrise opened this issue Apr 26, 2021 · 5 comments
Open

How is this different from the Unity DOTS Physics? #1

nightrise opened this issue Apr 26, 2021 · 5 comments

Comments

@nightrise
Copy link

Hi there,

You reference the Units DOTS Physics package in your readme, which claims to be deterministic in its description.

Is the difference here that the Unity DOTS Physics package is only deterministic on the same platform/processor, while this project is deterministic across platforms/processors?

Looks like a cool project!

@Kimbatt
Copy link
Owner

Kimbatt commented Apr 26, 2021

Exactly, DOTS physics is only deterministic on the same machine, so it's not guaranteed that the physics simulation will be the same on PC, Android, WebGL, etc.
This project guarantees that the physics simulation will run exactly the same on every single platform.
See this reddit post for details.

@tigershan1130
Copy link

tigershan1130 commented Feb 11, 2022

from my test, it seems to be deterministic on different platforms. I mean at least all 64-bit architecture would work, why would it be different when they are all using burst compiler. Is this proven? The Reddit post also doesn't explain on this matter.

@Kimbatt
Copy link
Owner

Kimbatt commented Feb 11, 2022

from my test, it seems to be deterministic on different platforms.

The video in the reddit post shows that they are different on pc, webgl, and android. It's possible that it's deterministic on most of the platforms, but the goal of this project is to be deterministic on all platforms, no matter what hardware is used.

why would it be different when they are all using burst compiler

Different platforms might implement low-level floating point operations differently.
For example, Floating point rounding mode may be different on different platforms. This means that a multiplication/division might be rounded differently on different machines, which breaks determinism. In the burst compiler, there is an option for this (FloatMode.Deterministic), but it's still not implemented.
Even if the burst compiler generated deterministic floating point operations, the mathematical functions (e.g. sqrt, trigonometry) would still not be deterministic, because those are usually implemented as hardware instructions or system calls. Also, they are usually implemented as an approximation (for performance reasons), which is good enough in 99.9% of the time (but not when trying to be deterministic).

@tigershan1130
Copy link

tigershan1130 commented Feb 11, 2022

from my test, it seems to be deterministic on different platforms.

The video in the reddit post shows that they are different on pc, webgl, and android. It's possible that it's deterministic on most of the platforms, but the goal of this project is to be deterministic on all platforms, no matter what hardware is used.

why would it be different when they are all using burst compiler

Different platforms might implement low-level floating point operations differently. For example, Floating point rounding mode may be different on different platforms. This means that a multiplication/division might be rounded differently on different machines, which breaks determinism. In the burst compiler, there is an option for this (FloatMode.Deterministic), but it's still not implemented. Even if the burst compiler generated deterministic floating point operations, the mathematical functions (e.g. sqrt, trigonometry) would still not be deterministic, because those are usually implemented as hardware instructions or system calls. Also, they are usually implemented as an approximation (for performance reasons), which is good enough in 99.9% of the time (but not when trying to be deterministic).

That's totally understandable, I used math.sin operation over ECS testing, as long as burst compiler use the same IL2CPP on either X86 or ARM architecture, the result seems to be deterministic for me(this sorta opposite of what you said). The editor returns different results as it skips IL2CPP compiler and uses mono. (even on the same platform I get different results).

@tigershan1130
Copy link

Hi, Is it possible to release the auto generation unity code tool?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants