Skip to content

Fix the map viewer FPS counter on slow frames - #5387

Open
TahaHydra wants to merge 1 commit into
ItsNotRexed:mainfrom
TahaHydra:codex/viewer-slow-frame-fps
Open

TahaHydra wants to merge 1 commit into
ItsNotRexed:mainfrom
TahaHydra:codex/viewer-slow-frame-fps

Conversation

@TahaHydra

Copy link
Copy Markdown

At 200 ms per frame, the map viewer showed 10 FPS. The counter was using the camera's movement step, which tops out at 100 ms. This change uses elapsed time for FPS and keeps the cap on movement.

The regression test runs six frames at 200 ms each. The HUD now reads 5 FPS, and holding E still moves the camera 24 metres. All 52 viewer tests passed on Windows with Node 24.14.0 (node --test tests/test_viewer_streaming.cjs). The test uses a simulated clock and runs without a GPU.

Tracker claim. AI-assisted with Codex.

@whattheflop

Copy link
Copy Markdown
Contributor

AI-assisted Windows CPU verification, Node 24.16.0. At eefdc14c, #5387 passes 52/52 tests. A disposable integration with #5244 at 9554b733 passed 56/56 after reconciling the shared synthetic camera fixture, then 57/57 with a new cadence test. The production viewer merged cleanly. Both PRs extend the same test fixture in different ways.

The added test steps through 62.5 ms, 250 ms, then 62.5 ms frames. The HUD reads 16, 4, then 16 FPS. Holding E moves the camera 22.5, 12, and 22.5 m over those phases, preserving the movement cap. The LOD swap hides the cached coarse tier and reduces the projection and fog reach to the visible fine tier. Returning restores the coarse reach without another request. Moving beyond both tiers restores their 6,000 and 2,600 m floors.

Reusing the capped step for FPS, removing the movement cap, including cached-hidden tiers, and preventing range shrink each failed the new test when introduced separately. All inputs were synthetic. The additional cadence test is in disposable integration tree 1449b9c1.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head eefdc14c89.

Commands:

  • node tests/test_viewer_streaming.cjs -> 52 pass / 0 fail
  • Negative control: main's viewer/index.html + this test -> FAIL, HUD shows 10 fps where 5 fps is expected for 0.2 s frames
  • git diff --check main...HEAD -> clean

FPS now divides by the real clock.getDelta() while camera movement keeps the 0.1 s clamp, so slow frames no longer over-report. The new fixture asserts both halves (5 fps and the 24 m climb after 6 capped steps).

Verdict: LGTM.

@dukefissura

Copy link
Copy Markdown
Contributor

Merge-order note on the current main. eefdc14 merges cleanly onto 561b65a (Linux, Node 22.23.5), but there node --test tests/test_viewer_streaming.cjs fails the new slow frames report actual FPS and cap camera movement test, and the existing Shift/Ctrl test too, with ReferenceError: AbortController is not defined. Since this branch's base, main's viewer has started calling new AbortController() during startup, and the shared animationFixture sandbox doesn't pass it in.

With #5692 merged as well (the one-line AbortController, setTimeout, clearTimeout fix for that sandbox), the file passes 58/58. Against main's viewer/index.html the new test still fails (the HUD shows 10 fps for 0.2 s frames), so it keeps catching the bug. Suggest adding Depends on: #5692, or adding the same line to animationFixture here. AI-assisted (Claude).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants