islaApocalypse/Core/Scripts
beezm 566abe9784 feat: submarine coast shelf + elongation dials (terrain-water task 11)
COAST. The task's premise -- "the island edge is the steepest part" -- is
right, and the diagnostic locates it precisely: it is the SEABED, not the
land. HeightCurve.Apply returns early at and below sea level, so tasks
05-09 reshaped the land and never touched the water. Measured on the same
seed, distance-from-shore vs height:

                       land reaches 10 m   seabed reaches 10 m   gradient
  curve OFF                   31 px               31 px       0.254/0.258
  curve ON (ships)           186 px               31 px       0.038/0.258

So the landward side is ALREADY the broad shallow shelf terrain_design.md
asks for -- 54% of the island sits under 14 m -- and flattening it further
would only make it mushy. What is left is a shoreline that shelves gently
on land and then drops 6.7x steeper the moment it goes under.

CoastShelf fixes that side: depth' = depth * (1 - 0.775*exp(-depth/100 m)).
The seabed leaves the waterline at 22.5% of its former gradient and
recovers smoothly, so deep water and the Trench keep their shape. Measured
after: 5 m depth at 43 px (was 15), 10 m at 75 (was 31), 30 m at 150 (was
94) -- a 2.4-2.9x wider shallows.

It is strictly positive for positive depth, so it CANNOT move the waterline
by one pixel. Biomes and water bodies come out bit-identical, which is why
the coast is separable from elongation in the batch rather than tangled
with it -- contrary to the task's expectation that all coast work moves
biomes.

ELONGATION. IslandAxisX/Y replace the 1.15/0.90 literals (the spine shares
AxisX, as it always shared the literal). Sized by replaying candidate
falloffs against real terrain rather than guessing -- the replay reproduces
the shipped extents exactly, bbox and land count.

That replay says the task's suggested 1.30/0.85 buys +2.0% aspect, because
THE ISLAND IS ALREADY TRENCH-CLAMPED IN X: it spans 90.5% of the map width,
and 1.15 -> 1.40 moves the west coast only 393 -> ~360 px. Aspect responds
almost entirely to AxisY, which costs land:

  1.30/0.85  +2.0% aspect  +2.9% land      1.30/0.80  +4.9%  -2.2%
  1.30/0.82  +3.7% aspect  -0.1% land      1.30/0.75 +11.5%  -7.3%

Default 1.30/0.78 -- a visible step (+~8% aspect, measured 1.137 -> 1.200)
at ~4% land. The developer's eye tunes it from the batch; the table above
is the price list.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08 23:29:49 -04:00
..
BiomePalette.cs roads: enable Rugged+Trail carving + per-tier character (D-022) 2026-08-05 03:53:32 -04:00
BiomePalette.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
BlockData.cs baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
BlockData.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
BlockRegistry.cs baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
BlockRegistry.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
BLUEPRINT_FORMAT.md docs: TDTL v2 body, shelf-edge variation, erosion deferred (terrain-water task 10) 2026-08-08 20:55:39 -04:00
BlueprintFormat.cs revert: the D8 drainage incision, whole (terrain-water task 10) 2026-08-08 20:30:44 -04:00
BlueprintFormat.cs.uid chore: Godot .uid files for the new task-02 scripts 2026-08-07 00:17:46 -04:00
BlueprintWriter.cs feat: shelf-edge variation -- the red-line scalloping (terrain-water task 10) 2026-08-08 20:31:41 -04:00
BlueprintWriter.cs.uid chore: Godot .uid files for the new task-02 scripts 2026-08-07 00:17:46 -04:00
ChunkData.cs roads: enable Rugged+Trail carving + per-tier character (D-022) 2026-08-05 03:53:32 -04:00
ChunkData.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
ConfigManager.cs feat: submarine coast shelf + elongation dials (terrain-water task 11) 2026-08-08 23:29:49 -04:00
ConfigManager.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
Constants.cs roads: enable Rugged+Trail carving + per-tier character (D-022) 2026-08-05 03:53:32 -04:00
Constants.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
Enums.cs roads: enable Rugged+Trail carving + per-tier character (D-022) 2026-08-05 03:53:32 -04:00
Enums.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
MapDataParser.cs feat: shelf-edge variation -- the red-line scalloping (terrain-water task 10) 2026-08-08 20:31:41 -04:00
MapDataParser.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
MarchingCubes.cs roads: enable Rugged+Trail carving + per-tier character (D-022) 2026-08-05 03:53:32 -04:00
MarchingCubes.cs.uid baseline: working salvaged prototype on Godot 4.7.1 (pre-F1) 2026-08-05 01:45:41 -04:00
MATH_MARCHING_CUBES.md docs: fix MATH_MARCHING_CUBES §4 polarity + dims 2026-08-05 21:32:51 -04:00
README.md docs: water sections (WBID/WBTB/WSRF), no-BSIN rationale, SkipRoads + water stage in READMEs (terrain-water task 03) 2026-08-07 01:40:48 -04:00

