[PR #3364] [MERGED] Structure checks: one climate volume per column, and each worker keeps its samples #4931

Closed
opened 2026-11-03 05:09:00 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3364
Author: @ThatCakeIsAPie
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: perf/worldgen-structure-climate


📝 Commits (3)

  • 82eeba7 Structure checks: keep each worker's single noise-biome samples
  • 91369d1 Structure column checks: sample the column's climate in one volume
  • 043f9c7 Merge main into perf/worldgen-structure-climate

📊 Changes

1 file changed (+40 additions, -4 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/generator.rs (+40 -4)

📄 Description

🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself.

What and why

Two changes to how structure placement asks for biomes:

  • couldStructureExistInColumn (jigsaw projection, onTopOfChunkCenter, temples, mansions) samples the column through createResolverForChunk in vanilla: one bulk climate volume of 1 x n x 1 quarts, then each quart from the bottom. Horizon took one scalar climate sample per quart instead, and a column with no valid biome walks all of them. The column is now one prepared volume through the biome stage's resolver path, as vanilla does.
  • Single noise-biome samples: several structures test the same quarts of a start chunk, and each answer was a full climate sample and parameter search. Each worker now keeps the answers, up to 65536 quarts. The generator is seed-bound, so they can't go stale.

Same starts, same order: the generated chunks, structure references included, are byte for byte the same.

Vanilla reference

Structure.onTopOfChunkCenter, JigsawStructure and ChunkGenerator.createResolverForChunk / getBiomeSource (26.3). Covered by the structure and chunk generation harnesses (tools/parity.py --changed lists them).

Measured

Measured against upstream main at 43d8bd01c; the branch is now rebased onto e1b2b0b2f, and upstream hasn't changed the code it touches in between.

chunkgen_bench on vanilla 26.3 worldgen (seed 1234, centre (40, -20), 16 x 16 chunks, --threads 1 --warmup), interleaved with upstream main (43d8bd01c) on one machine (i7, 4 cores / 8 threads, Windows 10). Each figure is the best of the rounds: run C (5 rounds) on a quiet machine, runs A (5) and B (7) while other work loaded it. With all five worldgen PRs together, run C's proto chunk went from 12.88 to 11.33 ms and the median finished chunks/s from 65.2 to 74.1 (+14%).

ms a chunk, one thread (best of rounds) upstream main this branch
structures stage, run C (quiet) 1.68 1.57
structures stage, run A 1.55 1.46
structures stage, run B 1.56 1.43

On vanilla, the structure stage is short and this barely moves it. Where it matters is worlds whose climate is expensive (deep data pack splines) or tall (a 2096-block world: ~525 quarts a column): there, the column checks held most of the structure stage, and in a To The Max world this took finished chunks/s from 116 to 138 on 6 threads (the fork's laptop measurements). Output: the terrain and decorated --snapshots are byte for byte those of upstream main in every run (terrain 255010fd759d40b6, decorated 00cec33a9aca9eac at 16 x 16; also at 24 x 24 on six threads: d92fd1c14b5665f0 / f5683617d95b87b0).

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-LT6RAH8, against upstream/main at e1b2b0b2f, 15 min 29 s)

Check Result
Scope ✅ 1 files, +40 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 401 run, FAILED (failures=1, errors=1, skipped=1) (2 min 24 s)
rustfmt ✅ (13 s)
clippy ✅ (5 min 36 s)
tests: horizon-world ✅ 256 passed (7 min 2 s)
doc tests ✅ 0 passed (5 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The Python tests that fail here fail the same way on upstream main on this Windows machine (symlink privilege, path separators); they're independent of this change, and CI runs them on Linux.

Label: none (players get the same worlds, generated faster).

🤖 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/3364 **Author:** [@ThatCakeIsAPie](https://github.com/ThatCakeIsAPie) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `perf/worldgen-structure-climate` --- ### 📝 Commits (3) - [`82eeba7`](https://github.com/horizon-rust/horizon/commit/82eeba7753bd8659cf8335a63f9a11b6e828ea39) Structure checks: keep each worker's single noise-biome samples - [`91369d1`](https://github.com/horizon-rust/horizon/commit/91369d11c5e0aa39846253d83c85999f7580da15) Structure column checks: sample the column's climate in one volume - [`043f9c7`](https://github.com/horizon-rust/horizon/commit/043f9c7b7bf1f65adf84147f4b4c21d5bb2606d4) Merge main into perf/worldgen-structure-climate ### 📊 Changes **1 file changed** (+40 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/generator.rs` (+40 -4) </details> ### 📄 Description > 🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself. ## What and why Two changes to how structure placement asks for biomes: - **`couldStructureExistInColumn`** (jigsaw projection, `onTopOfChunkCenter`, temples, mansions) samples the column through `createResolverForChunk` in vanilla: one bulk climate volume of 1 x n x 1 quarts, then each quart from the bottom. Horizon took one scalar climate sample per quart instead, and a column with no valid biome walks all of them. The column is now one prepared volume through the biome stage's resolver path, as vanilla does. - **Single noise-biome samples**: several structures test the same quarts of a start chunk, and each answer was a full climate sample and parameter search. Each worker now keeps the answers, up to 65536 quarts. The generator is seed-bound, so they can't go stale. Same starts, same order: the generated chunks, structure references included, are byte for byte the same. ## Vanilla reference `Structure.onTopOfChunkCenter`, `JigsawStructure` and `ChunkGenerator.createResolverForChunk` / `getBiomeSource` (26.3). Covered by the structure and chunk generation harnesses (`tools/parity.py --changed` lists them). ## Measured Measured against upstream main at 43d8bd01c; the branch is now rebased onto e1b2b0b2f, and upstream hasn't changed the code it touches in between. `chunkgen_bench` on vanilla 26.3 worldgen (seed 1234, centre (40, -20), 16 x 16 chunks, `--threads 1 --warmup`), interleaved with upstream main (43d8bd01c) on one machine (i7, 4 cores / 8 threads, Windows 10). Each figure is the best of the rounds: run C (5 rounds) on a quiet machine, runs A (5) and B (7) while other work loaded it. With all five worldgen PRs together, run C's proto chunk went from 12.88 to 11.33 ms and the median finished chunks/s from 65.2 to 74.1 (+14%). | ms a chunk, one thread (best of rounds) | upstream main | this branch | |---|---|---| | structures stage, run C (quiet) | 1.68 | 1.57 | | structures stage, run A | 1.55 | 1.46 | | structures stage, run B | 1.56 | 1.43 | On vanilla, the structure stage is short and this barely moves it. Where it matters is worlds whose climate is expensive (deep data pack splines) or tall (a 2096-block world: ~525 quarts a column): there, the column checks held most of the structure stage, and in a To The Max world this took finished chunks/s from 116 to 138 on 6 threads (the fork's laptop measurements). Output: the terrain and decorated `--snapshot`s are byte for byte those of upstream main in every run (terrain `255010fd759d40b6`, decorated `00cec33a9aca9eac` at 16 x 16; also at 24 x 24 on six threads: `d92fd1c14b5665f0` / `f5683617d95b87b0`). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-LT6RAH8, against upstream/main at e1b2b0b2f, 15 min 29 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +40 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 401 run, FAILED (failures=1, errors=1, skipped=1) (2 min 24 s) | | rustfmt | ✅ (13 s) | | clippy | ✅ (5 min 36 s) | | tests: horizon-world | ✅ 256 passed (7 min 2 s) | | doc tests | ✅ 0 passed (5 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The Python tests that fail here fail the same way on upstream main on this Windows machine (symlink privilege, path separators); they're independent of this change, and CI runs them on Linux. Label: none (players get the same worlds, generated faster). 🤖 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 05:09:00 +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#4931
No description provided.