add "ticks per render" metric

This commit is contained in:
scamiv
2025-11-25 17:44:54 +01:00
parent a21f066700
commit 6ab7136c3c
3 changed files with 23 additions and 0 deletions
+8
View File
@@ -213,6 +213,7 @@ export class ClientGameRunner {
private lastProcessedTick: number = 0;
private backlogTurns: number = 0;
private backlogGrowing: boolean = false;
private lastRenderedTick: number = 0;
private pendingUpdates: GameUpdateViewData[] = [];
private pendingStart = 0;
@@ -518,12 +519,19 @@ export class ClientGameRunner {
// Only emit metrics when ALL processing is complete
if (this.pendingStart >= this.pendingUpdates.length) {
const ticksPerRender =
this.lastRenderedTick === 0
? lastTick
: lastTick - this.lastRenderedTick;
this.lastRenderedTick = lastTick;
this.renderer.tick();
this.eventBus.emit(
new TickMetricsEvent(
lastTickDuration,
this.currentTickDelay,
this.backlogTurns,
ticksPerRender,
),
);