Skip to content

fix: tune default worldgen seed experience#679

Merged
github-actions[bot] merged 4 commits into
devfrom
feature/issue-661-worldgen-tuning
May 3, 2026
Merged

fix: tune default worldgen seed experience#679
github-actions[bot] merged 4 commits into
devfrom
feature/issue-661-worldgen-tuning

Conversation

@MichaelFisher1997
Copy link
Copy Markdown
Collaborator

Summary

  • Retunes default terrain, coast, ridge, river, and climate noise parameters for more varied readable spawn regions.
  • Broadens biome eligibility for mountains, wetlands, dry regions, and jungles so representative starts show more worldgen variety.
  • Expands deterministic worldgen reporting to five representative seeds and adds aggregate guardrails for ocean, forest, wetland, dry, and mountain coverage.

Evidence

  • Baseline worldgen-report before tuning showed seeds dominated by plains/coast with near-zero mountain coverage and little ocean coverage.
  • Final worldgen-report samples seeds 42, 1337, 424242, 8675309, and 987654321; outputs include controlled ocean coverage, forests, wetlands, dry savanna regions, and mountain/snowy mountain terrain without making common starts chaotic.

Verification

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

Fixes #661

@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 3, 2026

📋 Summary

This PR addresses Issue #661 ("Worldgen Phase 4: tune default seed experience") by retuning terrain noise parameters, biome eligibility thresholds, and coastal transition logic to create more varied and readable spawn regions. The implementation fully satisfies the issue requirements:

  • Representative seeds (42, 1337, 424242, 8675309, 987654321) are sampled with aggregate coverage guardrails
  • Mountains, wetlands, dry regions, and jungles are broadened through relaxed continentalness/elevation/ruggedness thresholds
  • New coastal_plains transition rules smooth beach-to-inland boundaries
  • Deterministic worldgen-report output validates the tuning with controlled coverage thresholds

The PR is a focused parameter-tuning change with no RHI/Vulkan, threading, or memory management implications. All running tests pass and code is properly formatted.

📌 Review Metadata

🔴 Critical Issues (Must Fix - Blocks Merge)

None identified.

⚠️ High Priority Issues (Should Fix)

None identified.

💡 Medium Priority Issues (Nice to Fix)

[MEDIUM] modules/world-worldgen/src/terrain_shape_generator_tests.zig:71-74 - Stale default value assertions
Confidence: High
Description: The Params default values test asserts old defaults that were changed in this PR:

  • ocean_threshold: test expects 0.35, actual default is 0.37 (changed in terrain_shape_generator.zig:32)
  • ridge_inland_min: test expects 0.50, actual is 0.48
  • ridge_inland_max: test expects 0.70, actual is 0.68
  • ridge_sparsity: test expects 0.50, actual is 0.46
    Impact: The test is silently out of sync with the code. While these particular tests appear to not be executing due to Zig 0.16 test discovery behavior with module re-exports, the file should still document the correct defaults for when the test infrastructure is fixed.
    Suggested Fix: Update the expected values in terrain_shape_generator_tests.zig:71-74 to match the new defaults.

[MEDIUM] ocean_threshold inconsistency between worldgen subsystems
Confidence: Medium
Description: terrain_shape_generator.zig:32 changed ocean_threshold from 0.35 to 0.37, but other subsystems retain 0.35:

  • height_sampler.zig:39 - determines ocean vs land height
  • surface_builder.zig:46 - determines coastal zone / beach band
  • biome_source.zig:26 - determines ocean biome selection
    This creates a liminal zone for continentalness in [0.35, 0.37) where TerrainShapeGenerator marks is_ocean = true, but height/surface/biome systems compute land behavior.
    Impact: Could affect spawn selection (session.zig excludes is_ocean for spawns), world map ocean classification, and terrain report ocean ratios. The effect is limited to a narrow coastal band (~2% of continentalness range).
    Suggested Fix: Either align all subsystem defaults to 0.37, or pass terrain_shape_generator.params.ocean_threshold through to the subsystems that TerrainShapeGenerator initializes.

ℹ️ Low Priority Suggestions (Optional)

[LOW] modules/world-worldgen/src/terrain_report.zig:503-504 - Double-counting mountain samples in aggregate test
Confidence: High
Description: The representative seeds keep varied but readable spawn regions test counts mountain coverage twice:

