fix(fps-counter): the counter's sizes are the old counter's again, at every setting and screen #3238

Merged
HumanBean merged 13 commits from llun/Longshot:fix/fps-counter-old-sizes into main 2026-12-05 17:10:01 +00:00
Member

Summary

The FPS counter is the size it was before the mod API again, at every setting and screen size.

Before #2822 the renderer drew the counter (gpu/vk/vk_menu.cpp draw_fps at d984fd704^). Its sizes were:

  • Auto: the menu's own size, so it grew with the window and followed the Menu size (Small, Medium, Large).
  • Small, Medium and Large: fixed pixel sizes (1, 1.5 and 2 pixels a point) whatever the window, at most 1.3 a
    720th of its height.
  • Edge gap: 2.5% of the screen's height from the edges (5% at the Large menu size).
  • Font: the game's own menu font, with a solid outline round the number, a soft outline and drop shadow round
    the rest, and every digit as wide as the others.

Since the counter became a system mod (game/mods/fps-counter), every size grows with the screen, Auto ignores the
Menu size, the edge gap is 16, its texts are the UI's own font drawn about 1.3 times bigger, and its numbers shift
sideways as their digits change. At 4K, Small was 2.6 times its old size.

To see it on main: Debug > FPS counter size Small at 1080p, then at 4K (it grows), or Auto with Gameplay > Menu size
Small against Large (it does not change).

Pixels a point, before #2822 → main (16:9, Menu size Medium unless said); this PR gives the left numbers again:

Setting 720p 1080p 1440p 4K
Auto 0.90 → 1.00 1.35 → 1.50 1.80 → 2.00 2.70 → 3.00
Auto, Small menu 0.78 → 1.00 1.17 → 1.50 1.56 → 2.00 2.34 → 3.00
Auto, Large menu 1.20 → 1.00 1.80 → 1.50 2.40 → 2.00 3.60 → 3.00
Small 1.00 → 0.87 1.00 → 1.30 1.00 → 1.73 1.00 → 2.60
Medium 1.30 → 1.00 1.50 → 1.50 1.50 → 2.00 1.50 → 3.00
Large 1.30 → 1.33 1.95 → 2.00 2.00 → 2.67 2.00 → 4.00
Edge gap (px) 18 → 11 27 → 16 36 → 21 54 → 32

The counter needed five small additions to the mod API, each its own commit, for any mod to use:

  1. longshot/ui screen(): the picture's size in pixels, for what keeps one size in pixels whatever the window.
  2. A text's font: "ui" (the default) or "game", the game's menu fonts the renderer already hands the UI from the
    player's own files. A mod picks by name and never gets the font.
  3. A Canvas text's outline: shadowWidth, shadowRing (all round), dropShadow.
  4. Canvas text down to 2 virtual px (was 8): a text kept 12 pixels high is 3 virtual px on an 8K screen.
  5. fontVariantNumeric: "tabular" / tabular: true: every digit one width (OpenType tnum).

The counter (counter.ts oldSize, say, plan; main.tsx) uses them:

  • the old size rule, edge gap and room between its parts, the column's old height;
  • the old outlines;
  • tabular digits in every text;
  • the Dev grid's rows paired by drawn widths, as before (an estimate had split them differently);
  • the footer's last lines given up on a screen too short for the column, as before;
  • while the Insert menu is open, at the top right under the menu's banner with the number and frame time at most, as
    the old counter did (it hears the menu through longshot/settings-host), worked out again when the window is
    resized with the menu open.

It reads the Menu size and the compact menu through mod.toml's reads. Keys are unchanged.

Keeps HumanBean's #3144 ("FPS" no longer cut off: the width estimate). Replaces Veix's Small of 1.3 from #3071 with the
old fixed size, as asked; #3071's menu scaling is untouched.

Read first: game/mods/fps-counter/src/counter.ts (oldSize, say, plan), then game/crates/ui/src/text.rs
(TextFont, stack_for, tabular) and game/crates/ui/src/canvas.rs (the text command's new parts).

Written with AI assistance (Claude).

Testing

Tested: Windows 11, RTX 5080, driver 621.47. Ran this PR's runtime against nightly-880 (86fdb213, the counter's code
as at d984fd704^) headless, with RX_VK_SHOT_MENU=1 shots, on the title screen.

  • Each size (Auto, Small, Medium, Large), each Menu size, the FPS and Breakdown levels, at 1920x1080, 2560x1440,
    3840x2160, 1920x1200 and 1280x800: the number's top, right edge, width and height match the old counter within 1-3
    px.
  • All four corners: the graph, legend, Dev grid and footer in the same places.
  • A 1920x480 screen at Large: both drop the footer's last lines alike.
  • Menu language Japanese: the labels draw, no missing letters.
  • RX_VK_UI_GAME_FONT=0 (no game font): the counter falls back to Atkinson at the same sizes.
  • With the Insert menu open, the counter set to the bottom left shows at the top right under the banner, number and
    frame time only, at the full and the compact menu (Medium and Large). There is no old shot of this: nightly-880 has
    no menu_key headless.
  • In a real window (1920x1080) the counter draws as in the headless shots.
  • 7680x4320 (headless), Small at Breakdown: the texts at their old pixel sizes, laid out as at 1080p.
  • Screenshots, nightly-880 beside this PR, the numbers above measured from them:
    #3238 (comment)

Checks:

  • longshot-builder mod test game/mods/fps-counter: 21 passed, the sizes at 720p, 1080p, 4K and 8K (Small's "FPS" 13
    pixels at 8K) and the menu open with the window resized included. The new size, Menu size and menu-open tests fail on
    main's counter (the number at 42 where the old one drew it at 37.8).
  • cargo test -p game-ui -p script -p longshot-game: all pass (201, 214, 92 and the rest), new tests for each API
    addition included. cargo clippy on game-ui, script, api and longshot-game: clean (with -A clippy::large_const_arrays -A unused_imports for two warnings in host-sys and build-core, crates this PR does not touch). rustfmt clean.
    mise run lint: passes.
  • api's a_walked_reshade_folder_counts_a_change_once_two_walks_agree fails, as it does on clean main on Windows.
  • mise run test -- --jobs 12 (Windows): 846 passed, 13 failed, 52 skipped. Twelve fail on clean main on Windows too
    (test_lifter, test_present_acquire_ahead, test_stack_commit, test_no_game_title, test_present_held_image,
    test_sync_watch_event, test_turf_budget, test_present_geometry_trace, test_present_image_free, test_ui_renderer,
    test_dlssg, test_no_map_reload); none reads a file this PR changes. test_recorder_parts failed in the full run and
    passes alone, on main 7bc53f841 and on this PR alike.

