[PR #305] [MERGED] Debug charts: F3+2 frame and tick times, F3+3 ping and bandwidth #2474

Closed
opened 2026-11-02 15:56:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/305
Author: @ludovic111
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @ludovic111

Base: main ← Head: feat/debug-charts


📝 Commits (1)

  • 6ae0180 Debug charts: F3+2 frame and tick times, F3+3 ping and bandwidth

📊 Changes

6 files changed (+649 additions, -5 deletions)

View changed files

➕ crates/horizon-client/src/debug_chart.rs (+536 -0)
📝 crates/horizon-client/src/game.rs (+19 -1)
📝 crates/horizon-client/src/game/debug_keys.rs (+83 -4)
📝 crates/horizon-client/src/game/remote.rs (+6 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+4 -0)

📄 Description

What

F3+2 and F3+3 now show vanilla 26.3's debug charts (they were swallowed with no effect):

  • F3+2: FpsDebugChart bottom left (frame times; 30/60 fps guide lines; a cyan line at the frame rate limit when it is 250 or below) and, in single player, TpsDebugChart bottom right (the integrated server's ticks: full tick, tick method in dark red, idle left out of min/avg/max; "20.0 tps" label from the tick rate).
  • F3+3: PingDebugChart bottom right (500 ms scale) and, on a remote server, BandwidthDebugChart bottom left (logarithmic scale, 1 MiB/s at the top, 64 B/s / 1 KiB/s / 16 KiB/s guide lines).
  • The overlay gets vanilla's three lines: Debug charts: [F3+1] Profiler hidden; [F3+2] fps + tps visible; / [F3+3] Ping …; [F3+4] Lightmap … / To edit: press [F3+F6] (key names follow rebinds; "fps" / "Bandwidth + Ping" on servers).

Matches AbstractDebugChart exactly: 240 samples (LocalSampleLogger), 60 px boxes, min(242, guiWidth / 2) wide, the 0x90505050 backdrop, white frame, 0xFFE0E0E0 labels, min/avg/max line above, green → yellow → red per bar with ARGB.srgbLerp, and unclamped bars (spikes go above the box as in vanilla). The toggles follow toggleFpsCharts / toggleNetworkCharts: a toggle shows the overlay if hidden and switches the other chart off.

Where the samples come from:

  • frame times: every rendered frame (Minecraft.logFrameDuration);
  • tick times: each single-player tick (MinecraftServer.logFullTickTime / logTickMethodTime); Horizon has no separate task queue, so the scheduled-tasks part is 0;
  • ping: on a server, a play-state ping_request each tick while the chart shows and the pong_response round trip (PingDebugMonitor); both packets are added to horizon-protocol with round-trip tests. In single player the in-process server answers within the tick, so it logs 0 ms (vanilla's local connection logs ~0 too);
  • bandwidth: the connection's received bytes per tick (BandwidthDebugMonitor; Horizon's byte counter counts the same frame + varint bytes).

Charts reset on leaving a world (DebugScreenOverlay.reset).

Part of #258 (F3+2, F3+3; F3+F4 already works since #266; vanilla 26.3 has no F3+Q help list: the debug.help.* strings are unused leftovers). Part of #159 (the charts).

Screenshots (Mac mini, offscreen 1280x720, GUI scale 3, fast build)

  • F3+2: ~/code/horizon-parity/shots/f3-debug-charts/fps.png: frame chart 213 px wide at x 0, TPS chart at x 213 (426 - 213), both bottom-aligned, labels and guide lines in vanilla's places.
  • F3+3: ~/code/horizon-parity/shots/f3-debug-charts/network.png: single player, so ping only, bottom right.

How tested

cargo fmt --all --check                                   ok
cargo clippy -p horizon-client -p horizon-protocol --all-targets -- -D warnings   ok
cargo test -p horizon-protocol                            45 passed (ping_request / pong_response round trips)
cargo test -p horizon-client --lib -- debug_chart debug_keys   17 passed
python3 tools/parity.py hud toggle_keys screen_layout     3 passed (run on the stack top: charts + lightmap)

parity.py --changed origin/main selects 79 harnesses (game.rs is an input of most); on the busy Mac mini I ran the three covering the HUD, debug keys and screen layout.

Needs Ludovic

  • Bandwidth chart only appears on a remote server; not screenshotted (no server run here). Unit tests cover its scale and labels.
  • Horizon's F3 text (and now the charts) is drawn before chat; vanilla draws the debug overlay last, above chat. Left for the overlay rework.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/305 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/debug-charts` --- ### 📝 Commits (1) - [`6ae0180`](https://github.com/horizon-rust/horizon/commit/6ae018055da280b7d7b7b3cb5643fecbca2c7ddb) Debug charts: F3+2 frame and tick times, F3+3 ping and bandwidth ### 📊 Changes **6 files changed** (+649 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/src/debug_chart.rs` (+536 -0) 📝 `crates/horizon-client/src/game.rs` (+19 -1) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+83 -4) 📝 `crates/horizon-client/src/game/remote.rs` (+6 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+4 -0) </details> ### 📄 Description ## What F3+2 and F3+3 now show vanilla 26.3's debug charts (they were swallowed with no effect): - **F3+2**: `FpsDebugChart` bottom left (frame times; 30/60 fps guide lines; a cyan line at the frame rate limit when it is 250 or below) and, in single player, `TpsDebugChart` bottom right (the integrated server's ticks: full tick, tick method in dark red, idle left out of min/avg/max; "20.0 tps" label from the tick rate). - **F3+3**: `PingDebugChart` bottom right (500 ms scale) and, on a remote server, `BandwidthDebugChart` bottom left (logarithmic scale, 1 MiB/s at the top, 64 B/s / 1 KiB/s / 16 KiB/s guide lines). - The overlay gets vanilla's three lines: `Debug charts: [F3+1] Profiler hidden; [F3+2] fps + tps visible;` / `[F3+3] Ping …; [F3+4] Lightmap …` / `To edit: press [F3+F6]` (key names follow rebinds; "fps" / "Bandwidth + Ping" on servers). Matches `AbstractDebugChart` exactly: 240 samples (`LocalSampleLogger`), 60 px boxes, `min(242, guiWidth / 2)` wide, the `0x90505050` backdrop, white frame, `0xFFE0E0E0` labels, min/avg/max line above, green → yellow → red per bar with `ARGB.srgbLerp`, and unclamped bars (spikes go above the box as in vanilla). The toggles follow `toggleFpsCharts` / `toggleNetworkCharts`: a toggle shows the overlay if hidden and switches the other chart off. Where the samples come from: - frame times: every rendered frame (`Minecraft.logFrameDuration`); - tick times: each single-player tick (`MinecraftServer.logFullTickTime` / `logTickMethodTime`); Horizon has no separate task queue, so the scheduled-tasks part is 0; - ping: on a server, a play-state `ping_request` each tick while the chart shows and the `pong_response` round trip (`PingDebugMonitor`); both packets are added to horizon-protocol with round-trip tests. In single player the in-process server answers within the tick, so it logs 0 ms (vanilla's local connection logs ~0 too); - bandwidth: the connection's received bytes per tick (`BandwidthDebugMonitor`; Horizon's byte counter counts the same frame + varint bytes). Charts reset on leaving a world (`DebugScreenOverlay.reset`). Part of #258 (F3+2, F3+3; F3+F4 already works since #266; vanilla 26.3 has no F3+Q help list: the `debug.help.*` strings are unused leftovers). Part of #159 (the charts). ## Screenshots (Mac mini, offscreen 1280x720, GUI scale 3, `fast` build) - F3+2: `~/code/horizon-parity/shots/f3-debug-charts/fps.png`: frame chart 213 px wide at x 0, TPS chart at x 213 (426 - 213), both bottom-aligned, labels and guide lines in vanilla's places. - F3+3: `~/code/horizon-parity/shots/f3-debug-charts/network.png`: single player, so ping only, bottom right. ## How tested ``` cargo fmt --all --check ok cargo clippy -p horizon-client -p horizon-protocol --all-targets -- -D warnings ok cargo test -p horizon-protocol 45 passed (ping_request / pong_response round trips) cargo test -p horizon-client --lib -- debug_chart debug_keys 17 passed python3 tools/parity.py hud toggle_keys screen_layout 3 passed (run on the stack top: charts + lightmap) ``` `parity.py --changed origin/main` selects 79 harnesses (game.rs is an input of most); on the busy Mac mini I ran the three covering the HUD, debug keys and screen layout. ## Needs Ludovic - Bandwidth chart only appears on a remote server; not screenshotted (no server run here). Unit tests cover its scale and labels. - Horizon's F3 text (and now the charts) is drawn before chat; vanilla draws the debug overlay last, above chat. Left for the overlay rework. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56:28 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
horizon-rust/horizon#2474
No description provided.