[PR #6323] [MERGED] Far terrain on servers without horizon:lod (1/5): keep the chunks they sent #6795

Closed
opened 2026-11-03 06:26:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6323
Author: @some-du6e
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: far-terrain/1-kept-chunks


📝 Commits (2)

📊 Changes

11 files changed (+616 additions, -20 deletions)

View changed files

📝 crates/horizon-client-render/src/lib.rs (+1 -0)
📝 crates/horizon-client-render/src/lod.rs (+3 -4)
➕ crates/horizon-client-render/src/server_terrain.rs (+531 -0)
📝 crates/horizon-client-render/src/streaming.rs (+2 -0)
📝 crates/horizon-client/src/client_lib.rs (+5 -4)
📝 crates/horizon-client/src/game.rs (+40 -4)
📝 crates/horizon-client/src/game/control.rs (+1 -1)
📝 crates/horizon-client/src/game/remote.rs (+23 -1)
📝 docs/graphics.md (+3 -1)
📝 launcher/src/instances.rs (+2 -0)
📝 tools/server_lod_e2e.py (+5 -5)

📄 Description

On a vanilla, Paper or Spigot server, LOD Distance drew nothing. A server never sends its seed, so the client can't generate far terrain, and only Horizon servers running #4945–#4947 sample it for their clients. This PR makes such servers draw what they did send.

This PR: 7d95db693

  • Kept chunks. Every chunk the server sends is kept as its far-terrain summary under server-terrain/<server>/<hashed seed>/<namespace>/<level>/, as Anvil region files (server_terrain.rs). The chunks are drawn beyond the server's view distance on this visit and later ones. A chunk the client forgets (ForgetLevelChunk, or a moved storage) is observed once more first.
  • Keeping worlds apart. The hashed seed in the path separates the worlds behind one address, such as a proxy's servers or a reset. The far terrain is rebuilt when the level changes.
  • No fallback for local guests. Friend worlds and splitscreen guests keep nothing: an invite code changes at every share, and a splitscreen guest is in the player's own world.
  • Wide cells and bounds.
    • A cell wider than a chunk is drawn from the kept chunk nearest its middle.
    • Cells over 128 chunks wide aren't searched, so a search can't open thousands of region files.
    • A write failure is logged once.
  • Ludovic's e2e. tools/server_lod_e2e.py's "off" server (no offer) now expects these kept chunks (server-terrain) instead of no far terrain at all.
  • Docs. docs/graphics.md says where the chunks go, that nothing is pruned, and how to clear a server.
  • Launcher. Duplicating an instance leaves server-terrain/ out, since it's a cache that gets rebuilt.

Tests:

  • Encoding round-trips, and records of another game version are ignored.
  • Folder names come out safe.
  • Stored chunks come back after a restart.

The stack

This follows #4945–#4947, Ludovic's horizon:lod stack, which is now merged. That stack covers Horizon servers that sample far terrain for their clients. This one covers every other server: vanilla, Paper and Spigot never send their seed, so far terrain had nothing to draw there. prepare_lod tries the integrated server first, then the server's horizon:lod offer, and only falls back to this stack when there is no offer. Status reports this fallback as lod.source: "server-terrain", so the two can be told apart.

Each PR targets main and holds the PRs before it, so review only the commits listed under "This PR". Merge them in order.

  1. #6323 (this one): keep the chunks a server sent
  2. #6324: BlueMap's lowres tiles, settings and palette
  3. #6325: draw the rest from the server's BlueMap
  4. #6326: Find BlueMap, and no re-mesh storms
  5. #6327: no rings of nothing, slabs or holes
  6. #6643: read Bobby's cache too, written from its files on disk

Other projects' code

None. The first version of this PR also read Bobby's cache (.minecraft/.bobby). Bobby is LGPL-3.0, and I couldn't show how that importer's layout was learned, so it's gone: no .bobby reading, no FakeChunkManager reference, and nothing that says Horizon's own folders follow Bobby's. Horizon's server-terrain/ naming is its own (an address lowercased, :25565 dropped, anything unusual as _).

Bobby support is back as #6643, written only from the files Bobby leaves on disk. Bobby runs in CI against local vanilla servers, a description of its files is written from what it leaves behind, and the importer is written from that description by an agent that never saw the old code or Bobby's source.

Checked

  • CI on the fork (run): clippy --all-targets -D warnings on horizon-client-render, horizon-client and horizon-mods and the render crate's tests at every one of the 9 commits, and cargo fmt --check, the horizon-client tests and horizon-mods' modpack tests on the top one.

  • Live test on GitHub Actions (run). The runner downloads the pinned 26.3 from Mojang (every file checked against Mojang's SHA-1) and runs horizon-prepare. Then:

    • It records a local world drawing a real server's BlueMap as far terrain (video, recorded on these exact commits).

    Far terrain from a server's BlueMap

    • It runs tools/server_lod_e2e.py against a real dedicated server. With horizon-lod-distance set it reports source: server. Without it, it reports source: server-terrain (updated in PR 1).
  • Review: 16 rounds of independent reviewers, the last with no real findings (correctness, edge cases, tests, simplicity, fit) over the whole stack. Each finding went into the commit it belongs to. Since then, the .bobby reader came out and the stack was rebased on main; CI above is on the result.

  • Not run: the parity harnesses, and pr_ready.py (it needs .local/, which this machine doesn't build).

Suggested labels, since this fork can't set them: feature and needs-proof.

Note

Filed by Opus 5.5 using 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/6323 **Author:** [@some-du6e](https://github.com/some-du6e) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `far-terrain/1-kept-chunks` --- ### 📝 Commits (2) - [`7d95db6`](https://github.com/horizon-rust/horizon/commit/7d95db693f61cc3a22d8817e65e527bf8982e18c) Far terrain on servers: keep what the server sent - [`1b9c56b`](https://github.com/horizon-rust/horizon/commit/1b9c56b67aa20c969013eb77b2dfdae854560f7d) Merge main into #6323 ### 📊 Changes **11 files changed** (+616 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) 📝 `crates/horizon-client-render/src/lod.rs` (+3 -4) ➕ `crates/horizon-client-render/src/server_terrain.rs` (+531 -0) 📝 `crates/horizon-client-render/src/streaming.rs` (+2 -0) 📝 `crates/horizon-client/src/client_lib.rs` (+5 -4) 📝 `crates/horizon-client/src/game.rs` (+40 -4) 📝 `crates/horizon-client/src/game/control.rs` (+1 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+23 -1) 📝 `docs/graphics.md` (+3 -1) 📝 `launcher/src/instances.rs` (+2 -0) 📝 `tools/server_lod_e2e.py` (+5 -5) </details> ### 📄 Description On a vanilla, Paper or Spigot server, LOD Distance drew nothing. A server never sends its seed, so the client can't generate far terrain, and only Horizon servers running #4945–#4947 sample it for their clients. This PR makes such servers draw what they did send. ## This PR: `7d95db693` - **Kept chunks.** Every chunk the server sends is kept as its far-terrain summary under `server-terrain/<server>/<hashed seed>/<namespace>/<level>/`, as Anvil region files (`server_terrain.rs`). The chunks are drawn beyond the server's view distance on this visit and later ones. A chunk the client forgets (`ForgetLevelChunk`, or a moved storage) is observed once more first. - **Keeping worlds apart.** The hashed seed in the path separates the worlds behind one address, such as a proxy's servers or a reset. The far terrain is rebuilt when the level changes. - **No fallback for local guests.** Friend worlds and splitscreen guests keep nothing: an invite code changes at every share, and a splitscreen guest is in the player's own world. - **Wide cells and bounds.** - A cell wider than a chunk is drawn from the kept chunk nearest its middle. - Cells over 128 chunks wide aren't searched, so a search can't open thousands of region files. - A write failure is logged once. - **Ludovic's e2e.** `tools/server_lod_e2e.py`'s "off" server (no offer) now expects these kept chunks (`server-terrain`) instead of no far terrain at all. - **Docs.** `docs/graphics.md` says where the chunks go, that nothing is pruned, and how to clear a server. - **Launcher.** Duplicating an instance leaves `server-terrain/` out, since it's a cache that gets rebuilt. Tests: - Encoding round-trips, and records of another game version are ignored. - Folder names come out safe. - Stored chunks come back after a restart. ## The stack This follows #4945–#4947, Ludovic's `horizon:lod` stack, which is now merged. That stack covers Horizon servers that sample far terrain for their clients. This one covers every other server: vanilla, Paper and Spigot never send their seed, so far terrain had nothing to draw there. `prepare_lod` tries the integrated server first, then the server's `horizon:lod` offer, and only falls back to this stack when there is no offer. Status reports this fallback as `lod.source: "server-terrain"`, so the two can be told apart. Each PR targets `main` and holds the PRs before it, so review only the commits listed under "This PR". Merge them in order. 1. **#6323 (this one)**: keep the chunks a server sent 2. #6324: BlueMap's lowres tiles, settings and palette 3. #6325: draw the rest from the server's BlueMap 4. #6326: Find BlueMap, and no re-mesh storms 5. #6327: no rings of nothing, slabs or holes 6. #6643: read Bobby's cache too, written from its files on disk ## Other projects' code None. The first version of this PR also read Bobby's cache (`.minecraft/.bobby`). Bobby is LGPL-3.0, and I couldn't show how that importer's layout was learned, so it's gone: no `.bobby` reading, no `FakeChunkManager` reference, and nothing that says Horizon's own folders follow Bobby's. Horizon's `server-terrain/` naming is its own (an address lowercased, `:25565` dropped, anything unusual as `_`). Bobby support is back as #6643, written only from the files Bobby leaves on disk. Bobby runs in CI against local vanilla servers, a description of its files is written from what it leaves behind, and the importer is written from that description by an agent that never saw the old code or Bobby's source. ## Checked - **CI on the fork** ([run](https://github.com/some-du6e/horizon/actions/runs/41362609329)): `clippy --all-targets -D warnings` on `horizon-client-render`, `horizon-client` and `horizon-mods` and the render crate's tests at every one of the 9 commits, and `cargo fmt --check`, the `horizon-client` tests and `horizon-mods`' modpack tests on the top one. - **Live test on GitHub Actions** ([run](https://github.com/some-du6e/horizon/actions/runs/41363312105)). The runner downloads the pinned 26.3 from Mojang (every file checked against Mojang's SHA-1) and runs `horizon-prepare`. Then: - It records a local world drawing a real server's BlueMap as far terrain ([video](https://github.com/some-du6e/horizon/releases/download/far-terrain-video/far-terrain-bluemap.mp4), recorded on these exact commits). [![Far terrain from a server's BlueMap](https://github.com/some-du6e/horizon/releases/download/far-terrain-video/far-terrain-bluemap.png)](https://github.com/some-du6e/horizon/releases/download/far-terrain-video/far-terrain-bluemap.mp4) - It runs `tools/server_lod_e2e.py` against a real dedicated server. With `horizon-lod-distance` set it reports `source: server`. Without it, it reports `source: server-terrain` (updated in PR 1). - **Review:** 16 rounds of independent reviewers, the last with no real findings (correctness, edge cases, tests, simplicity, fit) over the whole stack. Each finding went into the commit it belongs to. Since then, the `.bobby` reader came out and the stack was rebased on `main`; CI above is on the result. - **Not run:** the parity harnesses, and `pr_ready.py` (it needs `.local/`, which this machine doesn't build). Suggested labels, since this fork can't set them: `feature` and `needs-proof`. > [!NOTE] > Filed by Opus 5.5 using 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 06:26:47 +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#6795
No description provided.