mountain_samples += @intFromFloat(report.mountain_coverage * @as(f64, @floatFromInt(report.sample_count)));
mountain_samples += report.biomeCount(.mountains) + report.biomeCount(.snowy_mountains) + ...;

report.mountain_coverage already counts ALL mountain terrain (height >= sea_level+48 or ridge_mask >= 0.65). Adding specific mountain biome counts on top double-counts columns that are both mountain terrain AND mountain biomes.
Impact: Inflates the aggregate mountain percentage. The threshold (>= 0.002) is so low that the test still passes, but the metric is logically incorrect.
Suggested Fix: Use only one counting method - either report.mountain_coverage based OR biome-based, not both.

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 8 Each file handles one aspect (biome registry, height sampling, noise config).
Open/Closed 7 Parameter structs allow extension, though defaults are hardcoded.
Liskov Substitution 9 No inheritance; biome definitions are uniform structs.
Interface Segregation 8 Clean separation between terrain, surface, biome, and report concerns.
Dependency Inversion 7 Subsystems depend on concrete defaults rather than shared config.
Average 7.8

🎯 Final Assessment

Overall Confidence Score: 82%

Rate your confidence in this PR being ready to merge (0-100%).
How to interpret:

  • 0-30%: Major concerns, do not merge without significant rework
  • 31-60%: Moderate concerns, several issues need addressing
  • 61-80%: Minor concerns, mostly ready with some fixes
  • 81-100%: High confidence, ready to merge or with trivial fixes

Confidence Breakdown:

  • Code Quality: 85% (well-structured parameter changes, but stale tests and threshold inconsistency)
  • Completeness: 90% (fully addresses issue Worldgen Phase 4: tune default seed experience #661 with evidence and verification)
  • Risk Level: 75% (parameter tuning is inherently risky for balance, but changes are bounded by guardrail tests)
  • Test Coverage: 80% (new aggregate guardrails are good, but stale tests and undiscovered tests reduce confidence)

Merge Readiness:

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

Verdict:

MERGE WITH FIXES

The PR successfully tunes worldgen for varied spawns and satisfies issue #661. Merge after updating terrain_shape_generator_tests.zig defaults to match the new values and resolving the ocean_threshold inconsistency between subsystems.

{
  "reviewed_sha": "7da7071881af44fb258475038cd3602dbdcea120",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 2,
  "overall_confidence_score": 82,
  "recommendation": "MERGE WITH FIXES"
}

New%20session%20-%202026-05-02T23%3A49%3A56.651Z
opencode session  |  github run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

📋 Summary

This PR addresses Issue #661 ("Worldgen Phase 4: tune default seed experience") by retuning terrain noise parameters, biome eligibility thresholds, and coastal transition logic to create more varied and readable spawn regions. The implementation fully satisfies the issue requirements with representative seeds, aggregate coverage guardrails, and new coastal_plains transition rules. All zig build test tests pass successfully.

📌 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)

[FIXED] Previous issue: terrain_shape_generator_tests.zig stale default value assertions (ocean_threshold, ridge values now match code)
[FIXED] Previous issue: ocean_threshold inconsistency between worldgen subsystems (all now aligned to 0.37)
[FIXED] Previous issue: terrain_report.zig double-counting mountain samples in aggregate test

None identified.

ℹ️ Low Priority Suggestions (Optional)

[LOW] modules/world-worldgen/src/surface_builder.zig:276-277 - Test expectation contradicts beach band parameters
Confidence: High
Description: The test "SurfaceBuilder beach band matches coastal biome range" expects getCoastalSurfaceType(0.43, 1, 70, 0.3) to return CoastalSurfaceType.none. However, with ocean_threshold = 0.37 and beach_band = 0.07, the beach zone extends to 0.44. A continentalness of 0.43 is within the active beach band and should return sand_beach (slope=1 is below cliff threshold, erosion=0.3 is below gravel threshold). The test contradicts its own stated purpose of validating that the beach band matches the coastal biome range.
Impact: The test documents incorrect behavior. If test discovery infrastructure is fixed, this test would fail. The beach biome in biome_registry.zig also uses max_continental = 0.44, confirming 0.43 should be beach.
Suggested Fix: Change the test expectation to CoastalSurfaceType.sand_beach or use a continentalness value clearly outside the beach band (e.g., 0.45) to test the inland boundary.

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 8 Each file handles one aspect (biome registry, height sampling, noise config).
Open/Closed 7 Parameter structs allow extension, though defaults are hardcoded.
Liskov Substitution 9 No inheritance; biome definitions are uniform structs.
Interface Segregation 8 Clean separation between terrain, surface, biome, and report concerns.
Dependency Inversion 8 Subsystems now share consistent ocean_threshold default (0.37).
Average 8.0

