mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-05 19:35:13 +00:00
Clean up previous implementations
removed: - catchUpMode and its CATCH_UP_ENTER/EXIT thresholds in ClientGameRunner - tick metrics fields and overlay UI for inCatchUpMode and beatsPerFrame - leftover worker heartbeat plumbing (message type + WorkerClient.sendHeartbeat) that was no longer used after self-clocking changed: - backlog tracking: keep serverTurnHighWater / lastProcessedTick / backlogTurns, but simplify it to just compute backlog and a backlogGrowing flag instead of driving a dedicated catch-up mode - frame skip: adaptRenderFrequency now only increases renderEveryN when backlog > 0 and still growing; when backlog is stable/shrinking or zero, it decays renderEveryN back toward 1 - render loop: uses the backlog-aware renderEveryN unconditionally (no catch-up flag), and resets skipping completely when backlog reaches 0 - metrics/overlay: TickMetricsEvent now carries backlogTurns and renderEveryN; the performance overlay displays backlog and current “render every N frames” but no longer mentions catch-up or heartbeats Learnings during branch development leading to this Once the worker self-clocks, a separate “catch-up mode” and beats-per-frame knob don’t add real control; they just complicate the model. Backlog is still a valuable signal, but it’s more effective as a quantitative input (backlog size and whether it’s growing) than as a boolean mode toggle. Frame skipping should be driven by actual backlog pressure plus frame cost: throttle only while backlog is growing and frames are heavy, and automatically relax back to full-rate rendering once the simulation catches up.
This commit is contained in:
@@ -233,9 +233,7 @@ export class PerformanceOverlay extends LitElement implements Layer {
|
||||
event.tickExecutionDuration,
|
||||
event.tickDelay,
|
||||
event.backlogTurns,
|
||||
event.inCatchUpMode,
|
||||
event.renderEveryN,
|
||||
event.beatsPerFrame,
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -425,25 +423,17 @@ export class PerformanceOverlay extends LitElement implements Layer {
|
||||
this.layerBreakdown = breakdown;
|
||||
}
|
||||
|
||||
@state()
|
||||
private backlogTurns: number = 0;
|
||||
|
||||
@state()
|
||||
private inCatchUpMode: boolean = false;
|
||||
|
||||
@state()
|
||||
private renderEveryN: number = 1;
|
||||
|
||||
@state()
|
||||
private beatsPerFrame: number | null = null;
|
||||
private backlogTurns: number = 0;
|
||||
|
||||
updateTickMetrics(
|
||||
tickExecutionDuration?: number,
|
||||
tickDelay?: number,
|
||||
backlogTurns?: number,
|
||||
inCatchUpMode?: boolean,
|
||||
renderEveryN?: number,
|
||||
beatsPerFrame?: number,
|
||||
) {
|
||||
if (!this.isVisible || !this.userSettings.performanceOverlay()) return;
|
||||
|
||||
@@ -484,15 +474,9 @@ export class PerformanceOverlay extends LitElement implements Layer {
|
||||
if (backlogTurns !== undefined) {
|
||||
this.backlogTurns = backlogTurns;
|
||||
}
|
||||
if (inCatchUpMode !== undefined) {
|
||||
this.inCatchUpMode = inCatchUpMode;
|
||||
}
|
||||
if (renderEveryN !== undefined) {
|
||||
this.renderEveryN = renderEveryN;
|
||||
}
|
||||
if (beatsPerFrame !== undefined) {
|
||||
this.beatsPerFrame = beatsPerFrame ?? null;
|
||||
}
|
||||
|
||||
this.requestUpdate();
|
||||
}
|
||||
@@ -642,13 +626,10 @@ export class PerformanceOverlay extends LitElement implements Layer {
|
||||
<div class="performance-line">
|
||||
Backlog turns:
|
||||
<span>${this.backlogTurns}</span>
|
||||
${this.inCatchUpMode ? html`<span> (catch-up)</span>` : html``}
|
||||
</div>
|
||||
${this.inCatchUpMode
|
||||
${this.renderEveryN > 1
|
||||
? html`<div class="performance-line">
|
||||
Render every <span>${this.renderEveryN}</span> frame(s),
|
||||
heartbeats per frame:
|
||||
<span>${this.beatsPerFrame ?? "auto"}</span>
|
||||
Render every <span>${this.renderEveryN}</span> frame(s)
|
||||
</div>`
|
||||
: html``}
|
||||
${this.layerBreakdown.length
|
||||
|
||||
Reference in New Issue
Block a user