Still to test:

  • Linux (any GPU): the FPS counter at each size at 1080p and 4K, and with the Insert menu open, expecting the sizes and
    places above and no missing letters (@Beanstalk the FPS counter's sizes on Linux)
  • Steam Deck (1280x800, handheld): FPS counter Auto and Small, expecting a small counter in the corner, as on
    nightly-880 (by hand, or the Test Farm)
  • Windows, AMD or Intel GPU: the counter at Breakdown, expecting the outlines and tabular digits as on NVIDIA
    (@Beanstalk)
  • The Insert menu open against nightly-880 in a window, by hand: expecting the counter under the banner on both

Measurements

Verdict: no change in frame rate measurable on this PC. The counter's script costs more only in the frames where
it lays its texts out again, four a second: about 0.02 ms more at FPS, 0.05 at Graph, 0.1 at Dev; and 0.26 ms more in
the frame after a counter setting changes. Its average frame is within 0.02 ms of main's.

Setup: Windows 11, RTX 5080, driver 621.47, Ryzen 9 9900X3D. In the game: dev.py ab on one runtime (this PR's), side A
the system mods with main's counter (HOS_SYSTEM_MODS_DIR), side B this PR's, the counter at Dev
(LONGSHOT_SET=system/fps-counter:fps_counter=5), Hyrule Field, uncapped, 67% render, 60 s each, interleaved
A1 B1 A2 B2 A3 B3. Other jobs shared the PC, and moved the rate by 25% between pairs.

Baseline: main's counter (the system mod at 3a0f7d8f7: no commit since touches it) against this PR's counter, both on one
runtime of this PR (HOS_SYSTEM_MODS_DIR), so only the counter differs. The runs were before the rebase onto 7bc53f841
(no file in common) and before the Dev grid's rows were measured rather than estimated.

Before: main @ 3a0f7d8f7 After: this PR @ 3b220702a
fps, pair 1 / 2 / 3 122.8 / 148.2 / 155.1 122.2 / 145.3 / 155.2
median frame, ms 8.11 / 6.51 / 6.29 8.00 / 6.68 / 6.32
1% low, fps 97.9 / 99.8 / 108.8 74.5 / 98.1 / 109.4
counter script, worst frame (mod test, 5 interleaved runs, at f143e96f1) 1.64 ms median 1.90 ms median
counter script, the four-a-second frames: FPS / Graph / Dev (fake game, p99 of 900 frames, 3 interleaved runs) 0.16-0.21 / 0.41 / 0.76-0.94 ms 0.18-0.19 / 0.45-0.49 / 0.88-1.09 ms
counter script, Dev's four-a-second frames' mean (7 interleaved runs; this PR at 1cec5fe1b) 0.67-0.72 ms 0.76-0.85 ms
counter script, mean frame: FPS / Dev 0.009-0.012 / 0.20-0.25 ms 0.010-0.011 / 0.20-0.27 ms

One run of this PR (B1) had a 1% low dip the other two did not repeat. The script worst frame is the fake game's
budget test (Dev at Large, a level switched every 30 frames: the first frame of a view), on the same busy PC; main's
own went over its 2 ms ceiling once there. Of the 0.26 ms, about half is the texts' new options (the outline's step and
ring, the drop shadow, the font, tabular: 1.78 ms with them left out) and half the counter's own layout. The
four-a-second frames are where it reads the numbers and lays the texts out again (texts(): plan and the head drawn
again), with the graph's own frames between them as on main; the fake game's frames with the counter on for 15 s at
each level, main's counter and this PR's side by side, at f143e96f1. 1cec5fe1b then keeps the Dev lines' widths while
their values stay (0.84 to 0.81 ms at Dev); the rest is spread over the texts' options, the Dev lines measured as drawn
and the head's ring, none more than about 0.03 ms of it alone.

Risks

  • What players see changes back to before #2822: Small, Medium and Large keep their pixel size whatever the window
    (much smaller at 4K than on main), Auto follows the Menu size, the counter moves under the banner while the Insert
    menu is open. No setting or saved value changes; keys are the same. A revert is enough.
  • Mods: five API additions, each optional; a mod that uses none of them is unchanged (a Canvas text command without
    the new parts is as before). The counter now holds settings.host (to hear the menu open) and reads two of the
    Interface mod's settings.
  • The counter's script: about 0.1 ms more four times a second at Dev (less at the smaller levels), and about 0.3 ms in
    the frame after a setting changes (Measurements).

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary **The FPS counter is the size it was before the mod API again, at every setting and screen size.** Before #2822 the renderer drew the counter (`gpu/vk/vk_menu.cpp` `draw_fps` at d984fd704^). Its sizes were: - **Auto:** the menu's own size, so it grew with the window and followed the Menu size (Small, Medium, Large). - **Small, Medium and Large:** fixed pixel sizes (1, 1.5 and 2 pixels a point) whatever the window, at most 1.3 a 720th of its height. - **Edge gap:** 2.5% of the screen's height from the edges (5% at the Large menu size). - **Font:** the game's own menu font, with a solid outline round the number, a soft outline and drop shadow round the rest, and every digit as wide as the others. Since the counter became a system mod (`game/mods/fps-counter`), every size grows with the screen, Auto ignores the Menu size, the edge gap is 16, its texts are the UI's own font drawn about 1.3 times bigger, and its numbers shift sideways as their digits change. At 4K, Small was 2.6 times its old size. To see it on main: Debug > FPS counter size Small at 1080p, then at 4K (it grows), or Auto with Gameplay > Menu size Small against Large (it does not change). Pixels a point, before #2822 → main (16:9, Menu size Medium unless said); this PR gives the left numbers again: | Setting | 720p | 1080p | 1440p | 4K | |---|---|---|---|---| | Auto | 0.90 → 1.00 | 1.35 → 1.50 | 1.80 → 2.00 | 2.70 → 3.00 | | Auto, Small menu | 0.78 → 1.00 | 1.17 → 1.50 | 1.56 → 2.00 | 2.34 → 3.00 | | Auto, Large menu | 1.20 → 1.00 | 1.80 → 1.50 | 2.40 → 2.00 | 3.60 → 3.00 | | Small | 1.00 → 0.87 | 1.00 → 1.30 | 1.00 → 1.73 | 1.00 → 2.60 | | Medium | 1.30 → 1.00 | 1.50 → 1.50 | 1.50 → 2.00 | 1.50 → 3.00 | | Large | 1.30 → 1.33 | 1.95 → 2.00 | 2.00 → 2.67 | 2.00 → 4.00 | | Edge gap (px) | 18 → 11 | 27 → 16 | 36 → 21 | 54 → 32 | The counter needed five small additions to the mod API, each its own commit, for any mod to use: 1. `longshot/ui` `screen()`: the picture's size in pixels, for what keeps one size in pixels whatever the window. 2. A text's `font`: `"ui"` (the default) or `"game"`, the game's menu fonts the renderer already hands the UI from the player's own files. A mod picks by name and never gets the font. 3. A Canvas text's outline: `shadowWidth`, `shadowRing` (all round), `dropShadow`. 4. Canvas text down to 2 virtual px (was 8): a text kept 12 pixels high is 3 virtual px on an 8K screen. 5. `fontVariantNumeric: "tabular"` / `tabular: true`: every digit one width (OpenType `tnum`). The counter (`counter.ts` `oldSize`, `say`, `plan`; `main.tsx`) uses them: - the old size rule, edge gap and room between its parts, the column's old height; - the old outlines; - tabular digits in every text; - the Dev grid's rows paired by drawn widths, as before (an estimate had split them differently); - the footer's last lines given up on a screen too short for the column, as before; - while the Insert menu is open, at the top right under the menu's banner with the number and frame time at most, as the old counter did (it hears the menu through `longshot/settings-host`), worked out again when the window is resized with the menu open. It reads the Menu size and the compact menu through mod.toml's `reads`. Keys are unchanged. Keeps HumanBean's #3144 ("FPS" no longer cut off: the width estimate). Replaces Veix's Small of 1.3 from #3071 with the old fixed size, as asked; #3071's menu scaling is untouched. Read first: `game/mods/fps-counter/src/counter.ts` (`oldSize`, `say`, `plan`), then `game/crates/ui/src/text.rs` (`TextFont`, `stack_for`, `tabular`) and `game/crates/ui/src/canvas.rs` (the text command's new parts). Written with AI assistance (Claude). ## Testing **Tested:** Windows 11, RTX 5080, driver 621.47. Ran this PR's runtime against nightly-880 (86fdb213, the counter's code as at d984fd704^) headless, with `RX_VK_SHOT_MENU=1` shots, on the title screen. - Each size (Auto, Small, Medium, Large), each Menu size, the FPS and Breakdown levels, at 1920x1080, 2560x1440, 3840x2160, 1920x1200 and 1280x800: the number's top, right edge, width and height match the old counter within 1-3 px. - All four corners: the graph, legend, Dev grid and footer in the same places. - A 1920x480 screen at Large: both drop the footer's last lines alike. - Menu language Japanese: the labels draw, no missing letters. - `RX_VK_UI_GAME_FONT=0` (no game font): the counter falls back to Atkinson at the same sizes. - With the Insert menu open, the counter set to the bottom left shows at the top right under the banner, number and frame time only, at the full and the compact menu (Medium and Large). There is no old shot of this: nightly-880 has no `menu_key` headless. - In a real window (1920x1080) the counter draws as in the headless shots. - 7680x4320 (headless), Small at Breakdown: the texts at their old pixel sizes, laid out as at 1080p. - Screenshots, nightly-880 beside this PR, the numbers above measured from them: https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/3238#issuecomment-105470 Checks: - `longshot-builder mod test game/mods/fps-counter`: 21 passed, the sizes at 720p, 1080p, 4K and 8K (Small's "FPS" 13 pixels at 8K) and the menu open with the window resized included. The new size, Menu size and menu-open tests fail on main's counter (the number at 42 where the old one drew it at 37.8). - `cargo test -p game-ui -p script -p longshot-game`: all pass (201, 214, 92 and the rest), new tests for each API addition included. `cargo clippy` on game-ui, script, api and longshot-game: clean (with `-A clippy::large_const_arrays -A unused_imports` for two warnings in host-sys and build-core, crates this PR does not touch). rustfmt clean. `mise run lint`: passes. - `api`'s `a_walked_reshade_folder_counts_a_change_once_two_walks_agree` fails, as it does on clean main on Windows. - `mise run test -- --jobs 12` (Windows): 846 passed, 13 failed, 52 skipped. Twelve fail on clean main on Windows too (test_lifter, test_present_acquire_ahead, test_stack_commit, test_no_game_title, test_present_held_image, test_sync_watch_event, test_turf_budget, test_present_geometry_trace, test_present_image_free, test_ui_renderer, test_dlssg, test_no_map_reload); none reads a file this PR changes. test_recorder_parts failed in the full run and passes alone, on main 7bc53f841 and on this PR alike. **Still to test:** - Linux (any GPU): the FPS counter at each size at 1080p and 4K, and with the Insert menu open, expecting the sizes and places above and no missing letters (@Beanstalk the FPS counter's sizes on Linux) - Steam Deck (1280x800, handheld): FPS counter Auto and Small, expecting a small counter in the corner, as on nightly-880 (by hand, or the Test Farm) - Windows, AMD or Intel GPU: the counter at Breakdown, expecting the outlines and tabular digits as on NVIDIA (@Beanstalk) - The Insert menu open against nightly-880 in a window, by hand: expecting the counter under the banner on both ## Measurements **Verdict:** no change in frame rate measurable on this PC. The counter's script costs more only in the frames where it lays its texts out again, four a second: about 0.02 ms more at FPS, 0.05 at Graph, 0.1 at Dev; and 0.26 ms more in the frame after a counter setting changes. Its average frame is within 0.02 ms of main's. Setup: Windows 11, RTX 5080, driver 621.47, Ryzen 9 9900X3D. In the game: `dev.py ab` on one runtime (this PR's), side A the system mods with main's counter (`HOS_SYSTEM_MODS_DIR`), side B this PR's, the counter at Dev (`LONGSHOT_SET=system/fps-counter:fps_counter=5`), Hyrule Field, uncapped, 67% render, 60 s each, interleaved A1 B1 A2 B2 A3 B3. Other jobs shared the PC, and moved the rate by 25% between pairs. Baseline: main's counter (the system mod at 3a0f7d8f7: no commit since touches it) against this PR's counter, both on one runtime of this PR (`HOS_SYSTEM_MODS_DIR`), so only the counter differs. The runs were before the rebase onto 7bc53f841 (no file in common) and before the Dev grid's rows were measured rather than estimated. | | Before: main @ 3a0f7d8f7 | After: this PR @ 3b220702a | |---|---|---| | fps, pair 1 / 2 / 3 | 122.8 / 148.2 / 155.1 | 122.2 / 145.3 / 155.2 | | median frame, ms | 8.11 / 6.51 / 6.29 | 8.00 / 6.68 / 6.32 | | 1% low, fps | 97.9 / 99.8 / 108.8 | 74.5 / 98.1 / 109.4 | | counter script, worst frame (mod test, 5 interleaved runs, at f143e96f1) | 1.64 ms median | 1.90 ms median | | counter script, the four-a-second frames: FPS / Graph / Dev (fake game, p99 of 900 frames, 3 interleaved runs) | 0.16-0.21 / 0.41 / 0.76-0.94 ms | 0.18-0.19 / 0.45-0.49 / 0.88-1.09 ms | | counter script, Dev's four-a-second frames' mean (7 interleaved runs; this PR at 1cec5fe1b) | 0.67-0.72 ms | 0.76-0.85 ms | | counter script, mean frame: FPS / Dev | 0.009-0.012 / 0.20-0.25 ms | 0.010-0.011 / 0.20-0.27 ms | One run of this PR (B1) had a 1% low dip the other two did not repeat. The script worst frame is the fake game's budget test (Dev at Large, a level switched every 30 frames: the first frame of a view), on the same busy PC; main's own went over its 2 ms ceiling once there. Of the 0.26 ms, about half is the texts' new options (the outline's step and ring, the drop shadow, the font, tabular: 1.78 ms with them left out) and half the counter's own layout. The four-a-second frames are where it reads the numbers and lays the texts out again (`texts()`: `plan` and the head drawn again), with the graph's own frames between them as on main; the fake game's frames with the counter on for 15 s at each level, main's counter and this PR's side by side, at f143e96f1. 1cec5fe1b then keeps the Dev lines' widths while their values stay (0.84 to 0.81 ms at Dev); the rest is spread over the texts' options, the Dev lines measured as drawn and the head's ring, none more than about 0.03 ms of it alone. ## Risks - What players see changes back to before #2822: Small, Medium and Large keep their pixel size whatever the window (much smaller at 4K than on main), Auto follows the Menu size, the counter moves under the banner while the Insert menu is open. No setting or saved value changes; keys are the same. A revert is enough. - Mods: five API additions, each optional; a mod that uses none of them is unchanged (a Canvas text command without the new parts is as before). The counter now holds `settings.host` (to hear the menu open) and reads two of the Interface mod's settings. - The counter's script: about 0.1 ms more four times a second at Dev (less at the smaller levels), and about 0.3 ms in the frame after a setting changes (Measurements). ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
longshot/ui's screen() is the picture the UI last laid out: its width and height in pixels and
its pixels a virtual px (h / 1080, or w / 1920 on a picture narrower than 16:9), null before
the first present. Everything else in the UI is virtual px, which grow with the window; this is
for what keeps one size in pixels whatever the window (the FPS counter's Small, Medium and
Large, as the renderer drew them before the mod API).

The core keeps the size of its last present (game_ui::core::picture, set in Core::tick), the
main thread reads it (api::services::ui::screen_now, the UI native "screen"); the fake game's
is its target's. Docs: ui.md's Measuring, api-schema.md's natives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A style's font (inherited, as the other text properties) and d.text's and d.measure's: "ui",
the UI's own (Atkinson Hyperlegible Next, the default), or "game", the game's menu fonts read
from the player's own files, which the renderer already gives the UI (vk_ui.cpp tell_fonts):
those first, the one whose weight is nearest the text's first (its DemiBold for a bold text),
then the UI's; the UI's alone where the files have none. A mod picks one by name and never gets
the fonts themselves.

text::TextFont on TextStyle; Fonts keeps the host's families with their weights (Fonts::add)
and builds the family list of each text from it (stack_for). The main thread's Measurer has the
same fonts (text::host_font, from game_ui_font; Measurer::measure adds those it lacks), so
measure() measures a "game" text as it is drawn. A Canvas text command takes the font as an
optional 10th part ("ui", "game" or null), the fake game's canvas() shows it.

Tests: the host's fonts first, by weight, the UI's for the letters they lack; the measurer's;
a style's font parsed and inherited; a Canvas text's. Docs: ui.md, game/DESIGN.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
d.text's shadowWidth (the outline's step, virtual px, 0 to 16; left out: a 28th of the size, a
pixel at least, as before), shadowRing (eight copies round the text, the sides too, not the four
diagonals) and dropShadow { color, y } (a copy straight down, over the outline, under the
text). For a text drawn as a renderer's own overlay drew it: the FPS counter's number had its
outline all round, its other texts a soft outline with a darker copy a step down.

