Skip to content

Commit dcf7b4e

Browse files
committed
Add logging for catchup game frames
1 parent 58f6a9a commit dcf7b4e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/MHServerEmu.Games/Game.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ private void UpdateFixedTime()
216216

217217
lock (_gameLock) // Lock to prevent state from being modified mid-update
218218
{
219+
int timesUpdated = 0;
220+
219221
while (_accumulatedFixedTimeUpdateTime >= FixedTimeBetweenUpdates)
220222
{
221223
_accumulatedFixedTimeUpdateTime -= FixedTimeBetweenUpdates;
@@ -224,12 +226,16 @@ private void UpdateFixedTime()
224226

225227
DoFixedTimeUpdate();
226228
_frameCount++;
229+
timesUpdated++;
227230

228231
_lastFixedTimeUpdateProcessTime = _gameTimer.Elapsed - fixedUpdateStartTime;
229232

230233
if (_lastFixedTimeUpdateProcessTime > FixedTimeBetweenUpdates)
231-
Logger.Warn($"UpdateFixedTime(): Took longer ({_lastFixedTimeUpdateProcessTime.TotalMilliseconds:0.00} ms) than FixedTimeBetweenUpdates ({FixedTimeBetweenUpdates.TotalMilliseconds:0.00} ms)");
234+
Logger.Warn($"UpdateFixedTime(): Frame took longer ({_lastFixedTimeUpdateProcessTime.TotalMilliseconds:0.00} ms) than FixedTimeBetweenUpdates ({FixedTimeBetweenUpdates.TotalMilliseconds:0.00} ms)");
232235
}
236+
237+
if (timesUpdated > 1)
238+
Logger.Warn($"UpdateFixedTime(): Simulated {timesUpdated} frames in a single update to catch up");
233239
}
234240
}
235241

0 commit comments

Comments
 (0)