TrueSync deltaTime leads to time loss unless it matches application framerate deltatime

Options
If I don't set the true sync delta time to be the same as the application framerate timing errors quickly start appearing.

In TrueSyncManager you have the following:
tsDeltaTime += UnityEngine.Time.deltaTime; if (tsDeltaTime >= (lockedTimeStep - JitterTimeFactor)) { tsDeltaTime = 0; instance.scheduler.UpdateAllCoroutines(); lockstep.Update(); }

By setting tsDeltaTime to zero you're discarding the difference between tsDeltaTime and lockedTimeStep?

Perhaps instead something similar to the following is better (it fixes my issue anyway)?

if (tsDeltaTime >= (lockedTimeStep - JitterTimeFactor)) { tsDeltaTime -= lockedTimeStep; instance.scheduler.UpdateAllCoroutines(); lockstep.Update(); }

Comments

  • JeffersonHenrique
    Options
    Hello @jddev, you are right, in the current implementation we have done something similar to what you did, even multiple updates of the simulation can execute in the same Unity's update.