Skip to content

feat(worldgen): beaches along seas and larger lakes (#679) - #682

Merged
marceld23 merged 2 commits into
mainfrom
feat/worldgen-beaches
Aug 3, 2026
Merged

feat(worldgen): beaches along seas and larger lakes (#679)#682
marceld23 merged 2 commits into
mainfrom
feat/worldgen-beaches

Conversation

@marceld23

Copy link
Copy Markdown
Owner

Summary

Implements worldgen beaches (#679): sand (or a per-planet beachBlock) along the waterline of the sea and of larger lakes/ponds — on beach-masked stretches of coast, with a sandy shallow-water apron, palm-fringed tropical shores, and none on dry/airless/lava-sea worlds.

How it works

  • Shore detection: a column is beach when it sits in a jittered 1..3-block band above the waterline AND real water lies within a probe ring (8 directions × radii 4/8/12, early-out) — inland lowland at coastal altitude never sand-coats. The submerged apron (seabed ≤3 below the sea line) needs no probe.
  • Coast character: a large-scale FBM mask (~55–60 % beach) alternates sand with bare rocky shore; a small jitter noise makes the beach edge wander. Width follows slope automatically (flat coast → wide beach, cliff → sliver).
  • Larger lakes: RiverField labels each pooled reach's fill-and-spill lake (connected coarse cells sharing one filled level) and pre-rings lakes with ≥64 visible water columns with dry shore markers (TryGetLakeShore). Small pools, 1-wide rivers and puddle ponds get no beach; large ponds (bowl ≥3 deep nearby) get a rim at the pond mask's edge.
  • Material: new optional planet data key beachBlock (default sand, validated at content load). Beaches form only on WATER shorelines — lava seas keep their volcanic coasts. Surface AND sub-surface turn to the beach block, so the varied topsoil depth yields a real 2–5-block sand layer.
  • Override order: biome → beach → snow/ice → volcano basalt — cold coasts get snow-dusted shores, volcano flanks still win.
  • Consumers stay consistent: the shared IsBeachColumn query keeps Generate, tree stamping and tests agreeing. Beach columns grow only palms/dead snags (themes with neither leave the beach bare); giant fungi skip beaches; surface flora comes from the sand host pool at ×0.35 density.

Compatibility & performance

  • Pure surface-palette change, all pieces are pure functions of (seed, x, z): no protocol or save changes, server and client preview agree. Existing worlds retroactively gain sandy shores (worldgen is seed-derived); player-built blocks are untouched.
  • Per-column cost in Generate is O(1) gates; the probe runs only for columns inside the narrow waterline band. The lake-shore pass runs once per world inside the cached RiverField build and only touches lake-edge columns (~perimeter, not area).

Tests

5 new tests in BeachGenerationTests: sea coast grows beaches + Generate paints them, sandy apron in the shallows, no beaches on dry/lava/airless worlds, cross-instance determinism, and a synthetic-basin lake-shore ring incl. size threshold. Full non-Slow suite 1348/1348 and all 38 worldgen/river tests (incl. Slow) green locally; clean rebuild with 0 warnings.

Closes #679

🤖 Generated with Claude Code

A water shoreline now grows beaches: a jittered 1..3-block band above the
waterline, confirmed against real nearby water (8-dir probe ring), plus a
submerged sandy apron (seabed <=3 under the sea line). A large-scale
coast-character mask (~55-60 %) alternates beach with bare rocky shore.

- RiverField labels fill-and-spill lakes (connected cells, one filled
  level) and pre-rings lakes with >=64 visible water columns with dry
  shore markers (TryGetLakeShore); small pools/rivers get no beach.
  Large ponds (bowl >=3 deep nearby) get a mask-edge rim.
- New optional planet data key `beachBlock` (default sand); beaches only
  on WATER shorelines - lava seas keep their volcanic coasts.
- Override order: biome -> beach -> snow/ice -> volcano basalt. Shared
  IsBeachColumn query keeps Generate, tree stamping and tests agreeing.
- Beach columns grow only palms/dead snags (palm-fringed tropical
  shores); giant fungi skip beaches; flora uses the sand host pool at
  x0.35 density.
- 5 new tests (BeachGenerationTests); 1400 server tests green.

Closes #679

Co-Authored-By: Claude Fable 5 <[email protected]>
@marceld23 marceld23 added enhancement New feature or request area: server GameServer / Networking / WorldHost / Api / Persistence labels Aug 3, 2026
@marceld23
marceld23 merged commit d101f1d into main Aug 3, 2026
12 checks passed
@marceld23
marceld23 deleted the feat/worldgen-beaches branch August 3, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: server GameServer / Networking / WorldHost / Api / Persistence enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worldgen: beaches along seas and larger lakes

1 participant