Skip to content

Function: generateBodyConfig()

ts
function generateBodyConfig(seed, constraints): PlanetConfig;

Generate a deterministic PlanetConfig from a seed and zone constraints. The same (seed, constraints) pair always yields the same config, byte-stable across runtimes (the underlying PRNG is integer-only SplitMix32 with FNV-1a-hashed string seed — no floating-point divergence).

Caller-resolved fields are intentionally left undefined on the returned config:

  • liquidColor, bandColors, metallicBands, terrainColorLow/High — derived from chemistry / temperature, owned by caller code.
  • liquidState is set to 'liquid' or 'none' only. Promoting to 'frozen' requires temperature knowledge the lib does not carry; the caller downgrades after this call when its thermal model says so.
  • gasMassFraction, spectralType — outside v1 scope.

Parameters

ParameterTypeDescription
seedstringStable string driving every random draw.
constraintsZoneConstraintsGeneration envelope for the body's zone.

Returns

PlanetConfig

A PlanetConfig with seed-driven physical and visual envelope filled, caller-resolved fields left undefined.

Distribué sous la licence indiquée dans le dépôt.