Add overworld cave-density controls (issue #111)#115
Merged
Conversation
The overworld delegates to vanilla generation, whose 1.18+ noise caves can make a cave world "nothing but passageways" (issue #111). Vanilla exposes no density knob for noise caves, so add a post-generation fill pass plus a coarse carver toggle: - Settings: new world.overworld-cave-fill (0.0-1.0, default 0.0) and world.overworld-carvers (boolean, default true). getOverworldCaveFill() clamps to [0,1]. - NoiseCaveGenerator: new fillField() - a low-frequency, seed-deterministic [0,1] field so caves close in broad connected patches, not a random speckle. - ChunkGeneratorWorld: after capColumn seals the sky, fillCaves() re-solidifies AIR and CAVE_AIR below the cap where the field falls under the ratio. Both air types matter: noise caves are placed as AIR, carvers as CAVE_AIR - matching only CAVE_AIR (the first attempt) missed the noise caves entirely. The carver toggle gates shouldGenerateCaves(). Underground biomes, ores, decorations and structures are preserved at any fill value. - config.yml: documents both keys. Adds fill-field and generateSurface fill tests. All 74 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KwMG7jJxLPXGqNfb95nP1W
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #111.
The overworld delegates to vanilla generation, whose 1.18+ noise caves can make a cave world feel like "nothing but passageways" (issue #111). Vanilla exposes no density knob for noise caves, so this adds a post-generation fill pass plus a coarse carver toggle.
New config options (
world:)overworld-cave-fill(0.0–1.0, default0.0) — re-solidifies a fraction of the vanilla caves after generation, using a low-frequency noise field so caves close in broad connected patches (leaving separate chambers) rather than a random speckle.0.0keeps the current dense caves;0.3–0.8thins them out. Underground biomes, ores, decorations and structures are preserved at any value.overworld-carvers(defaulttrue) — setfalseto remove the big ravines/tunnels while keeping the noise caves.Both only affect newly generated chunks.
Implementation
Settings: two new fields with getters/setters;getOverworldCaveFill()clamps to[0,1].NoiseCaveGenerator: newfillField()— a low-frequency, seed-deterministic[0,1]field.ChunkGeneratorWorld: aftercapColumnseals the sky,fillCaves()re-solidifiesAIRandCAVE_AIRbelow the cap where the field falls under the ratio. Both air types matter — vanilla noise caves are placed asAIR, carvers asCAVE_AIR; matching onlyCAVE_AIRmisses the dense noise caves entirely. The carver toggle gatesshouldGenerateCaves().config.yml: documents both keys.Tests
Adds
fillFieldtests (range, monotonicity, determinism) and behaviouralgenerateSurfacefill tests over an in-memoryChunkData(fill 0.0 keeps every cave and still seals sky; 1.0 closes ~all; 0.5 thins), plus a carver-toggle test. All 74 tests pass.Notes
FILL_FREQUENCY(0.02) and can be tuned if patches read too coarse/fine.🤖 Generated with Claude Code
https://claude.ai/code/session_01KwMG7jJxLPXGqNfb95nP1W