private void UnpauseAtTickMsec(uint UnpauseTime, uint GameTickToUnpauseAt) { float waitTime = (UnpauseTime - OS.GetTicksMsec()) / 1000f; MDLog.Trace(LOG_CAT, $"Unpausing game in {waitTime}"); Timer timer = this.CreateUnpausableTimer(RESUME_TIMER_NAME, true, waitTime, true, this, nameof(OnUnpauseTimerTimeout)); timer.Start(); OnSynchCompleteEvent(waitTime); if (GameClock != null && MDStatics.IsClient()) { GameClock.SetCurrentTick(GameTickToUnpauseAt); } }
private void OnSessionStartedEvent() { if (this.IsClient()) { // Add max ping information between this client and any other client // Roundtrip is: client 1 -> server -> client 2 -> server -> client 1. // TODO: Max ping should be not identical for each player we ping MDOnScreenDebug.AddOnScreenDebugInfo(DEBUG_CAT, "MaxRoundtripPing: ", () => MaxPing.ToString()); PauseGame(); SynchronizationState = SynchronizationStates.SYNCHRONIZING_IN_PROGRESS; } else { SynchronizationState = SynchronizationStates.SYNCRHONIZED; } // Reset to tick 0 at start of session GameClock?.SetCurrentTick(0); }