/Core/Scripts

Pure C# data structures, shared enums, and static maths. Compiled into the shared assembly used by both /Server and /Client.

"Pure data, zero state." These scripts define what things are and how to calculate them. They never track live game events — who is online, which chunks are loaded, what time it is.

What's actually here

Voxel materials

  • BlockData.cs — struct describing one block type (ID, name, IsSolid, BaseColor).
  • BlockRegistry.cs — the byte-ID master list (AIR 0, BEDROCK, STONE, DIRT, SAND, the three grasses, SNOW, WASTELAND_DIRT, ASPHALT) with a safe GetBlock lookup.
  • BiomePalette.cs — decides which material sits where, given biome, depth, and whether the column is roadbed. Two paths on purpose: an integer classification that decides what is stored in each voxel, and a float-depth version used for rendering that returns the two materials either side of a boundary so colours fade rather than snap.

⚠ Note that BlockRegistry and the mesher's colour table hold different RGB values for some blocks. The mesher's table is what you actually see; BlockData.BaseColor is currently unused by rendering.

Shared identifiers

  • Enums.csBiome, TownTier, MapHalf, RoadTier.

    Biome and TownTier are the .dat wire format (u8 in the v2 container, i32 in legacy v1). They are declared without explicit values, so each member's ordinal is the number written to disk. Append only, at the end — never reorder or insert. The v2 reader range-checks ordinals so drift fails loudly at parse time, but only the append-only rule keeps old files meaning the same thing. Legacy v1 has no gate and no validation at all. RoadTier is exempt: road tiers live in separate sections of the file, so it is never serialized.

World data

  • BLUEPRINT_FORMAT.md — the byte-accurate .dat container contract (v2 tagged sections + the v1 legacy summary). Read this before touching the writer or parser.
  • BlueprintFormat.cs — the single registry of v2 constants: magic, version gate, section tags (FourCC), validation bounds, re-encode sentinels.
  • BlueprintWriter.cs — writes a WorldBlueprint as a v2 file. Blueprint-typed on purpose: the map generator and the round-trip harness are both just callers.
  • MapDataParser.cs — decodes a .dat blueprint into a WorldBlueprint (heightmap, biome map, towns, four road tiers, and — v2 only — the embedded generation params, per-town highway-node flag, and the optional water-bodies data: WaterBodyIds, WaterBodies table, WaterSurfaceQ). Dispatches on the first byte: v2 tagged-section files get validation (version gate, size bounds, section-length and ordinal range checks); legacy v1 files still load, intact, with a deprecation warning. Nothing at runtime consumes the water data yet.
  • ChunkData.cs — one chunk's density and block-ID fields, +1 padded on every axis so the mesher can reach into the neighbouring chunk, plus the per-column data the renderer needs.
  • Constants.cs — chunk dimensions, ISO_LEVEL, VOXEL_SCALE, and the visual/road tunables (material blend band; per-tier road width, shoulder, grade smoothing and surface).

Maths

  • MarchingCubes.cs — density field → ArrayMesh, with analytical normals and deterministic integer-keyed vertex welding.
  • MATH_MARCHING_CUBES.md — an explainer of the algorithm.

Rules

  1. No Godot node inheritance. Pure classes, structs and statics.
  2. No _Process / _Ready. Nothing here is attached to a live scene object.
  3. Dependencies flow inward only. /Server and /Client reference /Core; /Core never references them.