W2: Procedural island generator

Island.generate(seed) builds a 513 x 513 heightfield (2 m spacing, the whole
1,024 m world) from the match seed's "worldgen" stream: a warped coastline,
a coastal shelf and interior dome, two to four summits joined by ridges,
rolling and rocky detail, and flattened marsh in wet lowland. Land is scaled
so the tallest summit lands between ISLAND_PEAK_MIN and ISLAND_PEAK_MAX,
under the last tide. Each sample gets an elevation band (sea, beach, marsh,
forest, highland, summit) for terrain materials.

- Simulation generates the island unless a test supplies its own ground,
  and spawns players on dry land until the drop arrives.
- The headless server logs world_hash in its start line.
- Island.heightmap_hash() is SHA-256 over millimetre heights and bands.
- tools/island_map.gd draws a top-down map with tide contours.
- New island constants in tuning.gd; GDD gains an island section.

Tests: a 100-seed sweep checks generation time (slowest 617 ms against
5 s), land area, at least two distinct high points, walkable land, bands,
and that no more than 3% of dry land is cut off at sea levels 0 and 8 m
(worst seen 0.87%). A separate server process given only the seed must
log the same heightmap hash.

Closes #9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 14:15:59 -05:00
co-authored by Claude Opus 5.5
parent f1ce780474
commit c70d0c1c4f
15 changed files with 658 additions and 5 deletions
+23
View File
@@ -43,6 +43,29 @@ name, so it can't drift from the game. To change a number, edit that file.
Bots fill empty slots. Offline play is a local server filled with bots, the same game
code as online play. A downed duo partner can be revived, within `REVIVE_SECONDS`.
## The island
Every match is a new island, generated from the match seed by
[`src/sim/island.gd`](../src/sim/island.gd). The server and every client build it from the
seed alone, and compare `Island.heightmap_hash()`, so terrain is never sent.
- About a kilometre across (`ISLAND_RADIUS_METRES`), in the `WORLD_SIZE_METRES` square,
with open sea all round for the packet ship's approach.
- Elevation bands suit the tide: beach up to `ISLAND_BEACH_TOP`, wet flat marsh up to
`ISLAND_MARSH_TOP`, forest up to `ISLAND_FOREST_TOP`, then highland, and summit ground
from `ISLAND_SUMMIT_BAND`.
- Land rises from the coast over a broad dome, so each tide phase takes a ring of the
island rather than all the low ground at once.
- Two to four summits (`ISLAND_MIN_SUMMITS`, `ISLAND_MAX_SUMMITS`), at least
`ISLAND_SUMMIT_SPACING_METRES` apart and joined by lower ridges. The tallest stands
between `ISLAND_PEAK_MIN` and `ISLAND_PEAK_MAX`, always below `ISLAND_MAX_HEIGHT`, so the
last tide covers it. Late fights happen on several hills, not one.
- The worldgen test sweeps 100 seeds: land covers 30 to 70% of the world, at least two
distinct high points, 85% of land walkable, and no more than 3% of dry land cut off
from the main landmass at the first two sea levels.
`tools/island_map.gd` draws a top-down map of any seed, with a contour at each tide level.
## Tide phases
`TIDE_PHASES` is an ordered list of phases. Each one sets: