Log inGet started
World

First Light

Branchmain
Branchesmain
Commit5b1bfa8dc1

README.md

firstlight.sky

The sky is the clock. Attached to the scene's sky entity beside its ProceduralSky, this component drives the whole sky from Rules.state.clock every frame:

  • The sun. South at noon, north at midnight, below the horizon every day but the last. The sun light always points away from it, so the ProceduralSky draws the disc, its glow and the moon in the right place; its light arrives only as the disc reaches the horizon on day 30.
  • The moon. A distant light opposite the sun, the blue light on the snow at full night. It fades as the twilight opens.
  • The ambient light rises from the night blue to a paler violet-blue with the twilight.
  • The stars fade as the twilight opens.
  • The twilight band over the southern horizon: a dome round the station wearing firstlight.sky.twilight, fed the sun's direction and Rules.state.clock.twilight. Deep blue and a few degrees tall on day 1, violet then rose at its foot and a third of the sky tall by day 30.
  • The aurora over the sea ice to the north: five arched curtain sheets wearing firstlight.sky.aurora (the installed Carrington curtain shader under this sky's palette). Their strength is Rules.state.weather.aurora, each sheet breathing on its own slow clock through its first instance-data lane, and they drown as the twilight opens.

Everything it hangs under the sky entity is temporary: it is spawned on awake and never saved with the scene.

Fields

FieldDefaultMeaning
auroraOverride-1Aurora strength to use instead of the blackboard's; -1 follows Rules.state.weather.aurora.
twilightGain1.0Gain on the twilight band.
moonlight0.32The moon's light on the snow at full night.
sunlight1.4The sun's light at noon on day 30.

Seeing a moment

From execute, in play:

local Rules = require("firstlight.rules")
Rules.restore((day - 1) * Rules.DAY_SECONDS + t * Rules.DAY_SECONDS)

then capture looking south (+Z) for the twilight and north (-Z) for the aurora. Rules.restore is the call that moves the clock backward as well as forward.