Cross-platform deterministic physics with Unity DOTS physics and soft floats

This page summarizes the projects mentioned and recommended in the original post on /r/Unity3D

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • libm

    A port of MUSL's libm to Rust.

  • So, fixed-point numbers weren't the solution to the problem either. The next thing I came across was the Rapier physics engine. It promises cross-platform determinism all IEEE 754-2008 compliant platforms. Although it's written in Rust, creating C# bindings was fairly easy, and I could use it in Unity after a few hours. But Rapier is still in early stages of development, which means that (at the time of writing this) it lacked many features, like raycasting, which would have been necessary for my project. Also, it's only deterministic on IEEE 754-2008 compliant platforms. But I couldn't really find any information on which processors support it. Even if I did, I still wanted to have deterministic physics on all platforms, not just on "most of them". But I still wondered does how Rapier achieve cross-platform floating point determinism. Supporting only IEEE 754-2008 compliant platforms is one thing, but the mathematical functions I mentioned above (sqrt, trigonometry, etc.) must also be deterministic. I found out that it uses libm, which implements all of these functions in software. It was primarily designed for embedded systems without FPUs, but it turns out it's also pretty useful for making this part of floating point math deterministic. But after all, the basic mathematical operations of floats are still not deterministic. Unless... How about emulating the behavior of floats in software? It should be possible to write a program that works on the byte representation of a float, doing all operations using integer arithmentic... right?

  • SoftFloat

    An implementation of 32 bit floating point arithmetic in C#

  • Yep! I quickly found a repository that does just that! Here it is: https://github.com/CodesInChaos/SoftFloat And it worked! Except for one thing... It didn't have division implemented. After hours of searching and studying how floats work, I finally managed to implement division. Using it together with libm, it was now possible to have cross-platform deterministic floats, that work (almost) exactly the same way as the regular floats, but they will give the same result everywhere, on every platform, on every processor.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • soft-float-starter-pack

    Software implementation of floating point numbers and operations

  • My code for the soft floats is available here.

  • Somehow I cant find the Unity DOTS physics on Github to see what the license is. I found, for example, their DOTS Samples repository, which has a "Unity Companion License", meaning its " royalty-free copyright license to reproduce, prepare derivative works " etc. I would imagine all their github projects are like that. I could even ask on the forums if you would be willing to share the code in case the licence is ok (which I am sure it is judging by Unity's other repos)

  • unity-deterministic-physics

    Cross-platform deterministic physics simulation in Unity, using DOTS physics and soft floats

  • Here it is: https://github.com/Kimbatt/unity-deterministic-physics

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • VContainer VS Init(args) Lite - a user suggested alternative

    2 projects | 5 May 2024
  • Zenject VS Init(args) Lite - a user suggested alternative

    2 projects | 5 May 2024
  • Optimizing Graphics and Rendering in Unity: Key aspects and practical solutions

    2 projects | dev.to | 29 Apr 2024
  • Methods of object interaction in Unity. How to work with patterns and connections in your code

    1 project | dev.to | 2 Apr 2024
  • Create More, Consume Less

    1 project | news.ycombinator.com | 12 Mar 2024