spire
The shape of the climb, as pure math. `local S = require("game.spire.spire")`.
spire
The shape of the climb, as pure math. local S = require("game.spire.spire").
The spire is a helix: one basalt stair winding up the outside of a tapering
column of rock from the caldera floor at y = 0 to the rim at L.RIM_HEIGHT.
Treads, ledges, knight spots, fumaroles, lights and the rim are all a point on
that helix plus an offset, so the whole climb is one function and the pieces
cannot drift apart.
The axis leans. It stands out of the lava at +Z, clear of the start
platform and of StartSpawn, and comes back over the world origin by the rim
where RimMarker waits. That is what lets the pilgrim begin at the spire's
foot instead of inside it, and it is why every offset is measured from
axisZAt, never from the world origin.
The helix
S.pathAt(t) | the world point the walking surface passes through at height fraction t, plus its radius from the axis and its angle |
S.stepAt(i) | the same, at tread index i (0 at the floor, S.STEPS at the rim) |
S.headingAt(i) | yaw, slope in degrees, and the horizontal run to the next tread. A tread is yawed onto the heading and pitched by -slope, so its top face is the ramp |
S.offsetPoint(i, out, up) | a point offset from the stair — out away from the axis, up in world-up |
S.axisZAt(y) / S.coreRadiusAt(y) / S.coreTopFor(r) | the leaning axis and the spire's own surface |
S.climbSeconds() | the stair's 3D length over L.WALK_SPEED — the climb the lava is racing |
S.noise(a, b) | deterministic 0..1 hash noise. Every peer builds the same spire from the same indices, so nothing here may be random |
S.TURNS, S.R_BOT, S.R_TOP, S.STEPS, S.CORE_INSET, S.AXIS_Z0,
S.ANG0, S.LEDGE_OFFSET and S.RIM_LEDGE_R are the numbers all of it comes
from; change one and the whole climb moves together.
Where the set pieces stand
S.GATE_STEPS, S.KNIGHT_STEPS and S.FUMAROLE_STEPS are disjoint tread
indices, so a crust gate never shares a tread with a knight or a vent.
S.gateRottenIsOuter(n) says which lane of gate n is the rotten one — it
alternates, so the safe line is never the same line twice running.
Scoped to this part · feeds back into the world's score.