Skip to content

Add overworld cave-density controls (issue #111)#115

Merged
tastybento merged 1 commit into
developfrom
feature/configurable-structures
Jul 7, 2026
Merged

Add overworld cave-density controls (issue #111)#115
tastybento merged 1 commit into
developfrom
feature/configurable-structures

Conversation

@tastybento

Copy link
Copy Markdown
Member

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, default 0.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.0 keeps the current dense caves; 0.30.8 thins them out. Underground biomes, ores, decorations and structures are preserved at any value.
  • overworld-carvers (default true) — set false to 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: new fillField() — a low-frequency, seed-deterministic [0,1] field.
  • 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 — vanilla noise caves are placed as AIR, carvers as CAVE_AIR; matching only CAVE_AIR misses the dense noise caves entirely. The carver toggle gates shouldGenerateCaves().
  • config.yml: documents both keys.

Tests

Adds fillField tests (range, monotonicity, determinism) and behavioural generateSurface fill tests over an in-memory ChunkData (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

  • Water-filled cave pockets (aquifers) are left as water, not drained.
  • Fill-patch size is governed by FILL_FREQUENCY (0.02) and can be tuned if patches read too coarse/fine.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KwMG7jJxLPXGqNfb95nP1W

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
@tastybento tastybento merged commit a4c311d into develop Jul 7, 2026
1 check passed
@tastybento tastybento deleted the feature/configurable-structures branch July 7, 2026 02:24
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Difference in caves between versions in world

1 participant