🎯 Final Assessment

Overall Confidence Score: 88%

Rate your confidence in this PR being ready to merge (0-100%).
How to interpret:

  • 0-30%: Major concerns, do not merge without significant rework
  • 31-60%: Moderate concerns, several issues need addressing
  • 61-80%: Minor concerns, mostly ready with some fixes
  • 81-100%: High confidence, ready to merge or with trivial fixes

Confidence Breakdown:

  • Code Quality: 90% (well-structured parameter changes, cross-subsystem consistency achieved)
  • Completeness: 90% (fully addresses issue Worldgen Phase 4: tune default seed experience #661 with evidence and verification)
  • Risk Level: 80% (parameter tuning is inherently risky for balance, but changes are bounded by guardrail tests)
  • Test Coverage: 85% (new aggregate guardrails are good, one stale test in non-executing file)

Merge Readiness:

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

Verdict:

MERGE WITH FIXES

The PR successfully tunes worldgen for varied spawns and satisfies issue #661. All previously reported issues have been resolved. Merge after correcting the surface builder test expectation at surface_builder.zig:276-277.

{
  "reviewed_sha": "dff07b12e5a98d14e318f4e84af9a4981839a575",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 0,
  "overall_confidence_score": 88,
  "recommendation": "MERGE WITH FIXES"
}

New%20session%20-%202026-05-03T00%3A19%3A53.826Z
opencode session  |  github run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

📋 Summary

This PR addresses Issue #661 ("Worldgen Phase 4: tune default seed experience") by retuning terrain noise parameters, biome eligibility thresholds, coastal transition logic, and adding deterministic guardrail tests. The implementation fully satisfies the issue requirements:

  • Five representative seeds (42, 1337, 424242, 8675309, 987654321) with aggregate coverage thresholds
  • Mountains, wetlands, dry regions, and jungles broadened through relaxed thresholds
  • New coastal_plains edge transitions with sand surface
  • Cross-subsystem ocean_threshold aligned to 0.37
  • All zig build test tests pass and code is properly formatted

📌 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)

[FIXED] Previous issue: terrain_shape_generator_tests.zig stale default value assertions (now match 0.37, 0.48, 0.68, 0.46)
[FIXED] Previous issue: ocean_threshold inconsistency between worldgen subsystems (all aligned to 0.37)
[FIXED] Previous issue: terrain_report.zig double-counting mountain samples in aggregate test
[FIXED] Previous issue: surface_builder.zig test expectation contradicted beach band parameters (now uses 0.45 correctly outside [0.37, 0.44])

None identified.

ℹ️ Low Priority Suggestions (Optional)

None identified.

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 8 Each file handles one aspect (noise config, height sampling, biome registry).
Open/Closed 7 Parameter structs allow tuning without structural changes, though defaults remain hardcoded.
Liskov Substitution 9 No inheritance; uniform biome struct definitions throughout.
Interface Segregation 8 Clean separation between terrain, surface, biome, and report concerns.
Dependency Inversion 8 Subsystems now share consistent ocean_threshold default (0.37).
Average 8.0

🎯 Final Assessment

Overall Confidence Score: 92%

How to interpret: 81-100%: High confidence, ready to merge or with trivial fixes

Confidence Breakdown:

  • Code Quality: 92% (clean parameter changes, cross-subsystem consistency achieved, stale tests updated)
  • Completeness: 95% (fully addresses issue Worldgen Phase 4: tune default seed experience #661 with evidence, verification, and guardrail tests)
  • Risk Level: 85% (parameter tuning is inherently risky for balance, but strongly bounded by aggregate guardrails)
  • Test Coverage: 90% (new aggregate tests cover all biome categories, though individual edge cases rely on integration)

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing (verified: zig build test passes, zig fmt clean)

Verdict:

MERGE

All previously reported issues are resolved, tests pass, formatting is clean, and the PR fully satisfies issue #661 with solid guardrail coverage.

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

New%20session%20-%202026-05-03T00%3A33%3A32.262Z
opencode session  |  github run

@github-actions github-actions Bot merged commit 50728ae into dev May 3, 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 4: tune default seed experience

1 participant