Skip to content

feat: apply biome terrain modifiers#669

Merged
github-actions[bot] merged 1 commit into
devfrom
feature/issue-650-terrain-modifiers
May 2, 2026
Merged

feat: apply biome terrain modifiers#669
github-actions[bot] merged 1 commit into
devfrom
feature/issue-650-terrain-modifiers

Conversation

@MichaelFisher1997
Copy link
Copy Markdown
Collaborator

Summary

  • Select a stable preliminary biome from unmodified terrain before applying biome terrain modifiers.
  • Apply biome height_amplitude, smoothing, clamp_to_sea_level, and height_offset during height shaping while keeping ocean decisions hard and peak compression active.
  • Add height sampler coverage for flattening/clamping, amplification, and peak compression, and update deterministic worldgen fingerprints.

Verification

  • nix develop --command zig fmt modules/world-worldgen/src/height_sampler.zig modules/world-worldgen/src/terrain_shape_generator.zig src/worldgen_tests.zig
  • nix develop --command zig build test

Fixes #650

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

📋 Summary

This PR implements Issue #650: applying BiomeDefinition.terrain modifiers during height generation. The implementation uses a stable two-pass approach:

  1. Select a preliminary biome from unmodified terrain
  2. Re-sample with the biome's TerrainModifier (height_amplitude, smoothing, clamp_to_sea_level, height_offset)
  3. Apply peak compression after modifiers

The PR correctly avoids circular instability by anchoring biome selection to unmodified terrain. Ocean decisions remain hard (continentalness-based), and peak compression is preserved post-modifier. Tests cover flattening, amplification, clamping, and peak compression interaction. Deterministic worldgen fingerprints are updated to reflect the new generation pipeline.

📌 Review Metadata

🔴 Critical Issues (Must Fix - Blocks Merge)

✅ All previously reported critical issues have been resolved.

None identified.

⚠️ High Priority Issues (Should Fix)

✅ All previously reported high priority issues have been resolved.

None identified.

💡 Medium Priority Issues (Nice to Fix)

None identified.

ℹ️ Low Priority Suggestions (Optional)

[LOW] modules/world-worldgen/src/terrain_shape_generator.zig:281-297 - Minor code duplication in biome selection
Confidence: High
Description: prepareChunkPhaseData manually constructs ClimateParams and StructuralParams to call selectBiome, duplicating logic already encapsulated in selectBiomeForColumn (line 199).
Impact: Maintenance overhead if biome selection logic changes in the future.
Suggested Fix: Construct a ColumnData from phase_data fields and call self.selectBiomeForColumn(column, phase_data.slopes[idx]) instead.

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 8 HeightSampler handles height computation; TerrainShapeGenerator orchestrates the two-pass biome/modifier flow cleanly
Open/Closed 7 Adding new modifier types requires extending TerrainModifier and applyHeight, but the existing pipeline doesn't need changes
Liskov Substitution 9 computeHeight delegates to computeHeightWithTerrainModifier with null; backward compatibility preserved
Interface Segregation 9 New computeHeightWithTerrainModifier adds optional parameter without breaking existing callers
Dependency Inversion 8 TerrainModifier is a simple data struct passed into height computation; no tight coupling
Average 8.2

🎯 Final Assessment

Overall Confidence Score: 92%

Confidence Breakdown:

  • Code Quality: 90% (clean implementation, minor duplication in pass 3)
  • Completeness: 95% (fully addresses issue Worldgen Phase 1: apply BiomeDefinition TerrainModifier during height shaping #650 requirements, good test coverage)
  • Risk Level: 85% (two-pass sampling doubles noise cost per column; acceptable for correctness)
  • Test Coverage: 95% (tests for flattening, amplification, clamping, peak compression; fingerprints updated)

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing

Verdict:

MERGE

Clean implementation of terrain modifier integration with stable two-pass biome selection, comprehensive tests, and passing build.

{
  "reviewed_sha": "8fb6a88af0276152e43e05871081b1e64e19752a",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 0,
  "overall_confidence_score": 92,
  "recommendation": "MERGE"
}

New%20session%20-%202026-05-02T21%3A27%3A09.356Z
opencode session  |  github run

@github-actions github-actions Bot merged commit 60e26db into dev May 2, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worldgen Phase 1: apply BiomeDefinition TerrainModifier during height shaping

1 participant