Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to do Physics Rollback (with Physix)

Discussion in 'Multiplayer' started by GamerLordMat, Aug 14, 2021.

  1. GamerLordMat


    Oct 10, 2019
    Dear all,

    I want to write my own networking layer for a phyisics game, but I don't think Physix is deterministic enough.
    In my experiments with rollback the outcome is different everytime.
    Are there good alternatives? I know Unity Physics with ECS would be suitable but I can't stand ECS in it's current state (undocumented).
    Bullet is a good deterministic stateless engine but there is no up-to-date Unity implementation for it.
    Any ideas?

    kind regards
  2. luke-unity


    Unity Technologies

    Sep 30, 2020
    No matter which physics engine you use, if you use floats it will not be deterministic across all machines.

    You are right that PhysX is not deterministic but there is an enhanced determinism mode which can allow PhysX to be deterministic on the same machine under certain circumstances. This will not be the case though if you do a manual rollback.

    The question I'd ask is if you really need full determinism. Most games which use a client side prediction and rollback model don't do that. Usually their prediction is accurate enough even if it is non deterministic and they let themselves get corrected by the server.