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
@@ -49,6 +49,29 @@ const CROUCH_HEIGHT: float = 1.2
const FALL_DAMAGE_SAFE_METRES: float = 6.0
const FALL_DAMAGE_PER_METRE: float = 8.0
# The island. Worldgen fills the whole world square; the island is about a kilometre
# across, sized for 24 players. Heights are metres above the starting sea level.
## Spacing of the terrain heightfield, in metres. The grid covers WORLD_SIZE_METRES.
const ISLAND_GRID_METRES: float = 2.0
## Mean distance from the world centre to the coast, before the coastline is warped.
const ISLAND_RADIUS_METRES: float = 400.0
const ISLAND_MIN_SUMMITS: int = 2
const ISLAND_MAX_SUMMITS: int = 4
## Summits are at least this far apart, so each one is a separate fight.
const ISLAND_SUMMIT_SPACING_METRES: float = 220.0
## The tallest summit lands between these heights. Both stay under ISLAND_MAX_HEIGHT.
const ISLAND_PEAK_MIN: float = 58.0
const ISLAND_PEAK_MAX: float = 67.0
## The open sea floor, in metres below the starting sea.
const ISLAND_SEA_DEPTH: float = 12.0
## Elevation bands, by height above the starting sea. Marsh is wet flat ground below
## ISLAND_MARSH_TOP; land from there up to ISLAND_FOREST_TOP is forest, then highland,
## and anything at or above ISLAND_SUMMIT_BAND is summit ground.
const ISLAND_BEACH_TOP: float = 2.5
const ISLAND_MARSH_TOP: float = 7.0
const ISLAND_FOREST_TOP: float = 32.0
const ISLAND_SUMMIT_BAND: float = 50.0
# The tide. `hold` and `rise` are seconds, `level` is metres above the starting sea,
# `drown_dps` is damage per second underwater once breath runs out. The last level
# must exceed ISLAND_MAX_HEIGHT, so that every match ends.