Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

DOTS Physics and determinism

Discussion in 'Physics Previews' started by PsycHead, Mar 19, 2019.

  1. PsycHead

    PsycHead

    Joined:
    Sep 14, 2012
    Posts:
    17
    Hello all,
    I've been looking into the new Unity Physics documentation and one thing stood out to me:
    Now I've researched cross platform/architecture physics determinism in the past and came to the conclusion, that it's not possible using floats in Unity, which is why I decided to create my own fixed point physics system.

    Question: How can we understand that determinism claim? Is the DOTS Physics system supposed to be deterministic on one machine or do you take any steps in the burst compiler to ensure cross processor and architecture float operation determinism?
     
  2. echeg

    echeg

    Joined:
    Aug 1, 2012
    Posts:
    58
    Same question.
    We use simple self 2d AABB+ physics based on fixed point math.
    We need determenism between divecies and patform (ios\android)
    May we switch to DOTS Physics engine?
     
  3. PsycHead

    PsycHead

    Joined:
    Sep 14, 2012
    Posts:
    17
    By the way, for now the system seems to actually run in the frame rate dependent update loop, so it is by design anything but deterministic. I am pretty sure that is subject to change, but for now it makes little sense to evaluate it in this regard.
     
  4. proepke

    proepke

    Joined:
    Dec 26, 2016
    Posts:
    10
  5. echeg

    echeg

    Joined:
    Aug 1, 2012
    Posts:
    58
    We use "ticks"
    I think manulay run physic step with custom "delta time" enough to solve this problem (if math itself determ)
     
  6. PsycHead

    PsycHead

    Joined:
    Sep 14, 2012
    Posts:
    17
    Yes, I remember reading that a few months ago and I guess it can work as long as the floats are never assigned by regular floats from non-burst compiled code.
    I hope they pull it off, but this comes with many, many question marks attached. Would be nice to hear about the progress on this.

    I guess you are talking about your own in house solution? Yes, that is the standard procedure if you want to achieve any kind of reliable physics.
     
  7. echeg

    echeg

    Joined:
    Aug 1, 2012
    Posts:
    58
  8. JoeOfTex

    JoeOfTex

    Joined:
    Dec 23, 2013
    Posts:
    10
    Unity Physics is not deterministic, yet, at least not 100%.

    Here is a sample where I created 6 columns of 5 spheres. Each column should bounce exactly the same. In the example gif we can see this is not the case.

    (Test #1)
    https://thumbs.gfycat.com/TerrificDizzyDairycow.webp


    However, if I repeat the process, we can compare the two and see if it its consistent across runs.
    (Test #2)
    https://thumbs.gfycat.com/EnlightenedGargantuanAdder.webp


    To be 100% deterministic the results should be the same no matter the coordinates.

    It's hard for me to tell with this example. Perhaps we need something more dramatic. But this example, does show differences between the columns that are identical. This may have major effects in something like racing games, where user on left side might experience slightly different physics than the user on right side.

    EDIT: I can't seem to embed the gfycat gifs, sorry!
     
    Last edited: Mar 25, 2019
  9. echeg

    echeg

    Joined:
    Aug 1, 2012
    Posts:
    58
    I think determenism is:
    Same Input -> simulation -> Same output.
    If you change coordinates its not same input
     
    illinar, rizu and Guerro323 like this.