Log inGet started
World

First Light

Branchmain
Branchesmain
Commit5b1bfa8dc1

README.md

firstlight.weather

The weather of First Light. The scene attaches it to the Weather entity; from there it reads the clock and the run's forecast seed and, every frame, writes Rules.state.weather and puts the weather into the world:

  • Snowfall — a particle column around the player's eye whose flakes drift at the wind's own speed and stretch along their path, so calm air holds slow dots and a blizzard holds horizontal streaks.
  • Fog — the scene's height fog, closing from the horizon at calm to a few paces in a blizzard, and a dome that closes the sky by the same optical depth, so a whiteout is a whiteout overhead too.
  • Spindrift — the snow plain's spindrift_gain, spindrift_speed and sparkle_gain follow the wind: loose snow tears downwind across the crust as the storm rises, and the ice glint dies in it.
  • Sound — the wind and howl loops, crossfading with the storm. The wind is a breath at calm and full in a storm; the howl is silent below the storm band and full in a blizzard.
  • Events — Rules.events.emit("storm", { storm, band, windMs }) whenever the band changes.

The blackboard

Rules.state.weather carries storm (0..1), band (calm, wind, storm or blizzard), windMs, windDir (radians, the direction the wind blows toward), visibilityM, airC, chillC, snowing (0..1) and aurora (0..1). The body slice reads chillC; the sky slice reads aurora; the HUD reads windMs and asks firstlight.forecast for tomorrow.

Fields

fieldmeaning
forceStorm-1 follows the forecast; a value in [0, 1] holds the storm there. For tests and cutscenes; leave it at -1.
snowDensityScale on the snowfall's particle rate.

comp:setForce(storm) sets forceStorm; comp:current() returns the blackboard section, which is where the shown weather is read from.

The shown storm eases toward its target rather than jumping, so a forced value takes a few seconds to arrive and the forecast's own changes roll in over minutes.

What it owns in the scene

Four temporary children under Weather, spawned at runtime and left out of the scene's record: wx_snowfall (the emitter), wx_wind and wx_howl (the loops), wx_shroud (the sky dome, drawn with firstlight.weather.shroud).