CryptSky
The Spooky Spook Spook night sky. It is attached to the scene entity **"Sky"** in `scenes/main.scene` and builds everything it needs as children of that entity. Each child is marked `setTemporary(true)`, so none of them is saved into the scene.
CryptSky
The Spooky Spook Spook night sky. It is attached to the scene entity "Sky" in scenes/main.scene and builds everything it needs as children of that entity. Each child is marked setTemporary(true), so none of them is saved into the scene.
| Child | Built | What it is |
|---|---|---|
crypt_sky_dome | awake (edit and play) | A Skybox over game.sky.crypt_sky_mat, the animated sky-domain shader game.sky.crypt_sky (see its README): a violet-black gradient, an ecto-green and candle-amber horizon glow, twinkling stars, a cratered moon with a halo and a green ring toward R.MOON_DIR, aurora wisps, mist bands and lightning. |
volumetric_sky | first update (play only) | The engine's VolumetricSky: real raymarched v4 clouds, configured through Sky.configure as a ragged moonlit storm. The engine's depth-aware cloud layer composites them over the sky and behind arena geometry. |
lightning_flash | first update | A wide, far point light (radius 260 m, no shadows). It sits at 0 intensity except during a strike. |
The cloud layer only exists in play, because VolumetricSky.update only runs there. Edit mode shows the shader sky alone.
Cloud setup
- Moon as the sun:
sunDirisR.MOON_DIRnormalised.sunColoris a cold pale blue.sunIntensityismoonLightIntensity(1.6). - Colours: dark violet zenith and horizon, plus a faint ecto-green
groundColorthat gives the cloud bellies a sickly underglow. - Coverage:
coverageis 0.40, with detail erosion 0.38, so the cover is ragged with gaps the moon peeks through. - Wind:
windSpeedis {0.07, 0, 0.04}, a visible drift. - Altitude: the layer spans
cloudBase..cloudTop, 240 to 640 m. That is far above the arena (radius 36, hills of about 30 to 60 m). - Quality: conservative on purpose.
cloudSize128,cloudHeight64,maxSteps96,shadowSteps4,stepSize9,noiseRegenRate5.
Lightning
Every lightningMinGap..lightningMaxGap seconds a strike fires two to four flickers. Each flicker raises three things together:
- the shader's
lightning,flash_dirandflash_seedproperties (a sheet glow plus a jagged bolt low on the skyline), - the cloud preset's
sunIntensity(+9 x level), - the
lightning_flashlight, moved toward the strike.
0.6 to 1.8 s later it calls R.call("playSound", "thunder", nil, { volume = thunderVolume }). The clip is game/sky/thunder.soundClip. If GameAudio does not know a thunder clip, the call does nothing.
Public fields
clouds: boolean(true): whether play mode raises the volumetric cloud layer.lightningEnabled: boolean(true): whether random strikes happen.lightningMinGap: number(9) andlightningMaxGap: number(24): the seconds between strikes.thunderVolume: number(0.55): thunder volume, 0..1.moonLightIntensity: number(1.6): the moon's intensity as the cloud layer's sun.coverage: number(0.40): the cloud coverage threshold. Higher values leave bigger gaps.cloudBase: number(240) andcloudTop: number(640): the altitude of the cloud layer in metres.
Fields are read when the clouds are built, at the start of play.
Methods
:strike()fires a lightning strike now.
Lifecycle
awake()points the material'smoon_diratR.MOON_DIRand spawns the sky dome.start()rebuilds the dome if it is missing.update(dt)spawns the clouds and the flash light on the first tick, then schedules and animates lightning.onDestroy()despawns its children and resets the shader'slightningto 0.
Usage
local sky = entity.find("Sky").component.get("CryptSky")
sky:strike()
Scoped to this part · feeds back into the world's score.