Class SceneCaveWater
What lives on and in a cave's still water as every client draws it (2026-10-26, phase I2n-c; decision 86 (i) and its leeches, decision 97): marsh-gas BEADS rising in trails from the drowned muck and ringing out on the surface, and LEECHES swimming in it, toward whoever wades in. Pure; FishCaveWaterLife.shader mirrors it number for number (CaveWaterLife draws it).
public static class SceneCaveWater
- Inheritance
-
SceneCaveWater
- Inherited Members
Remarks
The beads are the shared clock's. A pool's vents are hashed from its surface's position (to the centimetre: every client loads the same cave-life spot), each releasing a burst of beads every Periods seconds (each period a whole number of cycles in the motion clock's Wrap, so a trail never jumps when it wraps), a burst kept or skipped by its own hash: every player sees the same bead break the surface at the same moment.
The leeches are each viewer's. At rest a leech's slow circuit of its pool is the clock's as the beads are; how far it has turned toward a wader is a presentation each client eases on its own (Attract(float, bool, float)): nothing on the wire, no damage, nothing anyone else sees moves (decision 97: viewer-reactive effects only as per-viewer presentation).
Fields
AttractSeconds
The seconds a viewer's pull takes to come in full while someone wades, and to die away after.
public const float AttractSeconds = 6
Field Value
BeadSpacing
Seconds between a burst's beads, metres a second a bead rises at least (and up to BeadSpeedSpread more).
public const float BeadSpacing = 0.35
Field Value
BeadSpeed
Seconds between a burst's beads, metres a second a bead rises at least (and up to BeadSpeedSpread more).
public const float BeadSpeed = 0.24
Field Value
BeadSpeedSpread
Seconds between a burst's beads, metres a second a bead rises at least (and up to BeadSpeedSpread more).
public const float BeadSpeedSpread = 0.1
Field Value
BeadsPerBurst
The most vents a pool has, beads in a burst, leeches in a pool.
public const int BeadsPerBurst = 4
Field Value
MaxLeeches
The most vents a pool has, beads in a burst, leeches in a pool.
public const int MaxLeeches = 6
Field Value
MaxVents
The most vents a pool has, beads in a burst, leeches in a pool.
public const int MaxVents = 6
Field Value
MostDepth
The deepest water a bead rises through, metres (a pool's depth is clamped to it; a burst's life stays under its period).
public const float MostDepth = 2
Field Value
Periods
A vent's burst periods, seconds (each divides Wrap; each longer than a burst's life at the deepest pool).
public static readonly float[] Periods
Field Value
- float[]
ReleaseSeconds
The seconds a viewer's pull takes to come in full while someone wades, and to die away after.
public const float ReleaseSeconds = 3
Field Value
RingSeconds
How long a bead's ring shows once it breaks the surface, and how fast it spreads (s, m/s).
public const float RingSeconds = 1.2
Field Value
RingSpeed
How long a bead's ring shows once it breaks the surface, and how fast it spreads (s, m/s).
public const float RingSpeed = 0.3
Field Value
Wrap
The motion clock's wrap, seconds (every rate here a whole number of cycles in it).
public const float Wrap = 10000
Field Value
Methods
Attract(float, bool, float)
A viewer's pull a frame on (its own presentation, eased: in over AttractSeconds, out over ReleaseSeconds).
public static float Attract(float previous, bool wading, float dt)
Parameters
Returns
Bead(float, uint, int, int, float, float, out float, out float)
One bead of a vent at a moment of the wrapped clock t (0..Wrap): false when none is out
(between bursts, a skipped burst, or its ring gone); else how far over the bed it has risen (rise, metres,
at most depth) and, once it has broken the surface, its ring's age (ringAge, seconds; −1
while it rises). A burst is kept at the pool's bead weight (bubbles, at most every burst).
public static bool Bead(float t, uint seed, int vent, int bead, float depth, float bubbles, out float rise, out float ringAge)
Parameters
Returns
Hash(uint, uint, uint)
public static uint Hash(uint seed, uint a, uint b)
Parameters
Returns
LeechAt(Vector3, Vector3, float, uint, int, Vector3, float)
Where a drawn leech is: from its home (LeechHome(float, uint, int, Vector3, float, float)) toward its place about a wader's feet as the viewer's pull
attract (0..1, Attract(float, bool, float)) grows, each leech late by its own share (the near ones first).
public static Vector3 LeechAt(Vector3 home, Vector3 feet, float attract, uint seed, int leech, Vector3 surface, float depth)
Parameters
Returns
- Vector3
LeechHome(float, uint, int, Vector3, float, float)
A leech at rest at a moment of the wrapped clock: a slow circuit of its pool (a whole number of turns in Wrap, 30–90 a wrap, either way round), at its own share of the radius and its own depth in the water, a little rise and fall on it.
public static Vector3 LeechHome(float t, uint seed, int leech, Vector3 surface, float radius, float depth)
Parameters
Returns
- Vector3
LeechesOf(float, float)
A pool's leeches at a biome's leech weight: about one a 2 m² of water, at least one where any swim, at most MaxLeeches.
public static int LeechesOf(float leeches, float radius)
Parameters
Returns
Mix(uint)
lowbias32.
public static uint Mix(uint x)
Parameters
xuint
Returns
PeriodOf(uint, int)
A vent's burst period, seconds (one of Periods).
public static float PeriodOf(uint seed, int vent)
Parameters
Returns
SeedOf(Vector3)
A pool's seed from its surface's position (to the centimetre).
public static uint SeedOf(Vector3 surface)
Parameters
surfaceVector3
Returns
Unit(uint)
A hash's 0..1 (its top 24 bits: exact in a float, as the shader's).
public static float Unit(uint h)
Parameters
huint
Returns
VentOffset(uint, int, float)
Where a vent stands in its pool, as an offset from the surface's middle (within 0.85 of its radius).
public static Vector2 VentOffset(uint seed, int vent, float radius)
Parameters
Returns
- Vector2
VentsOf(float, float)
A pool's vents at a biome's bead weight: about one a 3 m² of water, at least one where it beads, at most MaxVents.
public static int VentsOf(float bubbles, float radius)
Parameters
Returns
Wades(Vector3, Vector3, float, float)
Whether feet stand in a pool: within its rim (and a stride past it) and under its surface, over its bed.
public static bool Wades(Vector3 feet, Vector3 surface, float radius, float depth)