[PR #954] [MERGED] Strongholds: sample each ring's biome search through one climate sampler, as vanilla does #2937

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

📋 Pull Request Information

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

Base: main ← Head: fix/stronghold-ring-biome-search


📝 Commits (1)

  • cd30aae Strongholds: sample each ring search through one biome resolver

📊 Changes

4 files changed (+86 additions, -29 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/generator.rs (+51 -11)
📝 crates/horizon-world/src/worldgen/generator_structures.rs (+13 -8)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+4 -0)
📝 crates/horizon-world/src/worldgen/structure/stronghold.rs (+18 -10)

📄 Description

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

What

Stronghold rings now land where vanilla's do, all of them. Before, 3 of seed 1234's 128 ring positions were a few chunks off (and 1 of 3,153 starts in the comparison below).

Why

Vanilla's ring search (ChunkGeneratorStructureState → BiomeSource.findBiomeHorizontal) samples a 57×57 grid of quarts around each ring's guess through one climate sampler, in order. Climate.RTree keeps the previous leaf it found (a thread-local lastResult) and returns it again when a new point ties it, so where two biomes tie at a quart the winner depends on the quart sampled before it. Horizon looked up each quart alone, which settles those ties differently and picks another biome, and so another position.

How

  • StartContext::noise_biomes(&[[i32; 3]]) samples a batch through one resolver; noise_biome is one quart of it.
  • RingSearch::find builds the whole quart list in vanilla's order (dz outer, dx inner, -28..=28) and samples it at once, then runs the same reservoir pick (nextInt(found + 1)).

Proof

  • Vanilla Java ring positions (tools/structure_start_oracle.py with HORIZON_RINGS=1) against Horizon's: seed 1234 was 3/128 off, now 0/128; seeds 2, 3, 42 and -7 also 0/128.
  • Structure starts against the oracle over the comparison square: 3,153/3,153 match (3,152 before).
  • New test stronghold_rings_match_vanilla: rings 0, 1, 111 and 113 of seed 1234 at vanilla's chunks, including the three that used to differ.

Self-check

cargo fmt --all --check                                   ok
cargo clippy --workspace --all-targets -- -D warnings     ok
cargo test -p horizon-world                               ok
tools/parity.py --changed origin/main (on an integration commit with the other modpacks-9 PRs) 317 passed, 0 failed (94.6 min)

Nothing needs Ludovic.

🤖 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/954 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/stronghold-ring-biome-search` --- ### 📝 Commits (1) - [`cd30aae`](https://github.com/horizon-rust/horizon/commit/cd30aae4a8c1c90548c51e23eae285ef17e6311f) Strongholds: sample each ring search through one biome resolver ### 📊 Changes **4 files changed** (+86 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/generator.rs` (+51 -11) 📝 `crates/horizon-world/src/worldgen/generator_structures.rs` (+13 -8) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+4 -0) 📝 `crates/horizon-world/src/worldgen/structure/stronghold.rs` (+18 -10) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Stronghold rings now land where vanilla's do, all of them. Before, 3 of seed 1234's 128 ring positions were a few chunks off (and 1 of 3,153 starts in the comparison below). ## Why Vanilla's ring search (`ChunkGeneratorStructureState` → `BiomeSource.findBiomeHorizontal`) samples a 57×57 grid of quarts around each ring's guess through **one** climate sampler, in order. `Climate.RTree` keeps the previous leaf it found (a thread-local `lastResult`) and returns it again when a new point ties it, so where two biomes tie at a quart the winner depends on the quart sampled before it. Horizon looked up each quart alone, which settles those ties differently and picks another biome, and so another position. ## How - `StartContext::noise_biomes(&[[i32; 3]])` samples a batch through one resolver; `noise_biome` is one quart of it. - `RingSearch::find` builds the whole quart list in vanilla's order (dz outer, dx inner, -28..=28) and samples it at once, then runs the same reservoir pick (`nextInt(found + 1)`). ## Proof - Vanilla Java ring positions (`tools/structure_start_oracle.py` with `HORIZON_RINGS=1`) against Horizon's: seed 1234 was 3/128 off, now 0/128; seeds 2, 3, 42 and -7 also 0/128. - Structure starts against the oracle over the comparison square: 3,153/3,153 match (3,152 before). - New test `stronghold_rings_match_vanilla`: rings 0, 1, 111 and 113 of seed 1234 at vanilla's chunks, including the three that used to differ. ## Self-check ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-world ok tools/parity.py --changed origin/main (on an integration commit with the other modpacks-9 PRs) 317 passed, 0 failed (94.6 min) ``` Nothing needs Ludovic. 🤖 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 16:00: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#2937
No description provided.