[PR #1462] [MERGED] In-frame single player slows down instead of dropping to 2 FPS when its ticks overrun #3539

Closed
opened 2026-11-03 04:10:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/amd-regress-1


📝 Commits (2)

  • 5526445 In-frame ticks stop at a tick's length per frame: an overloaded world slows down instead of drawing at 2 FPS
  • d3de3cd Merge remote-tracking branch 'origin/main' into fix/amd-regress-1

📊 Changes

2 files changed (+84 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/clock.rs (+72 -0)
📝 crates/horizon-client/src/game.rs (+12 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

Single player's world ticks in the frame by default (#1428). A frame now stops running world ticks once the ones it ran took one tick's length (50 ms at 20 TPS). It drops the rest and logs vanilla's overload warning: Can't keep up! Is the server overloaded? Running Nms or N ticks behind, with MinecraftServer.runServer's threshold (1 s + 20 ticks behind) and interval (10 s + 100 ticks).

  • Ticks of a few milliseconds keep the client timer's full ten per frame, so nothing changes while the world keeps up.
  • /tick sprint, --server-thread and server clients are unchanged: the budget applies only where remote is None, i.e. the in-frame world.

Two files: clock.rs (FixedStep::tick_fits, FixedStep::drop_ticks, two unit tests) and the frame loop in game.rs.

Why

A contributor reported 2 FPS on an AMD Radeon 680M (RADV) on today's build. His F3 showed Integrated server @ 36.7/50.0 ms, 0 tx, 0 rx, i.e. the in-frame world. With the world in the frame, any tick slower than its 50 ms puts every frame behind. Each frame then ran the timer's maximum of ten ticks: about 10 × 57 ms, so 575 ms frames. Vanilla runs that world on the integrated server's thread. There a slow tick only makes the server fall behind and say so, and the frames keep drawing.

Why "one tick's length" rather than a fixed count: a fixed cap of N either limits light worlds on slow GPUs (at 10 FPS a frame needs 2 ticks to keep 20 TPS) or still allows N × a slow tick per frame. A time budget leaves light ticks alone. A world that can't keep up then gets one tick per frame, so frame time is about one tick plus the render. The world runs slower instead of the picture stopping.

Numbers

Mac mini (M4 Pro), --offscreen, 1680x978, RD 12, spectator. The load is a 5x4x5 glass pen at spawn with N pigs and max_entity_cramming 0. Each run is a 10 s horizon-ctl bench, with TPS taken from status.ticks. Baseline is the v0.2.17 release build (= main for the client); "this PR" is the same profile (--release, thin LTO).

Pigs (tick time) v0.2.17 in-frame this PR in-frame v0.2.17 --server-thread
600 (~5 ms) 117.7 FPS, p99 10.5 ms, 20.1 TPS 116.7 FPS, p99 10.8 ms, 20.0 TPS
1,800 (~30 ms) 57.4 FPS, p99 35.0 ms, 20.2 TPS 57.0 FPS, p99 35.2 ms, 20.0 TPS
2,150 (~45 ms) 26.7 FPS, p99 53.1 ms, max 66 ms, 20.0 TPS 30.0 FPS, p99 48.0 ms, max 48.5 ms, 20.0 TPS
2,500 (~57 ms) 1.7 FPS, p50 575 ms, 17.3 TPS 16.0 FPS, p50 63 ms, 16.0 TPS 26.2 FPS, 20.2 TPS

The log of the 2,500 run shows Can't keep up! Is the server overloaded? Running 2050ms or 41 ticks behind, then one every 15 s.

The rest of the investigation (no code change)

  • 2 FPS on Mesa, by version. No drop on the ThinkPad (HD 620, Mesa 26.2.5 ANV). --benchmark forest, RD 16, offscreen, avg / 1% low FPS:

    • v0.2.13: 155.7 / 29.8
    • v0.2.15: 163.5 / 37.2
    • v0.2.16 (#1414): 162.8 / 32.4
    • v0.2.17 (#1434): 153.8 / 27.8

    The in-frame tick in forest flights is 8.8–10 ms on v0.2.13 and on v0.2.12 forced in-frame (9.6–9.8 ms), so the tick itself didn't regress. The same benchmark with --server-thread runs at 532.8 FPS (uncapped), against 153.8 in-frame. I found no RADV-only code path: the requested features are the same on ANV and RADV, and #1434 leaves the Vulkan culling as it was apart from the min_draws gate.

  • BSL "only raises the brightness." Not broken on Mesa Vulkan. A few seconds after loading, v0.2.17 matches the Metal picture. Java packs still get no shadow map (shadowtex* is a far depth; #1326 is open for that), so BSL looks like vanilla with brighter grading. That matches the report, and it isn't a regression from #1414. RADV itself is untested.

Self-check

Check Result
rustfmt ✅
cargo clippy --workspace --all-targets -- -D warnings ✅
cargo test -p horizon-client --lib clock:: ✅ 8 passed (2 new)
tools/parity.py --changed origin/main (Mac mini) ✅ 103 passed, 0 failed in 32.8 min
tools/lan_e2e.py in-frame host ✅ 8/8 (tab, chest, damage, mobs, time, commands, respawn, kills)
Scope ✅ 2 files

Not tested: Linux and Windows builds of this branch (the change is in the platform-independent frame loop; the slow-tick A/B ran on macOS), and RADV itself (no AMD GPU in the fleet).

Needs Ludovic

Nothing to decide. The server-thread default is being handled separately.

🤖 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/1462 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/amd-regress-1` --- ### 📝 Commits (2) - [`5526445`](https://github.com/horizon-rust/horizon/commit/55264459ce4a818a7a88b42582c59e057c3a90b1) In-frame ticks stop at a tick's length per frame: an overloaded world slows down instead of drawing at 2 FPS - [`d3de3cd`](https://github.com/horizon-rust/horizon/commit/d3de3cd0a9602de69fd650798b6378045e7ff89c) Merge remote-tracking branch 'origin/main' into fix/amd-regress-1 ### 📊 Changes **2 files changed** (+84 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/clock.rs` (+72 -0) 📝 `crates/horizon-client/src/game.rs` (+12 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Single player's world ticks in the frame by default (#1428). A frame now stops running world ticks once the ones it ran took one tick's length (50 ms at 20 TPS). It drops the rest and logs vanilla's overload warning: `Can't keep up! Is the server overloaded? Running Nms or N ticks behind`, with `MinecraftServer.runServer`'s threshold (1 s + 20 ticks behind) and interval (10 s + 100 ticks). - Ticks of a few milliseconds keep the client timer's full ten per frame, so nothing changes while the world keeps up. - `/tick sprint`, `--server-thread` and server clients are unchanged: the budget applies only where `remote` is `None`, i.e. the in-frame world. Two files: `clock.rs` (`FixedStep::tick_fits`, `FixedStep::drop_ticks`, two unit tests) and the frame loop in `game.rs`. ## Why A contributor reported 2 FPS on an AMD Radeon 680M (RADV) on today's build. His F3 showed `Integrated server @ 36.7/50.0 ms, 0 tx, 0 rx`, i.e. the in-frame world. With the world in the frame, any tick slower than its 50 ms puts every frame behind. Each frame then ran the timer's maximum of ten ticks: about 10 × 57 ms, so 575 ms frames. Vanilla runs that world on the integrated server's thread. There a slow tick only makes the server fall behind and say so, and the frames keep drawing. Why "one tick's length" rather than a fixed count: a fixed cap of N either limits light worlds on slow GPUs (at 10 FPS a frame needs 2 ticks to keep 20 TPS) or still allows N × a slow tick per frame. A time budget leaves light ticks alone. A world that can't keep up then gets one tick per frame, so frame time is about one tick plus the render. The world runs slower instead of the picture stopping. ## Numbers Mac mini (M4 Pro), `--offscreen`, 1680x978, RD 12, spectator. The load is a 5x4x5 glass pen at spawn with N pigs and `max_entity_cramming 0`. Each run is a 10 s `horizon-ctl bench`, with TPS taken from `status.ticks`. Baseline is the v0.2.17 release build (= main for the client); "this PR" is the same profile (`--release`, thin LTO). | Pigs (tick time) | v0.2.17 in-frame | this PR in-frame | v0.2.17 `--server-thread` | | --- | --- | --- | --- | | 600 (~5 ms) | 117.7 FPS, p99 10.5 ms, 20.1 TPS | 116.7 FPS, p99 10.8 ms, 20.0 TPS | | | 1,800 (~30 ms) | 57.4 FPS, p99 35.0 ms, 20.2 TPS | 57.0 FPS, p99 35.2 ms, 20.0 TPS | | | 2,150 (~45 ms) | 26.7 FPS, p99 53.1 ms, max 66 ms, 20.0 TPS | 30.0 FPS, p99 48.0 ms, max 48.5 ms, 20.0 TPS | | | 2,500 (~57 ms) | **1.7 FPS**, p50 575 ms, 17.3 TPS | **16.0 FPS**, p50 63 ms, 16.0 TPS | 26.2 FPS, 20.2 TPS | The log of the 2,500 run shows `Can't keep up! Is the server overloaded? Running 2050ms or 41 ticks behind`, then one every 15 s. ## The rest of the investigation (no code change) - **2 FPS on Mesa, by version.** No drop on the ThinkPad (HD 620, Mesa 26.2.5 ANV). `--benchmark forest`, RD 16, offscreen, avg / 1% low FPS: - v0.2.13: 155.7 / 29.8 - v0.2.15: 163.5 / 37.2 - v0.2.16 (#1414): 162.8 / 32.4 - v0.2.17 (#1434): 153.8 / 27.8 The in-frame tick in forest flights is 8.8–10 ms on v0.2.13 and on v0.2.12 forced in-frame (9.6–9.8 ms), so the tick itself didn't regress. The same benchmark with `--server-thread` runs at 532.8 FPS (uncapped), against 153.8 in-frame. I found no RADV-only code path: the requested features are the same on ANV and RADV, and #1434 leaves the Vulkan culling as it was apart from the `min_draws` gate. - **BSL "only raises the brightness."** Not broken on Mesa Vulkan. A few seconds after loading, v0.2.17 matches the Metal picture. Java packs still get no shadow map (`shadowtex*` is a far depth; #1326 is open for that), so BSL looks like vanilla with brighter grading. That matches the report, and it isn't a regression from #1414. RADV itself is untested. ## Self-check | Check | Result | | --- | --- | | rustfmt | ✅ | | `cargo clippy --workspace --all-targets -- -D warnings` | ✅ | | `cargo test -p horizon-client --lib clock::` | ✅ 8 passed (2 new) | | `tools/parity.py --changed origin/main` (Mac mini) | ✅ 103 passed, 0 failed in 32.8 min | | `tools/lan_e2e.py` in-frame host | ✅ 8/8 (tab, chest, damage, mobs, time, commands, respawn, kills) | | Scope | ✅ 2 files | Not tested: Linux and Windows builds of this branch (the change is in the platform-independent frame loop; the slow-tick A/B ran on macOS), and RADV itself (no AMD GPU in the fleet). ## Needs Ludovic Nothing to decide. The server-thread default is being handled separately. 🤖 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-03 04:10:15 +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#3539
No description provided.