Ports MapGenerator.GenerateTopography's pass-1 loop (reference ~:553-619 at tag
pre-rewrite-reference / ab78883) into Tools/. Working code and its tuned constants
carried over verbatim, read from source rather than re-derived from a design
summary (D-050). Six elements, in the reference's execution order — the order is
load-bearing: the sinker lands before the Pow (superlinear), the Trench after it
(a raw additive wall), preTrenchFalloff captured between them.
The fractal config is now PINNED. The reference set only NoiseType/Seed/Frequency,
so the island's entire fractal character was Godot 4.7.1 constructor defaults that
nothing recorded. Measured on 4.7.2 (NoiseDefaultsProbe): Fbm / 5 / 0.5 / 2.0 / 0.0
— identical to the 4.7.1 values, so pinning reproduces the look with no delta. The
terrain no longer depends on an engine default, and the probe makes a future drift
visible instead of silent.
Two deliberate departures from the reference's literals, both flagged in-code:
- the latitude noise offset is expressed in map widths, not the reference's raw
+1000 px, so a resize no longer samples a different slice of the noise field
(chat1/00 §4.2). Pinned to 1000/8192 so the 8K realization is unchanged.
- the `if (temperature < 0.65f)` spine gate is dropped as the provable no-op it
is — southernFade already reaches exactly 0 at 0.65. Bit-identical.
The reference's "temperature" is ported as a latitude field and deliberately NOT
named temperature: it is stage-1-local input to terrain geometry, and climate is
stage 3 (D-049 §2, D-056). The ±0.1 wobble is kept — it is what stops the spine's
southern terminus being a ruler-straight line.
Deferred to Phase 2 with the seam open: coast shelf and offshore islets (below-sea,
judged once water renders). Pass1Result exposes PreTrenchFalloff at their exact
consumption point, plus HMaxSeed for the seed-dependent curve.
Render is a direct Godot.Image, not the SubViewport capture path — that machinery
exists to composite vector overlays and is why --headless hangs; Phase 1 has none.
Hypsometric above 0.15, bathymetric below, fixed ramp anchors so seeds and ablation
rungs are comparable. No biome words anywhere.
Verified: land fraction 51.5% identical at 1024, 2048 and 10240 — the scaling
discipline holds across a 10x resize. Full-size 10240 pass: 36.3 s.
No curve, erosion, rivers, water, crater, biomes, roads, or mesher.
51 lines
2.4 KiB
C#
51 lines
2.4 KiB
C#
using System;
|
|
|
|
namespace IslaApocalypse.Tools
|
|
{
|
|
/// <summary>
|
|
/// Shape helpers for the island mask, ported from the reference's
|
|
/// <c>Tools/Scripts/IslandFalloff.cs</c>.
|
|
///
|
|
/// ⚠ ONLY THE PASS-1 PARTS ARE HERE. The reference file also carries the submarine COAST SHELF
|
|
/// (SHELF_STRENGTH / SHELF_SCALE_M / CoastShelf) and the OFFSHORE ISLET layer (OffshoreBlob,
|
|
/// OffshoreZoneWeight, CalibrateThreshold, and their constants). Both are DEFERRED to Phase 2 —
|
|
/// they act on below-sea height and are judged once water renders. They will port into THIS
|
|
/// file, which is why it keeps the reference's name and shape.
|
|
///
|
|
/// This type is pure math and engine-free. It sits in Tools/ rather than Core/ so the pass-1
|
|
/// port stays auditable as one unit against one reference file, and so the deferred Phase-2
|
|
/// halves land beside their siblings rather than in a second location.
|
|
/// </summary>
|
|
public static class IslandFalloff
|
|
{
|
|
/// <summary>
|
|
/// The rounding width of the spine crest, in normalized axis-distance units.
|
|
/// READ from the reference: <c>IslandFalloff.CREST_EPSILON = 0.03f</c> (~:34).
|
|
/// </summary>
|
|
public const float CREST_EPSILON = 0.03f;
|
|
|
|
/// <summary>
|
|
/// A smooth absolute value: zero AT zero, with zero slope there, converging to |d| away from it.
|
|
/// READ from the reference (~:42-46), verbatim:
|
|
/// <code>a = |d|; return a*a / sqrt(a*a + eps*eps);</code>
|
|
///
|
|
/// ═══ WHY IT EXISTS — do not "simplify" it back to Abs ═══
|
|
///
|
|
/// The spine's ridge axis is the line x = centre, and a plain <c>1 - |x - cx|</c> peaks there
|
|
/// with a SLOPE DISCONTINUITY. On real terrain that put the four columns at the centre axis
|
|
/// in the top four slope-step locations out of 5,999 — a visible crease running the whole
|
|
/// height of the island, measured at ~170x the off-axis controls. It was blamed on the
|
|
/// falloff blend for a long time; transect measurement ruled that out and found this.
|
|
///
|
|
/// SmoothAbs(0) = 0, so the crest keeps its FULL HEIGHT — it rounds without dropping.
|
|
/// Measured on the reference: the 1-px kink fell 99.3%, the centre column dropped from
|
|
/// rank 1 of 5,999 to rank 1,364, and nothing anywhere was lowered.
|
|
/// → `Design - Terrain - Mountain Spine.md`.
|
|
/// </summary>
|
|
public static float SmoothAbs(float d, float epsilon)
|
|
{
|
|
float a = Math.Abs(d);
|
|
return a * a / MathF.Sqrt(a * a + epsilon * epsilon);
|
|
}
|
|
}
|
|
}
|