A Canvas text command takes them as optional 11th to 14th parts (shadowWidth, shadowRing,
dropColor, dropY: null or left out, as before); the fake game's canvas() shows them. Test: they
are parsed and checked. Docs: ui.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
d.text's and d.measure's size is 6 to 96 virtual px (was 8 to 96); UI itself lays text out from
6 (caps::TEXT_PX_MIN), and a style's fontSize already went that low. For what a renderer drew
in pixels whatever the window: the FPS counter's Small on a 4K screen had 12-pixel labels, 6
virtual px there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A style's fontVariantNumeric: "tabular" (inherited) and d.text's and d.measure's tabular: the
font's tabular figures (OpenType tnum, parley's font features), where it has them: a number that
changes does not shift sideways. For a counter's values, drawn four times a second: the FPS
counter drew each digit in a cell of its own before the mod API, a text a piece at a time,
which costs a Canvas text a digit.

text::TextStyle's tabular; a Canvas text command's 15th part (true, false, null or left out:
as before); the fake game's canvas() shows it. Tests: Atkinson's tabular digits one width, a
style's parsed and inherited, a Canvas text's. Docs: ui.md, game/DESIGN.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
At 1080p, 720p and 4K, for Auto (by the Menu size), Small, Medium and Large: the number's
size, the margin from the screen's edges and the font, the old counter's (d984fd704^
gpu/vk/vk_menu.cpp fps_scale, vk_ui.h unit; the game's menu font). Fails on main: the number
at 42 where the old counter drew it at 37.8 (1080p, Auto), the margin 16 for 27.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(fps-counter): the counter's sizes are the old counter's again, at every setting and screen
Some checks failed
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
3b220702af
Before the mod API (#2822) the renderer drew the counter (d984fd704^ gpu/vk/vk_menu.cpp
draw_fps): Auto at the menu's unit, the window's height and the Menu size (h / 720 x 0.78,
0.9 or 1.2); Small, Medium and Large at 1, 1.5 and 2 pixels a point whatever the window, at
most h / 720 x 1.3; 2.5% of the height from the edges (5% at the Large menu size); in the
game's menu font. Since, every size grew with the window (virtual px), Auto was Medium whatever
the Menu size, the margin was 16, and the texts were Atkinson's.

counter.ts oldSize is the old rule, through the picture's pixels (longshot/ui screen()) and the
Menu size (the Interface mod's menu_size, through mod.toml's reads); every text in the game's
menu font (font "game"), at the old sizes and raised to the old place (RISE); the column's
parts with the old room between them and the old height under them (the footer where it was,
a bottom corner's column as tall); the footer's last lines given up on a screen too short, as
before. Small on a 4K screen keeps its labels at 8 virtual px, the smallest a Canvas text is.

Keeps HumanBean's #3144 (the width estimate, "FPS" not cut off). Replaces #3071's Small of 1.3
(Veix) with the old fixed size, as the old counter's; #3071's menu scaling is not touched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11, RTX 5080, driver 621.47: this PR's runtime against nightly-880 (the counter as before the mod API), headless shots at 1080p, 1440p, 4K, 1920x1200 and 1280x800, every counter size and Menu size, the FPS and Breakdown levels, all four corners: the number's place and size within 1-3 px of the old counter. Also Japanese, no game font, a 480-line screen, the Insert menu open (full and compact) and a real window: as expected. Frame rate with the counter at Dev in Hyrule Field: no change measurable (3 interleaved pairs).

Tested in game: Windows 11, RTX 5080, driver 621.47: this PR's runtime against nightly-880 (the counter as before the mod API), headless shots at 1080p, 1440p, 4K, 1920x1200 and 1280x800, every counter size and Menu size, the FPS and Breakdown levels, all four corners: the number's place and size within 1-3 px of the old counter. Also Japanese, no game font, a 480-line screen, the Insert menu open (full and compact) and a real window: as expected. Frame rate with the counter at Dev in Hyrule Field: no change measurable (3 interleaved pairs).
Author
Member

The mod API additions in this PR, for the API's reviewers. Each is its own commit and optional: a mod that uses none of them works as before.

  1. screen(), the window's size in pixels (longshot/ui). The picture's width and height in pixels, and its pixels a virtual px (h / 1080, or w / 1920 narrower than 16:9); null before the first frame. Everything else in the UI is virtual px, which grow with the window; this is for what keeps one size in pixels whatever the window (the counter's Small, Medium and Large). The core keeps its last present's size (game_ui::core::picture), the main thread reads it (api::services::ui::screen_now, the UI native screen).

  2. A text's font: "ui" or "game" (a style's font, inherited; d.text and d.measure's font). "ui" is the default, Atkinson Hyperlegible Next. "game" puts the game's menu fonts first: the ones vk_ui.cpp tell_fonts already hands the UI from the player's own files, the one nearest the text's weight first (its DemiBold for a bold text), the UI's where the files have none. A mod picks by name and never gets the fonts. The main thread's measurer adds the same fonts (text::host_font), so measure() measures a "game" text as it is drawn. Code: text::TextFont, Fonts::stack_for.

  3. A Canvas text's outline (d.text): shadowWidth (the outline's step, virtual px; left out: a 28th of the size, as before), shadowRing (eight copies round the text, the sides too, not the four diagonals) and dropShadow: { color, y } (a copy straight down, over the outline, under the text). Left out, an outline is as before.

  4. Canvas text down to 6 virtual px (was 8): the engine's own least (caps::TEXT_PX_MIN); a style's fontSize already went that low. The counter's Small on a 4K screen had 12-pixel labels, 6 virtual px there.

  5. Tabular digits (a style's fontVariantNumeric: "tabular", inherited; d.text and d.measure's tabular: true): the font's tabular figures (OpenType tnum), every digit one width, so a number that changes does not shift sideways. The counter first drew each digit in a cell of its own, as the old counter did; that doubled its worst frame (a Canvas text a digit), and this costs nothing extra.

A Canvas text command takes the new parts as optional 10th to 15th items (font, shadowWidth, shadowRing, dropColor, dropY, tabular); a command without them is parsed as before, and the fake game's canvas() shows them for tests. Each has tests in game-ui (text, style, canvas). Docs: docs/modding/ui.md, game/DESIGN.md, docs/modding/api-schema.md.

The counter also uses two things the API already had: longshot/settings-host (its changed event, settings.host, a system mod's) to hear the Insert menu open and shut, and mod.toml's reads for the Interface mod's menu_size and compact_menu.

**The mod API additions in this PR**, for the API's reviewers. Each is its own commit and optional: a mod that uses none of them works as before. 1. **`screen()`, the window's size in pixels** (`longshot/ui`). The picture's width and height in pixels, and its pixels a virtual px (`h / 1080`, or `w / 1920` narrower than 16:9); null before the first frame. Everything else in the UI is virtual px, which grow with the window; this is for what keeps one size in pixels whatever the window (the counter's Small, Medium and Large). The core keeps its last present's size (`game_ui::core::picture`), the main thread reads it (`api::services::ui::screen_now`, the UI native `screen`). 2. **A text's font: `"ui"` or `"game"`** (a style's `font`, inherited; `d.text` and `d.measure`'s `font`). `"ui"` is the default, Atkinson Hyperlegible Next. `"game"` puts the game's menu fonts first: the ones `vk_ui.cpp` `tell_fonts` already hands the UI from the player's own files, the one nearest the text's weight first (its DemiBold for a bold text), the UI's where the files have none. A mod picks by name and never gets the fonts. The main thread's measurer adds the same fonts (`text::host_font`), so `measure()` measures a `"game"` text as it is drawn. Code: `text::TextFont`, `Fonts::stack_for`. 3. **A Canvas text's outline** (`d.text`): `shadowWidth` (the outline's step, virtual px; left out: a 28th of the size, as before), `shadowRing` (eight copies round the text, the sides too, not the four diagonals) and `dropShadow: { color, y }` (a copy straight down, over the outline, under the text). Left out, an outline is as before. 4. **Canvas text down to 6 virtual px** (was 8): the engine's own least (`caps::TEXT_PX_MIN`); a style's `fontSize` already went that low. The counter's Small on a 4K screen had 12-pixel labels, 6 virtual px there. 5. **Tabular digits** (a style's `fontVariantNumeric: "tabular"`, inherited; `d.text` and `d.measure`'s `tabular: true`): the font's tabular figures (OpenType `tnum`), every digit one width, so a number that changes does not shift sideways. The counter first drew each digit in a cell of its own, as the old counter did; that doubled its worst frame (a Canvas text a digit), and this costs nothing extra. A Canvas text command takes the new parts as optional 10th to 15th items (`font`, `shadowWidth`, `shadowRing`, `dropColor`, `dropY`, `tabular`); a command without them is parsed as before, and the fake game's `canvas()` shows them for tests. Each has tests in `game-ui` (text, style, canvas). Docs: `docs/modding/ui.md`, `game/DESIGN.md`, `docs/modding/api-schema.md`. The counter also uses two things the API already had: `longshot/settings-host` (its `changed` event, `settings.host`, a system mod's) to hear the Insert menu open and shut, and mod.toml's `reads` for the Interface mod's `menu_size` and `compact_menu`.
Author
Member

The full suite ran (Windows, --jobs 12): 846 passed, 13 failed. Twelve fail on clean main too, none reads a file this PR changes; test_recorder_parts failed only under the full run's load and passes alone on main and here. Named in Testing.

The full suite ran (Windows, --jobs 12): 846 passed, 13 failed. Twelve fail on clean main too, none reads a file this PR changes; test_recorder_parts failed only under the full run's load and passes alone on main and here. Named in Testing.
Author
Member

Measurements name their commits and baseline (main's counter against this PR's on one runtime). The screenshots box is out: the shots are made from the game, so they stay on my PC; Testing says what they showed.

Measurements name their commits and baseline (main's counter against this PR's on one runtime). The screenshots box is out: the shots are made from the game, so they stay on my PC; Testing says what they showed.
Author
Member

@Beanstalk the FPS counter's size on Linux and on an AMD or Intel GPU: turn Debug > FPS counter on at Breakdown, then try each FPS counter size (Auto, Small, Medium, Large) at 1080p and at 4K (or the biggest the screen has), and with the Insert menu open. Expected: Small, Medium and Large stay the same pixel size whatever the resolution (Small is small at 4K), Auto grows with the window and with Gameplay > Menu size, the numbers have a dark outline and do not shift sideways as they change, nothing is cut off at the top or the right, and while the menu is open the counter sits at the top right under the menu's banner showing only the FPS and the frame time.

@Beanstalk the FPS counter's size on Linux and on an AMD or Intel GPU: turn Debug > FPS counter on at Breakdown, then try each FPS counter size (Auto, Small, Medium, Large) at 1080p and at 4K (or the biggest the screen has), and with the Insert menu open. Expected: Small, Medium and Large stay the same pixel size whatever the resolution (Small is small at 4K), Auto grows with the window and with Gameplay > Menu size, the numbers have a dark outline and do not shift sideways as they change, nothing is cut off at the top or the right, and while the menu is open the counter sits at the top right under the menu's banner showing only the FPS and the frame time.
llun changed title from WIP: fix(fps-counter): the counter's sizes are the old counter's again, at every setting and screen to fix(fps-counter): the counter's sizes are the old counter's again, at every setting and screen 2026-12-05 09:55:40 +00:00
Author
Member

Screenshots: nightly-880 (the counter before the mod API) on the left, this PR on the right. Headless, the title screen, RTX 5080, Windows 11. Each picture's rows: Auto, Small, Medium, Large, then Auto with the Menu size Small and Large. The frame rates differ between shots only because of other jobs on the PC.

1080p, the FPS level and the Breakdown level:
1080p FPS
1080p Breakdown

1080p, the other three corners, and with the Insert menu open (this PR only: nightly-880 cannot open its menu headless):
1080p corners

1440p, 4K (Small stays small) and 1280x800 (the Steam Deck's size), the FPS level:
1440p FPS
4K FPS
1280x800 FPS

The Dev grid's rows paired as before, at 1080p:
Dev rows

A 1920x480 screen at Large: both give up the footer's last lines alike:
short screen

Menu language Japanese (the new counter translates every label, the old one only a few):
Japanese

The compact menu open, Medium and Large Menu size (this PR): the counter under the smaller banner:
compact menu

No game menu font (RX_VK_UI_GAME_FONT=0, right) against the game's (left), this PR: the same sizes in Atkinson:
no game font

**Screenshots: nightly-880 (the counter before the mod API) on the left, this PR on the right.** Headless, the title screen, RTX 5080, Windows 11. Each picture's rows: Auto, Small, Medium, Large, then Auto with the Menu size Small and Large. The frame rates differ between shots only because of other jobs on the PC. 1080p, the FPS level and the Breakdown level: ![1080p FPS](https://git.magicbean.dev/attachments/ec10b638-6a5a-4a02-a9d3-ef199ada36da) ![1080p Breakdown](https://git.magicbean.dev/attachments/cb7d397b-7919-4b94-9b6d-41595ccc0051) 1080p, the other three corners, and with the Insert menu open (this PR only: nightly-880 cannot open its menu headless): ![1080p corners](https://git.magicbean.dev/attachments/a5e2a673-df2e-4a7f-9e2c-bec30d8bd58c) 1440p, 4K (Small stays small) and 1280x800 (the Steam Deck's size), the FPS level: ![1440p FPS](https://git.magicbean.dev/attachments/3d241eda-8c28-4406-9085-633c398e600f) ![4K FPS](https://git.magicbean.dev/attachments/23f0ec34-dea9-43f3-a5e3-4372d5199b8f) ![1280x800 FPS](https://git.magicbean.dev/attachments/cba9b965-7db2-4d25-a80a-aedac76d9545) The Dev grid's rows paired as before, at 1080p: ![Dev rows](https://git.magicbean.dev/attachments/4c55c98e-09e3-466c-83c1-ab3be921beb8) A 1920x480 screen at Large: both give up the footer's last lines alike: ![short screen](https://git.magicbean.dev/attachments/b744faa2-c054-4214-9d10-5eb602b44cdd) Menu language Japanese (the new counter translates every label, the old one only a few): ![Japanese](https://git.magicbean.dev/attachments/c882f98e-91de-473d-92d2-fb983fbca581) The compact menu open, Medium and Large Menu size (this PR): the counter under the smaller banner: ![compact menu](https://git.magicbean.dev/attachments/7006554b-ce2b-45c6-9f89-26df32c5da61) No game menu font (`RX_VK_UI_GAME_FONT=0`, right) against the game's (left), this PR: the same sizes in Atkinson: ![no game font](https://git.magicbean.dev/attachments/1022b3ed-2977-494c-a93d-99dfc06cb2cd)
BeanBot left a comment

Recommendation: Approve. The counter’s fixed sizes cease to be fixed above 4K, and resizing with the Insert menu open leaves its banner offset based on the old window. The reported Windows comparison supports the fix at the tested resolutions, but the remaining platform runs are still needed. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Restores the counter’s old sizing, spacing, font and menu-open placement, and adds reusable UI text and screen APIs. The additions increase text rendering and measurement work; the reported frame-rate comparison is too noisy to quantify that cost.

Should fix (2): not blocking, but worth doing before merging.

  • L1 game/mods/fps-counter/src/counter.ts:211: The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. (more on the line) Do: Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test.
  • L2 game/mods/fps-counter/src/main.tsx:143: Refreshing the screen size does not recompute the open menu’s banner offset. (more on the line) Do: Recompute underBanner from the new screen and current compact-menu setting whenever the screen changes, and test resizing while the menu is open.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The changed counter and shared text path still need the platform and menu-open runs listed in the PR. When: Linux, Steam Deck and AMD hardware can exercise different font fallbacks and rendering paths; their counter appearance and the open-menu placement have not been reported. Do: Run the stated counter-size and open-menu checks on Linux, Steam Deck and AMD, and compare the open menu with the old counter in a real window.

@fix can do L1 and L2.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the tested Windows setup: the author reports the number’s position and size within 1–3 px of nightly-880 across the tested sizes and resolutions. The three frame-rate pairs do not establish a performance change: other work moved the rate by 25% between pairs, and the comparison used this PR’s runtime on both sides.

Other systems: The shared text APIs affect mod UI on both Windows and Linux, including font fallback and text measurement. The reported visual run covers Windows on NVIDIA; Linux, Steam Deck, AMD or Intel, and a real-window comparison of the open menu remain outstanding.

Switches: None added, changed or removed.

Reviewed: 3b220702af against 7bc53f8413: Read the repository rules, PR template, standards, description, comments, commit messages and the principal counter and UI API changes. Skimmed the remaining changed files and tests; the full diff output was truncated, so not every changed code file was read in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).

Checked and fine:

  • The reported Windows test covers the old counter’s sizes, corners, Japanese labels and font fallback.
  • The picture dimensions are published together through an atomic value.
  • The commits record AI assistance and the diff does not change third-party files.

Testing: No code or tests were run for this review. CI was still running; the author reports game-free tests and Windows game runs.

Overlaps and merge order: Not checked; the network was unavailable.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as llun took it out of WIP. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The counter’s fixed sizes cease to be fixed above 4K, and resizing with the Insert menu open leaves its banner offset based on the old window. The reported Windows comparison supports the fix at the tested resolutions, but the remaining platform runs are still needed. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Restores the counter’s old sizing, spacing, font and menu-open placement, and adds reusable UI text and screen APIs. The additions increase text rendering and measurement work; the reported frame-rate comparison is too noisy to quantify that cost. **Should fix (2)**: not blocking, but worth doing before merging. - **L1** `game/mods/fps-counter/src/counter.ts:211`: The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. (more on the line) **Do:** Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test. - **L2** `game/mods/fps-counter/src/main.tsx:143`: Refreshing the screen size does not recompute the open menu’s banner offset. (more on the line) **Do:** Recompute underBanner from the new screen and current compact-menu setting whenever the screen changes, and test resizing while the menu is open. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The changed counter and shared text path still need the platform and menu-open runs listed in the PR. *When:* Linux, Steam Deck and AMD hardware can exercise different font fallbacks and rendering paths; their counter appearance and the open-menu placement have not been reported. **Do:** Run the stated counter-size and open-menu checks on Linux, Steam Deck and AMD, and compare the open menu with the old counter in a real window. `@fix` can do L1 and L2. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the tested Windows setup: the author reports the number’s position and size within 1–3 px of nightly-880 across the tested sizes and resolutions. The three frame-rate pairs do not establish a performance change: other work moved the rate by 25% between pairs, and the comparison used this PR’s runtime on both sides. **Other systems:** The shared text APIs affect mod UI on both Windows and Linux, including font fallback and text measurement. The reported visual run covers Windows on NVIDIA; Linux, Steam Deck, AMD or Intel, and a real-window comparison of the open menu remain outstanding. **Switches:** None added, changed or removed. **Reviewed:** 3b220702afd0 against 7bc53f841323: Read the repository rules, PR template, standards, description, comments, commit messages and the principal counter and UI API changes. Skimmed the remaining changed files and tests; the full diff output was truncated, so not every changed code file was read in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review). **Checked and fine:** - The reported Windows test covers the old counter’s sizes, corners, Japanese labels and font fallback. - The picture dimensions are published together through an atomic value. - The commits record AI assistance and the diff does not change third-party files. **Testing:** No code or tests were run for this review. CI was still running; the author reports game-free tests and Windows game runs. **Overlaps and merge order:** Not checked; the network was unavailable. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as llun took it out of WIP. Nothing was run; a maintainer decides.</sub>
@ -59,0 +208,4 @@
return w;
}
/** A text's size, virtual px, for `pt` points at `t` (Plan's): within a Canvas text's 6 to 96. */
export const textPx = (pt: number, t: number): number => Math.min(96, Math.max(6, pt * t));
Member

L1 (should fix): The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens.

When: At 7680×4320, Small’s 12-point labels should be 12 physical pixels, or 3 virtual pixels at scale 4. This clamp draws them at 6 virtual pixels, or 24 physical pixels, while the surrounding layout remains sized for 12; text can also be clipped or overlap.

Do: Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test.

**L1** (should fix): The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. *When:* At 7680×4320, Small’s 12-point labels should be 12 physical pixels, or 3 virtual pixels at scale 4. This clamp draws them at 6 virtual pixels, or 24 physical pixels, while the surrounding layout remains sized for 12; text can also be clipped or overlap. **Do:** Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test.
@ -72,3 +140,4 @@
/** The texts read and drawn again (four times a second). */
function texts(): void {
kept.screen = screen() ?? SCREEN_1080; // (the window may have been resized: no event says so)
Member

L2 (should fix): Refreshing the screen size does not recompute the open menu’s banner offset.

When: Open the Insert menu with a fixed counter size, then resize the window: texts() updates kept.screen and recalculates the counter scale, but kept.under still contains the offset calculated for the former screen. The counter can sit at the wrong distance from, or overlap, the resized banner until the menu or a setting changes.

Do: Recompute underBanner from the new screen and current compact-menu setting whenever the screen changes, and test resizing while the menu is open.

**L2** (should fix): Refreshing the screen size does not recompute the open menu’s banner offset. *When:* Open the Insert menu with a fixed counter size, then resize the window: texts() updates kept.screen and recalculates the counter scale, but kept.under still contains the offset calculated for the former screen. The counter can sit at the wrong distance from, or overlap, the resized banner until the menu or a setting changes. **Do:** Recompute underBanner from the new screen and current compact-menu setting whenever the screen changes, and test resizing while the menu is open.
Author
Member

Screenshots are in (the comment above): Testing links them and the screenshots box is back, ticked.

Screenshots are in (the comment above): Testing links them and the screenshots box is back, ticked.
The counter's place under the Insert menu's banner was worked out when the menu opened, from
the window as it was then; a window resized while the menu stayed open kept the old offset
until the menu shut or a setting changed. texts() reads the picture four times a second: when
its size changed, the banner's offset is worked out again (underBanner, the compact menu as it
is now). Test: the menu open, the window resized to 1280x1024, the number under the new
banner (at 81.9 virtual px without this, 119 with it).

From BeanBot's review of #3238 (L2).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
d.text's and d.measure's size is 2 to 96 virtual px (was 6). A text a mod keeps one size in
pixels whatever the window (screen()) is smaller in virtual px the larger the window: the FPS
counter's Small has 12-pixel labels, 3 virtual px on a 7680x4320 screen, which 6 drew twice
their size. The layout clamps a text's size to 1 at the least as before.

From BeanBot's review of #3238 (L1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(fps-counter): Small keeps its pixel size on an 8K screen
Some checks failed
beanstalk/approval not approved yet
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
f43db67a84
The counter's texts are clamped to the Canvas's least size, now 2 virtual px (textPx), so
Small's 12- and 13-pixel texts are 3 and 3.25 virtual px at 7680x4320, as the old counter
drew them, not 6. Test: the sizes at 8K too, Small's "FPS" at 13 pixels.

From BeanBot's review of #3238 (L1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A style's fontSize is 6 at the least, and d.measure measured through a style: a text of 2 to 6
virtual px, which Canvas draws since the last commit, was refused there and measured at the
default size, about eight times as wide at 3 px. Below 6 it is measured at 6 and its size
scaled in proportion: the host measures at a virtual px a pixel, so a text's size grows with
its font size. No measure more than before.

Seen on the FPS counter's Small on a 7680x4320 screen: its digits spread across the line and
its legend's values over the names (#3238).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(fps-counter): Small's texts measured as drawn on an 8K screen
Some checks failed
beanstalk/approval not approved yet
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
f143e96f17
The Dev grid's widths (main.tsx runWidth) measured through a style too: under 6 virtual px they
are measured at 6 and scaled, as d.measure now does. Test: at Small, the frame time line at
7680x4320 is a quarter as wide in virtual px as at 1080p, the same in pixels (it was 250
virtual px for 15 before the measure's fix).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Pushed BeanBot's L1 and L2 (four commits) and the 8K measuring fix they showed; Testing, the checks and Measurements updated (the script cost measured again).

Pushed BeanBot's L1 and L2 (four commits) and the 8K measuring fix they showed; Testing, the checks and Measurements updated (the script cost measured again).
Author
Member

Thanks: both done, four commits on top.

L2 (resized with the menu open): 7784bd806. When the picture's size changes (texts() reads it four times a second), the place under the banner is worked out again from the new size and the compact menu as it is. The menu-open test now resizes the window to 1280x1024 with the menu open: the number's line was at 81.9 virtual px without the fix, 119 with it (under the new banner).

L1 (8K): 2159c7b6b lets Canvas text down to 2 virtual px (Small's 12-pixel labels are 3 at 7680x4320), and f43db67a8 has the counter use it, with 8K in the size test (Small's "FPS" at 13 pixels). In the game that first showed a second fault: d.measure measures through a style, whose fontSize is 6 at the least, so a 3-px text was measured at the default size, about eight times too wide (its digits spread across the line, its values over the names). 07afe0e03 measures a Canvas text under 6 at 6 and scales it (the host measures at a virtual px a pixel, so the size is in proportion; no extra measure), and f143e96f1 does the same for the counter's Dev grid, with a test: at Small, the frame time line at 8K is a quarter as wide in virtual px as at 1080p (it was 250 for 15). A 7680x4320 run of the game now lays Small out as at 1080p.

L3: the Test Farm request is above; the menu open against nightly-880 in a real window is in Still to test, by hand (the old build has no menu_key, and a synthetic Insert does not reach the game).

The script cost is in Measurements, measured again on f143e96f1: the worst frame 1.90 ms against main's 1.64 (5 interleaved runs, a busy PC; the frame after a level switch), half of it the texts' new options, half the counter's layout; the other frames as on main.

Thanks: both done, four commits on top. **L2** (resized with the menu open): 7784bd806. When the picture's size changes (`texts()` reads it four times a second), the place under the banner is worked out again from the new size and the compact menu as it is. The menu-open test now resizes the window to 1280x1024 with the menu open: the number's line was at 81.9 virtual px without the fix, 119 with it (under the new banner). **L1** (8K): 2159c7b6b lets Canvas text down to 2 virtual px (Small's 12-pixel labels are 3 at 7680x4320), and f43db67a8 has the counter use it, with 8K in the size test (Small's "FPS" at 13 pixels). In the game that first showed a second fault: `d.measure` measures through a style, whose `fontSize` is 6 at the least, so a 3-px text was measured at the default size, about eight times too wide (its digits spread across the line, its values over the names). 07afe0e03 measures a Canvas text under 6 at 6 and scales it (the host measures at a virtual px a pixel, so the size is in proportion; no extra measure), and f143e96f1 does the same for the counter's Dev grid, with a test: at Small, the frame time line at 8K is a quarter as wide in virtual px as at 1080p (it was 250 for 15). A 7680x4320 run of the game now lays Small out as at 1080p. **L3**: the Test Farm request is above; the menu open against nightly-880 in a real window is in Still to test, by hand (the old build has no `menu_key`, and a synthetic Insert does not reach the game). The script cost is in Measurements, measured again on f143e96f1: the worst frame 1.90 ms against main's 1.64 (5 interleaved runs, a busy PC; the frame after a level switch), half of it the texts' new options, half the counter's layout; the other frames as on main.
Author
Member

Measurements: the counter's four-a-second frames measured too (main's counter against this one, each level, fake game). They cost about 0.02 ms more at FPS, 0.05 at Graph and 0.2 at Dev, not only the frame after a setting change as the description said before; the average frame is within 0.02 ms of main's.

Measurements: the counter's four-a-second frames measured too (main's counter against this one, each level, fake game). They cost about 0.02 ms more at FPS, 0.05 at Graph and 0.2 at Dev, not only the frame after a setting change as the description said before; the average frame is within 0.02 ms of main's.
perf(fps-counter): the Dev lines' widths kept while their values stay
Some checks failed
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
1cec5fe1b5
The counter lays its texts out again four times a second. At Dev each line's
width was worked out again from its pieces every time, though most values do
not change between readings: a line's width is now kept by its name, value and
size. The soft outline's colours are kept by the text's colour alone (no key
built for each text), and a text's digit width is looked up once per text.
Nothing drawn changes.

The fake game's frames at Dev, the update frames' mean: about 0.70 ms main,
0.84 before, 0.81 now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

1cec5fe1b trims the counter's four-a-second update at Dev: each Dev line's width is kept while its value stays the same, and the outline colours and digit widths are looked up more cheaply. Nothing drawn changes (22 mod tests pass; a Dev shot in the game matches). The update frames at Dev: 0.70 ms on main, 0.84 before, 0.81 now (fake game, interleaved). The rest of the extra is spread thin across the parts, none more than about 0.03 ms on its own.

1cec5fe1b trims the counter's four-a-second update at Dev: each Dev line's width is kept while its value stays the same, and the outline colours and digit widths are looked up more cheaply. Nothing drawn changes (22 mod tests pass; a Dev shot in the game matches). The update frames at Dev: 0.70 ms on main, 0.84 before, 0.81 now (fake game, interleaved). The rest of the extra is spread thin across the parts, none more than about 0.03 ms on its own.
Author
Member
@review
BeanBot left a comment

Recommendation: Approve. The reported Windows runs show the restored counter sizes, including at 8K. The fixed-size text still grows on sufficiently large screens, and the listed platform and menu-open runs remain outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Restores the old FPS counter’s sizing, placement, font treatment and menu-open behavior, with optional additions to the mod UI API. It improves the counter’s consistency at a measured script cost of about 0.1 ms on Dev update frames four times a second.

Should fix (1): not blocking, but worth doing before merging.

  • L1 game/mods/fps-counter/src/counter.ts:211: The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. When: At 7680×4320, Small’s 12-point labels should be 12 physical pixels, or 3 virtual pixels at scale 4. This clamp draws them at 6 virtual pixels, or 24 physical pixels, while the surrounding layout remains sized for 12; text can also be clipped or overlap. Do: Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The changed counter and shared text path still need the platform and menu-open runs listed in the PR. When: Linux, Steam Deck and AMD hardware can exercise different font fallbacks and rendering paths; their counter appearance and the open-menu placement have not been reported. Do: Run the stated counter-size and open-menu checks on Linux, Steam Deck and AMD, and compare the open menu with the old counter in a real window.

@fix can do L1.

Since the last review (on 3b220702af)
Resolved: L2 (Refreshing the screen size does not recompute the open menu’s banner offset.)
Still open: L1 (The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently lar…); L3 (The changed counter and shared text path still need the platform and menu-open runs listed…)

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the reported Windows cases: the author reports matching the old counter within 1–3 pixels at tested sizes, plus an 8K run. The minimum text size still prevents fixed pixel sizes at larger resolutions.

Other systems: The shared Canvas text and font paths also affect mods and Linux. Windows NVIDIA rendering was reported tested; Linux, Steam Deck, AMD or Intel, and comparison with the old menu-open behavior in a real window remain untested.

Switches: No switches added, changed or removed.

Reviewed: 1cec5fe1b5 against 7bc53f8413: Read the repository rules and pull request template, the changes since the ledger, and the counter code around sizing, measuring and menu placement. Skimmed the earlier shared text and runtime diff, tests, reported runs and comments; did not read every changed code file in full.; nothing run (a code review).

Checked and fine:

  • The small-text measurement paths scale measurements made at six virtual pixels for the 8K case.
  • The menu-open resize test checks the new banner offset and right edge.

Testing: No commands that build or run the project were executed. The author reports game-free tests and Windows game runs; CI is still running.

Overlaps and merge order: Not checked; network access is unavailable.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The reported Windows runs show the restored counter sizes, including at 8K. The fixed-size text still grows on sufficiently large screens, and the listed platform and menu-open runs remain outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Restores the old FPS counter’s sizing, placement, font treatment and menu-open behavior, with optional additions to the mod UI API. It improves the counter’s consistency at a measured script cost of about 0.1 ms on Dev update frames four times a second. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `game/mods/fps-counter/src/counter.ts:211`: The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. *When:* At 7680×4320, Small’s 12-point labels should be 12 physical pixels, or 3 virtual pixels at scale 4. This clamp draws them at 6 virtual pixels, or 24 physical pixels, while the surrounding layout remains sized for 12; text can also be clipped or overlap. **Do:** Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The changed counter and shared text path still need the platform and menu-open runs listed in the PR. *When:* Linux, Steam Deck and AMD hardware can exercise different font fallbacks and rendering paths; their counter appearance and the open-menu placement have not been reported. **Do:** Run the stated counter-size and open-menu checks on Linux, Steam Deck and AMD, and compare the open menu with the old counter in a real window. `@fix` can do L1. **Since the last review** (on 3b220702afd0) Resolved: L2 (Refreshing the screen size does not recompute the open menu’s banner offset.) Still open: L1 (The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently lar…); L3 (The changed counter and shared text path still need the platform and menu-open runs listed…) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported Windows cases: the author reports matching the old counter within 1–3 pixels at tested sizes, plus an 8K run. The minimum text size still prevents fixed pixel sizes at larger resolutions. **Other systems:** The shared Canvas text and font paths also affect mods and Linux. Windows NVIDIA rendering was reported tested; Linux, Steam Deck, AMD or Intel, and comparison with the old menu-open behavior in a real window remain untested. **Switches:** No switches added, changed or removed. **Reviewed:** 1cec5fe1b58c against 7bc53f841323: Read the repository rules and pull request template, the changes since the ledger, and the counter code around sizing, measuring and menu placement. Skimmed the earlier shared text and runtime diff, tests, reported runs and comments; did not read every changed code file in full.; nothing run (a code review). **Checked and fine:** - The small-text measurement paths scale measurements made at six virtual pixels for the 8K case. - The menu-open resize test checks the new banner offset and right edge. **Testing:** No commands that build or run the project were executed. The author reports game-free tests and Windows game runs; CI is still running. **Overlaps and merge order:** Not checked; network access is unavailable. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
Author
Member

L1 is already fixed at 1cec5fe1b; nothing at 6 is left on the drawing side:

  • counter.ts:213 textPx clamps to 2..96 (not 6): Small's 12-point labels at 7680x4320 are 3 virtual px.
  • canvas.rs:503 takes a Canvas text's size from 2 (2159c7b6b), and runtime.js textSize accepts 2..96.
  • The only 6 left is measuring (runtime.js:2490 d.measure, and the counter's runWidth): a text under 6 is measured at 6 and scaled down, because a style's fontSize starts at 6. The width comes out for the size drawn (07afe0e03, f143e96f1), as the review's own "Checked and fine" says.
  • The 8K tests: "the old counter's size at 720p, 4K and 8K" (Small's "FPS" 13 pixels at 8K) and "Small at 8K: its frame time line a quarter as wide in virtual px as at 1080p, the same in pixels". The in-game 7680x4320 run at Small lays out as at 1080p.

L3: the Linux, Steam Deck and AMD/Intel runs need a BigBean's @Beanstalk. The menu-open comparison against nightly-880 in a real window is still in Still to test.

**L1** is already fixed at 1cec5fe1b; nothing at 6 is left on the drawing side: - `counter.ts:213` `textPx` clamps to 2..96 (not 6): Small's 12-point labels at 7680x4320 are 3 virtual px. - `canvas.rs:503` takes a Canvas text's size from 2 (2159c7b6b), and `runtime.js` `textSize` accepts 2..96. - The only 6 left is measuring (`runtime.js:2490` `d.measure`, and the counter's `runWidth`): a text under 6 is measured at 6 and scaled down, because a style's `fontSize` starts at 6. The width comes out for the size drawn (07afe0e03, f143e96f1), as the review's own "Checked and fine" says. - The 8K tests: "the old counter's size at 720p, 4K and 8K" (Small's "FPS" 13 pixels at 8K) and "Small at 8K: its frame time line a quarter as wide in virtual px as at 1080p, the same in pixels". The in-game 7680x4320 run at Small lays out as at 1080p. **L3**: the Linux, Steam Deck and AMD/Intel runs need a BigBean's `@Beanstalk`. The menu-open comparison against nightly-880 in a real window is still in Still to test.
Member

Beanstalk test farm

Commit 82fb4b9 · approved by nobody yet · dashboard

A member of BigBeans can review this commit and comment @Beanstalk to test it.

<!-- beanstalk:sticky --> ### Beanstalk test farm Commit `82fb4b9` · approved by nobody yet · [dashboard](https://beanstalk.magicbean.dev/prs/3238) A member of `BigBeans` can review this commit and comment `@Beanstalk` to test it.
Author
Member
@review
BeanBot left a comment

Recommendation: Approve. The counter restores the old sizing through the tested 8K case, but the requested platform and menu-open comparisons remain outstanding. At still larger resolutions, the minimum text size can make fixed-size labels grow. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Restores the counter’s former sizing, placement and appearance and adds optional mod UI APIs. It adds some script work to counter updates.

Should fix (1): not blocking, but worth doing before merging.

  • L1 game/mods/fps-counter/src/counter.ts:211: The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. When: At 7680×4320, Small’s 12-point labels should be 12 physical pixels, or 3 virtual pixels at scale 4. This clamp draws them at 6 virtual pixels, or 24 physical pixels, while the surrounding layout remains sized for 12; text can also be clipped or overlap. Do: Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The changed counter and shared text path still need the platform and menu-open runs listed in the PR. When: Linux, Steam Deck and AMD hardware can exercise different font fallbacks and rendering paths; their counter appearance and the open-menu placement have not been reported. Do: Run the stated counter-size and open-menu checks on Linux, Steam Deck and AMD, and compare the open menu with the old counter in a real window.

@fix can do L1.

Since the last review (on 1cec5fe1b5)
Still open: L1 (The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently lar…); L3 (The changed counter and shared text path still need the platform and menu-open runs listed…)

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes: the author reports sizes and positions within 1–3 pixels of the old counter across the tested Windows resolutions. The reported Dev update frames cost about 0.1 ms more four times a second; average frame time was within 0.02 ms of main.

Other systems: The shared text and Canvas APIs can affect mods and rendering across operating systems and GPUs. Windows NVIDIA was tested; Linux, Steam Deck and Windows AMD or Intel runs remain outstanding.

Switches: No switches added, changed or removed.

Reviewed: 1cec5fe1b5 against 7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the PR template, commit list, ledger, comments and reported CI. Inspected the counter sizing and menu-resize diff, Canvas text limits, runtime measurement and relevant tests; the remaining changed files and full diff were not read in full. docs/review-checklist.md is absent.; nothing run (a code review).

Checked and fine:

  • At 8K, the counter and Canvas accept the three-virtual-pixel Small label; measurements below six are scaled from a six-pixel measurement.
  • The menu-open position is recalculated when the picture size changes.

Testing: No code or tests were run. The author reports Windows NVIDIA game and headless comparisons and game-free tests; CI is still running.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The counter restores the old sizing through the tested 8K case, but the requested platform and menu-open comparisons remain outstanding. At still larger resolutions, the minimum text size can make fixed-size labels grow. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Restores the counter’s former sizing, placement and appearance and adds optional mod UI APIs. It adds some script work to counter updates. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `game/mods/fps-counter/src/counter.ts:211`: The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. *When:* At 7680×4320, Small’s 12-point labels should be 12 physical pixels, or 3 virtual pixels at scale 4. This clamp draws them at 6 virtual pixels, or 24 physical pixels, while the surrounding layout remains sized for 12; text can also be clipped or overlap. **Do:** Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The changed counter and shared text path still need the platform and menu-open runs listed in the PR. *When:* Linux, Steam Deck and AMD hardware can exercise different font fallbacks and rendering paths; their counter appearance and the open-menu placement have not been reported. **Do:** Run the stated counter-size and open-menu checks on Linux, Steam Deck and AMD, and compare the open menu with the old counter in a real window. `@fix` can do L1. **Since the last review** (on 1cec5fe1b58c) Still open: L1 (The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently lar…); L3 (The changed counter and shared text path still need the platform and menu-open runs listed…) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the author reports sizes and positions within 1–3 pixels of the old counter across the tested Windows resolutions. The reported Dev update frames cost about 0.1 ms more four times a second; average frame time was within 0.02 ms of main. **Other systems:** The shared text and Canvas APIs can affect mods and rendering across operating systems and GPUs. Windows NVIDIA was tested; Linux, Steam Deck and Windows AMD or Intel runs remain outstanding. **Switches:** No switches added, changed or removed. **Reviewed:** 1cec5fe1b58c against 7bc53f841323: Read AGENTS.md, CONTRIBUTING.md, the PR template, commit list, ledger, comments and reported CI. Inspected the counter sizing and menu-resize diff, Canvas text limits, runtime measurement and relevant tests; the remaining changed files and full diff were not read in full. docs/review-checklist.md is absent.; nothing run (a code review). **Checked and fine:** - At 8K, the counter and Canvas accept the three-virtual-pixel Small label; measurements below six are scaled from a six-pixel measurement. - The menu-open position is recalculated when the picture size changes. **Testing:** No code or tests were run. The author reports Windows NVIDIA game and headless comparisons and game-free tests; CI is still running. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
Author
Member

L1, beyond 8K: kept as is, on purpose.

Small's 12-pixel labels are 12 / (height / 1080) virtual px: 6 at 4K, 3 at 8K, both drawn at their size. The Canvas floor is 2 (not 6 any more), so a label is drawn larger than 12 pixels only on a picture over 6480 lines high, past 8K (at 16K: 16 pixels, not 12). Lowering the floor further would change the mod API's limit for every mod, for a screen no player has, and would only move the edge (1 reaches 12960 lines). The 8K case is covered by the two 8K tests and the in-game 7680x4320 run.

**L1**, beyond 8K: kept as is, on purpose. Small's 12-pixel labels are 12 / (height / 1080) virtual px: 6 at 4K, 3 at 8K, both drawn at their size. The Canvas floor is 2 (not 6 any more), so a label is drawn larger than 12 pixels only on a picture over 6480 lines high, past 8K (at 16K: 16 pixels, not 12). Lowering the floor further would change the mod API's limit for every mod, for a screen no player has, and would only move the edge (1 reaches 12960 lines). The 8K case is covered by the two 8K tests and the in-game 7680x4320 run.
Owner
@rebase
Member

I rebased this pull request onto main (fec5798ecb): the new head is 82fb4b9d60.

Conflicts resolved

  • game/mods/fps-counter/src/main.tsx: Recomputes the banner offset after refreshing screen dimensions while the menu is open.
  • Also changed, beyond the conflict: game/mods/fps-counter/src/main.tsx
  • game/mods/fps-counter/src/main.tsx: Kept the base branch’s recalculation on each text update, which also handles resizing while the menu is open.

Nothing was built or run: read the resolution before merging.


Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

I rebased this pull request onto `main` (fec5798ecba4): the new head is 82fb4b9d603a. **Conflicts resolved** - game/mods/fps-counter/src/main.tsx: Recomputes the banner offset after refreshing screen dimensions while the menu is open. - Also changed, beyond the conflict: `game/mods/fps-counter/src/main.tsx` - game/mods/fps-counter/src/main.tsx: Kept the base branch’s recalculation on each text update, which also handles resizing while the menu is open. Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed fix/fps-counter-old-sizes from 1cec5fe1b5
Some checks failed
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 82fb4b9d60
Some checks failed
beanstalk/approval not approved yet
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Successful in 9s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 17s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m28s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 14m37s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 10m42s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 10m0s
CI / Website build and checks (pull_request) Failing after 42s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 48m40s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
2026-12-05 17:09:02 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The counter’s restored sizes are shown working through 8K on Windows NVIDIA, but the remaining platform and real-window menu comparison runs have not been reported. The fixed-size text still grows at 16K, a minor limitation of the current minimum. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Restores the old counter’s sizing, placement, font treatment and menu-open layout, while adding reusable optional UI APIs. The extra layout work costs about 0.1 ms on four Dev update frames per second in the reported measurements.

Should fix (1): not blocking, but worth doing before merging.

  • L1 game/mods/fps-counter/src/counter.ts:211: The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. When: At 7680×4320, Small’s 12-point labels should be 12 physical pixels, or 3 virtual pixels at scale 4. This clamp draws them at 6 virtual pixels, or 24 physical pixels, while the surrounding layout remains sized for 12; text can also be clipped or overlap. Do: Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The changed counter and shared text path still need the platform and menu-open runs listed in the PR. When: Linux, Steam Deck and AMD hardware can exercise different font fallbacks and rendering paths; their counter appearance and the open-menu placement have not been reported. Do: Run the stated counter-size and open-menu checks on Linux, Steam Deck and AMD, and compare the open menu with the old counter in a real window.

@fix can do L1.

Since the last review (on 1cec5fe1b5)
Still open: L1 (The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently lar…); L3 (The changed counter and shared text path still need the platform and menu-open runs listed…)

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the tested configurations: the author reports positions and sizes within 1–3 pixels of the old counter across 1080p–4K and other resolutions, plus correct Small layout at 8K. The reported frame-rate comparison found no measurable change on the tested PC; other platform runs remain outstanding.

Other systems: The shared text and Canvas APIs can affect mods and rendering across platforms. Windows NVIDIA was tested; Linux, Steam Deck and Windows AMD or Intel results remain outstanding.

Switches: No switches added, changed or removed.

Reviewed: 82fb4b9d60 against fec5798ecb: Read AGENTS.md, CONTRIBUTING.md and main.tsx; inspected counter.ts, the Canvas size limit, the main.tsx diff and commit list. The remaining changed files and full repository review rules were not read in full.; nothing run (a code review).

Checked and fine:

  • The changed lines refresh the screen size and recalculate the banner position while the menu is open.
  • The reported 8K fix accepts 3-virtual-pixel Canvas text and measures smaller text by scaling a measurement at 6.

Testing: No commands that build or run project code were executed. The author reports Windows NVIDIA game and game-free tests; CI is still running.

Overlaps and merge order: none found


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The counter’s restored sizes are shown working through 8K on Windows NVIDIA, but the remaining platform and real-window menu comparison runs have not been reported. The fixed-size text still grows at 16K, a minor limitation of the current minimum. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Restores the old counter’s sizing, placement, font treatment and menu-open layout, while adding reusable optional UI APIs. The extra layout work costs about 0.1 ms on four Dev update frames per second in the reported measurements. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `game/mods/fps-counter/src/counter.ts:211`: The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently large screens. *When:* At 7680×4320, Small’s 12-point labels should be 12 physical pixels, or 3 virtual pixels at scale 4. This clamp draws them at 6 virtual pixels, or 24 physical pixels, while the surrounding layout remains sized for 12; text can also be clipped or overlap. **Do:** Allow the counter’s required smaller virtual text sizes through the Canvas API and add an 8K fixed-size layout test. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The changed counter and shared text path still need the platform and menu-open runs listed in the PR. *When:* Linux, Steam Deck and AMD hardware can exercise different font fallbacks and rendering paths; their counter appearance and the open-menu placement have not been reported. **Do:** Run the stated counter-size and open-menu checks on Linux, Steam Deck and AMD, and compare the open menu with the old counter in a real window. `@fix` can do L1. **Since the last review** (on 1cec5fe1b58c) Still open: L1 (The six-virtual-pixel minimum makes fixed-size counter text grow again on sufficiently lar…); L3 (The changed counter and shared text path still need the platform and menu-open runs listed…) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the tested configurations: the author reports positions and sizes within 1–3 pixels of the old counter across 1080p–4K and other resolutions, plus correct Small layout at 8K. The reported frame-rate comparison found no measurable change on the tested PC; other platform runs remain outstanding. **Other systems:** The shared text and Canvas APIs can affect mods and rendering across platforms. Windows NVIDIA was tested; Linux, Steam Deck and Windows AMD or Intel results remain outstanding. **Switches:** No switches added, changed or removed. **Reviewed:** 82fb4b9d603a against fec5798ecba4: Read AGENTS.md, CONTRIBUTING.md and main.tsx; inspected counter.ts, the Canvas size limit, the main.tsx diff and commit list. The remaining changed files and full repository review rules were not read in full.; nothing run (a code review). **Checked and fine:** - The changed lines refresh the screen size and recalculate the banner position while the menu is open. - The reported 8K fix accepts 3-virtual-pixel Canvas text and measures smaller text by scaling a measurement at 6. **Testing:** No commands that build or run project code were executed. The author reports Windows NVIDIA game and game-free tests; CI is still running. **Overlaps and merge order:** none found </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch fix/fps-counter-old-sizes 2026-12-05 17:10:01 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3238
No description provided.