[PR #830] [MERGED] fix(server-thread): follow the render distance, past 32 too (#804) #2842

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

📋 Pull Request Information

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

Base: main ← Head: fix/server-thread-view-distance


📝 Commits (1)

  • a2363a3 fix(server-thread): the integrated server follows the render distance, past 32 too

📊 Changes

5 files changed (+127 additions, -14 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/integrated.rs (+45 -3)
📝 crates/horizon-client/src/game/remote.rs (+26 -4)
📝 crates/horizon-client/src/lan/hub.rs (+16 -0)
📝 tools/lan_e2e.py (+36 -7)

📄 Description

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

What

Fixes #804. With the server thread on (--server-thread), single player stopped loading chunks at a render distance of 32, and changing the render distance during the game had no effect on the server. Also fixes the hunger gap listed on #731. That one was a harness bug, not a game bug.

  • The integrated server follows the render distance, as vanilla's IntegratedServer.tickServer does. On every tick where it isn't paused, the server compares the window's render and simulation distances with its own. When one changes, it logs Changing view distance to N, from M, and PlayerList.setViewDistance / setSimulationDistance send SetChunkCacheRadius / SetSimulationDistance to every player. Each player's chunks then follow, up to the distance that player asked for (ChunkMap.getPlayerViewDistance).
  • No clamp to 32 on the integrated server. The server takes max(2, renderDistance), the same as vanilla. Horizon's options go up to 64.
  • The remote client sends its render distance again when it changes, as Options.broadcastOptions does. Before this, it sent the distance only once, at login, and capped it at 32. Vanilla servers still cap it at their own view distance, so sending more than 32 to them is harmless.
  • lan_e2e:
    • New distance check (needs --server-thread): the host sets 48, then 6. The host streams 48 chunks, then 6. The guest, at 12, streams 7 (the server's 6, plus 1).
    • The guest is now found by name in lan status. With the server thread, that list includes the owner, so hazards was reading the owner's food, and the owner never moves. This is the "no hunger from moving" failure on #731. The same fix (lan_guest) is already on #731's branch, so this part of the diff disappears when #731 merges.

How tested

Mac mini M4 Pro, fast binaries built from this branch.

  • python3 tools/lan_e2e.py --server-thread --check distance --check hazards:
    • distance: PASS {48: (48, 12), 6: (6, 7)}. The host log shows Changing view distance to 48, from 12, to 6, from 48, to 12, from 6.
    • hazards: PASS, hunger [20, 5, 0] -> [20, 5, 3.23].
  • I did not run distance on origin/main, to save a build on a loaded machine. On main, the integrated server clamps to 32 and never changes its distance mid-game, so at 48 the host would stream 13 chunks out (the server's 12 it opened with, plus 1).

Self-check:

cargo fmt --all --check                                   ok
cargo clippy -p horizon-client --all-targets -- -D warnings   ok
cargo test -p horizon-client                              ok (860 + 67 + 22 passed)

Needs Ludovic

Nothing.

🤖 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/830 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-thread-view-distance` --- ### 📝 Commits (1) - [`a2363a3`](https://github.com/horizon-rust/horizon/commit/a2363a3bf635f7035052f97dfea488c2d16f878c) fix(server-thread): the integrated server follows the render distance, past 32 too ### 📊 Changes **5 files changed** (+127 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/integrated.rs` (+45 -3) 📝 `crates/horizon-client/src/game/remote.rs` (+26 -4) 📝 `crates/horizon-client/src/lan/hub.rs` (+16 -0) 📝 `tools/lan_e2e.py` (+36 -7) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Fixes #804. With the server thread on (`--server-thread`), single player stopped loading chunks at a render distance of 32, and changing the render distance during the game had no effect on the server. Also fixes the hunger gap listed on #731. That one was a harness bug, not a game bug. - **The integrated server follows the render distance, as vanilla's `IntegratedServer.tickServer` does.** On every tick where it isn't paused, the server compares the window's render and simulation distances with its own. When one changes, it logs `Changing view distance to N, from M`, and `PlayerList.setViewDistance` / `setSimulationDistance` send `SetChunkCacheRadius` / `SetSimulationDistance` to every player. Each player's chunks then follow, up to the distance that player asked for (`ChunkMap.getPlayerViewDistance`). - **No clamp to 32 on the integrated server.** The server takes `max(2, renderDistance)`, the same as vanilla. Horizon's options go up to 64. - **The remote client sends its render distance again when it changes**, as `Options.broadcastOptions` does. Before this, it sent the distance only once, at login, and capped it at 32. Vanilla servers still cap it at their own view distance, so sending more than 32 to them is harmless. - **lan_e2e:** - New `distance` check (needs `--server-thread`): the host sets 48, then 6. The host streams 48 chunks, then 6. The guest, at 12, streams 7 (the server's 6, plus 1). - The guest is now found by name in `lan status`. With the server thread, that list includes the owner, so `hazards` was reading the owner's food, and the owner never moves. This is the "no hunger from moving" failure on #731. The same fix (`lan_guest`) is already on #731's branch, so this part of the diff disappears when #731 merges. ## How tested Mac mini M4 Pro, `fast` binaries built from this branch. - `python3 tools/lan_e2e.py --server-thread --check distance --check hazards`: - `distance: PASS {48: (48, 12), 6: (6, 7)}`. The host log shows `Changing view distance to 48, from 12`, `to 6, from 48`, `to 12, from 6`. - `hazards: PASS`, hunger `[20, 5, 0] -> [20, 5, 3.23]`. - I did not run `distance` on `origin/main`, to save a build on a loaded machine. On main, the integrated server clamps to 32 and never changes its distance mid-game, so at 48 the host would stream 13 chunks out (the server's 12 it opened with, plus 1). Self-check: ``` cargo fmt --all --check ok cargo clippy -p horizon-client --all-targets -- -D warnings ok cargo test -p horizon-client ok (860 + 67 + 22 passed) ``` ## Needs Ludovic Nothing. 🤖 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:59:30 +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#2842
No description provided.