Question about DeltaTime

Options
Hi,

I've a question about your FixedUpdate () loop inside TrueSyncManager.

private FP tsDeltaTime = 0;

void FixedUpdate() {
if (lockstep != null) {
tsDeltaTime += UnityEngine.Time.deltaTime;

if (tsDeltaTime >= (lockedTimeStep - JitterTimeFactor)) {
tsDeltaTime = 0;

instance.scheduler.UpdateAllCoroutines();
lockstep.Update();
}
}
}

Actually here you are accumulating time in a dedicated FP (tsDeltaTime), adding a floating point value to it. You're also using another float, jitterTimeFactor.

How do you ensure that these values have the same representation on different machines? I'm afraid that something could desync after some time...

Comments

  • erickpassos
    Options
    This is not used to store our accumulated FP time... It is basically to test if enough time has passed locally to try to simulate another TICK. The Time and DeltaTime should be accumulated using the fixed value that you set in TrueSync's settings asset. If implementation differs from this, then it is a bug that we'll fix right now...:)

    Thanks for posting the question. Stuff like this makes us aware of possible issues.
  • Devis
    Options
    Ok, you're right. Thanks @erickpassos.