[PR #955] [MERGED] Beardifier: YUNG's and Moog's enhanced terrain adaptation kernels (horizon:enhanced_terrain_adaptation) #2936

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/955
Author: @ludovic111
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @ludovic111

Base: main ← Head: feat/enhanced-terrain-adaptation


📝 Commits (1)

  • a906bb5 Structures: YUNG's and Moog's enhanced terrain adaptation, as terrain kernels

📊 Changes

9 files changed (+603 additions, -11 deletions)

View changed files

📝 crates/horizon-core/src/density/beardifier.rs (+172 -2)
📝 crates/horizon-core/src/density/mod.rs (+4 -1)
📝 crates/horizon-world/src/worldgen/structure.rs (+1 -0)
➕ crates/horizon-world/src/worldgen/structure/enhanced_terrain.rs (+355 -0)
📝 crates/horizon-world/src/worldgen/structure/jigsaw.rs (+16 -0)
📝 crates/horizon-world/src/worldgen/structure/piece_limited.rs (+1 -0)
📝 crates/horizon-world/src/worldgen/structure/start.rs (+36 -8)
📝 crates/horizon-world/src/worldgen/structure/yung.rs (+1 -0)
📝 docs/mods.md (+17 -0)

📄 Description

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

Carry writes the key in #956; this PR builds alone (vanilla data never has the key). It touches density/beardifier.rs, as #796 does: whichever merges second needs a small rebase.

What

YUNG's API and MoogsStructureLib replace vanilla's beard with an "enhanced terrain adaptation": a kernel of their own size and falloff that carves or buries terrain above and below each piece's floor. Better Fortresses' bridges, Better Strongholds and Moog's Nether fortresses use it. The game now reads horizon:enhanced_terrain_adaptation on a structure, and on a pool element with its own, and adds those kernels to the Beardifier (docs/mods.md has the format).

How (as the libraries do)

  • Kernel weight e^(-d²/kernel_distance); per piece and block, |(floor + 0.5) · invSqrt(sq/2) / 2| · weight · sign. The sign comes from the top action above the floor and the bottom action below it (carve -1, bury 1, none 0).
  • Rigid pieces count ×0.8 and junctions ×0.4. The piece box is moved by bottom_offset and padded (x and z swapped for 90° and 270°). Moog's band limits the kernel to some piece heights and skips junctions.
  • YUNG adds junctions for every piece, Moog only for non-rigid ones. YUNG also grows the start box by the kernel radius.
  • Pieces count only when close to the chunk (isCloseToChunk with the largest kernel radius). The contributions are summed in f64 after vanilla's value, and with no kernel the value is returned unchanged.

Proof (ATM10's carried mods with #956, seed 1234, share of solid blocks inside each structure's pieces in the noise stage, before the structures are placed)

  • Better Fortresses: 38.9 % → 7.1 % and 40.8 % → 2.5 %, the mod's open bridges.
  • Moog's mega fortress: 44.7 % → 30.3 % (its band).
  • Better Strongholds, buried: 91.7 % → 99.5 % and 96.6 % → 98.5 %, closing the caves that cut through them.
  • Tests: kernel_pieces_carve_above_the_floor_only and kernel_junctions_bury_at_four_tenths check the density against values worked out by hand from the libraries' formulas. piece_boxes_move_pad_and_cut_to_bands and collects_pieces_and_junctions_as_each_library_does check the boxes and what each library collects.
  • Vanilla is unchanged: the structure and density harnesses below pass.

Self-check

cargo fmt --all --check                                   ok
cargo clippy --workspace --all-targets -- -D warnings     ok
cargo test -p horizon-core -p horizon-world               ok
tools/parity.py --changed origin/main (integration commit) 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/955 **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:** `feat/enhanced-terrain-adaptation` --- ### 📝 Commits (1) - [`a906bb5`](https://github.com/horizon-rust/horizon/commit/a906bb50ba6d5d67afe5a8cd241bdafb93cd0dfc) Structures: YUNG's and Moog's enhanced terrain adaptation, as terrain kernels ### 📊 Changes **9 files changed** (+603 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-core/src/density/beardifier.rs` (+172 -2) 📝 `crates/horizon-core/src/density/mod.rs` (+4 -1) 📝 `crates/horizon-world/src/worldgen/structure.rs` (+1 -0) ➕ `crates/horizon-world/src/worldgen/structure/enhanced_terrain.rs` (+355 -0) 📝 `crates/horizon-world/src/worldgen/structure/jigsaw.rs` (+16 -0) 📝 `crates/horizon-world/src/worldgen/structure/piece_limited.rs` (+1 -0) 📝 `crates/horizon-world/src/worldgen/structure/start.rs` (+36 -8) 📝 `crates/horizon-world/src/worldgen/structure/yung.rs` (+1 -0) 📝 `docs/mods.md` (+17 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Carry writes the key in #956; this PR builds alone (vanilla data never has the key). It touches `density/beardifier.rs`, as #796 does: whichever merges second needs a small rebase. ## What YUNG's API and MoogsStructureLib replace vanilla's beard with an "enhanced terrain adaptation": a kernel of their own size and falloff that carves or buries terrain above and below each piece's floor. Better Fortresses' bridges, Better Strongholds and Moog's Nether fortresses use it. The game now reads `horizon:enhanced_terrain_adaptation` on a structure, and on a pool element with its own, and adds those kernels to the Beardifier (docs/mods.md has the format). ## How (as the libraries do) - Kernel weight `e^(-d²/kernel_distance)`; per piece and block, `|(floor + 0.5) · invSqrt(sq/2) / 2| · weight · sign`. The sign comes from the top action above the floor and the bottom action below it (carve -1, bury 1, none 0). - Rigid pieces count ×0.8 and junctions ×0.4. The piece box is moved by `bottom_offset` and padded (x and z swapped for 90° and 270°). Moog's `band` limits the kernel to some piece heights and skips junctions. - YUNG adds junctions for every piece, Moog only for non-rigid ones. YUNG also grows the start box by the kernel radius. - Pieces count only when close to the chunk (`isCloseToChunk` with the largest kernel radius). The contributions are summed in f64 after vanilla's value, and with no kernel the value is returned unchanged. ## Proof (ATM10's carried mods with #956, seed 1234, share of solid blocks inside each structure's pieces in the noise stage, before the structures are placed) - Better Fortresses: 38.9 % → 7.1 % and 40.8 % → 2.5 %, the mod's open bridges. - Moog's mega fortress: 44.7 % → 30.3 % (its band). - Better Strongholds, buried: 91.7 % → 99.5 % and 96.6 % → 98.5 %, closing the caves that cut through them. - Tests: `kernel_pieces_carve_above_the_floor_only` and `kernel_junctions_bury_at_four_tenths` check the density against values worked out by hand from the libraries' formulas. `piece_boxes_move_pad_and_cut_to_bands` and `collects_pieces_and_junctions_as_each_library_does` check the boxes and what each library collects. - Vanilla is unchanged: the structure and density harnesses below pass. ## Self-check ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-core -p horizon-world ok tools/parity.py --changed origin/main (integration commit) 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#2936
No description provided.