This commit is contained in:
vis2k 2023-03-16 16:05:52 +08:00
parent ab200a57ab
commit 774ae4f5b7

View File

@ -283,7 +283,7 @@ public static SnapshotMode StepTime<T>(
localTimeline += deltaTime * catchupMultiplier;
// but clamp so it never gets too far behind.
localTimeline = Math.Max(localTimeline, targetTime - bufferTime);
Debug.LogWarning($"clamp behind: time={localTimeline:F3} target={targetTime:F3} bufferTime={bufferTime:F3} drift={drift:F3}");
Debug.LogWarning($"clamp behind: time={localTimeline:F3} target={targetTime:F3} bufferTime={bufferTime:F3} snaps={buffer.Count} drift={drift:F3}");
return SnapshotMode.ClampBehind;
}
@ -294,15 +294,15 @@ public static SnapshotMode StepTime<T>(
localTimeline += deltaTime * slowdownMultiplier;
// but clamp so it never gets too far ahead.
localTimeline = Math.Min(localTimeline, targetTime + bufferTime);
Debug.LogWarning($"clamp ahead: time={localTimeline:F3} target={targetTime:F3} bufferTime={bufferTime:F3} drift={drift:F3}");
Debug.LogWarning($"clamp ahead: time={localTimeline:F3} target={targetTime:F3} bufferTime={bufferTime:F3} snaps={buffer.Count} drift={drift:F3}");
return SnapshotMode.ClampAhead;
}
/*
// just a little behind: move by delta time and accelerate n%.
if (drift > bufferTime / 2)
{
localTimeline += deltaTime * catchupMultiplier;
Debug.LogWarning($"catchup: time={localTimeline:F3} target={targetTime:F3} bufferTime={bufferTime:F3} drift={drift:F3}");
Debug.LogWarning($"catchup: time={localTimeline:F3} target={targetTime:F3} bufferTime={bufferTime:F3} snaps={buffer.Count} drift={drift:F3}");
return SnapshotMode.Catchup;
}
@ -310,10 +310,10 @@ public static SnapshotMode StepTime<T>(
if (drift < -bufferTime / 2)
{
localTimeline += deltaTime * slowdownMultiplier;
Debug.LogWarning($"slowdown: time={localTimeline:F3} target={targetTime:F3} bufferTime={bufferTime:F3} drift={drift:F3}");
Debug.LogWarning($"slowdown: time={localTimeline:F3} target={targetTime:F3} bufferTime={bufferTime:F3} snaps={buffer.Count} drift={drift:F3}");
return SnapshotMode.Slowdown;
}
*/
// otherwise we are within normal range.
// move linearly.
localTimeline += deltaTime;