Log inGet started
World

Tidewater: Oceans, Lakes, Rivers, Waterfalls, Swimming and Splashes Water Kit

Branchmain
Commit431c1b9967

README.md

Cloudburst — rain, snow, storms and fog

Weather that reads as weather. Rain you can feel: soft, slightly see-through drops lit by your sky, sun and street lamps, streaking as they fall and as you move, thick around you and thinning into grey curtains in the distance. The world answers it: drops splash on the street and on the roofs, ring the pond and the puddles, drip from eaves and branches, and the ground darkens and shines as hard as it rains — while under a roof it stays bone dry. Snow tumbles and settles on what faces up, wind leans everything and gusts come and go, fog lies in the valley, and thunderstorms flash and rumble, with thunder arriving later the further away the strike. Every player sees the same weather, the same strike at the same moment, the same change from clear to storm and back — including someone who joins in the middle of it.

Make it rain in two minutes

  1. Install Cloudburst from ZeroMind into your world.

  2. Add the weather to your scene (in build.luau, or once from the console):

    local w = entity.spawnSynced("Weather")
    w.component.add("Cloudburst", { preset = "light_spring_rain" })
    
  3. Press play. That's rain.

Change one field to change the weather: preset = "night_storm_town". Any single setting works the same while a preset runs: set rainLook = "pixel" (or snowLook, lightning, splash, fogBank, kind, wind...) and the weather keeps everything else the preset had and changes just that, live, for every player. Or clear preset and pick a kind (clear, cloudy, drizzle, rain, downpour, thunderstorm, snow, sleet, hail, wind, fog, mist) with one intensity dial from 0 to 1. Changes fade in over changeSeconds. A name the kit does not know is warned about once and falls back to clear.

From code, any player:

local Weather = require("cloudburst.weather")
Weather.preset("night_storm_town", 30)            -- fade into a storm over 30 s
Weather.set({ kind = "snow", intensity = 0.8, snowLook = "fluffy" })
Weather.cycle({ { "clear_day", 3 }, { "steady_rain", 2 }, { "night_storm_town", 4 } })

What's in it

Kindsclear, cloudy (overcast), drizzle, rain, downpour, thunderstorm, snow, sleet, hail, wind (wind and gusts), fog, mist
Rain looksrealistic, cinematic heavy (glints round lamps), soft painterly, cartoon, pixel, ink / woodblock
Snow lookssoft realistic, big fluffy cartoon, fine powdery blizzard, pixel
Lightningstorm (forked + in-cloud), close forked strike, flash inside the clouds, distant silent heat lightning
Splashesrealistic crown, misty spray, cartoon, pixel, ink, none
Fog banksvalley fog, ground mist, sea fog, town haze — as the weather's own fog, and as the FogBank component to place a bank where you want it
Watercb_pond and cb_puddle materials that ring where drops land; Weather.bind(material)
Presets (23)clear_day, light_spring_rain, steady_rain, autumn_drizzle, tropical_downpour, night_storm_town, noir_rain, hailstorm, sleet_squall, alpine_snow, blizzard, misty_dawn, valley_fog, sea_fog, town_haze, gale, summer_heat_lightning, painted_showers, cartoon_rain, cartoon_snow, pixel_rain, pixel_snow, woodblock_rain

Every preset is the same handful of settings, so swapping one for another is one change.

How it works (and why it is cheap)

  • All falling weather lives on the GPU. Each layer is a static mesh of quads whose motion is in its shader; per drop there is no CPU work at all. A downpour costs the same CPU as a drizzle.
  • The engine's own weather does the surfaces. Wetness, settled snow and dry ground under cover come from @builtin::systems.weather; fog from the engine's height fog; wind from the engine's Wind (so foliage and physics lean with the rain). Cloudburst does not keep a second copy.
  • The landing map (cloudburst.landing) is the one piece the engine lacked: the height of the top surface a drop meets coming down, cast around the camera a few rows a frame. Drops stop on roofs (none indoors), splashes sit on what they hit, and drips are found at every eave.
  • Multiplayer: the weather is a few synced fields plus the shared session clock. Lightning comes from a seeded schedule on that clock. Nothing streams per frame.
  • Flash safety: at most one lightning flash every 2.6 s, each a single soft pulse with capped brightness. Weather.setFlashComfort(0..1) lowers it further per player.

For other kits

  • Weather.now() — the weather this frame (rain, snow, wind, fog… 0-1, wetness, wind vector).
  • Named values, for kits that should not depend on Cloudburst: every frame the weather entity holds weather.rain, weather.snow, weather.wetness (0-1) and weather.wind (vector, m/s). values.get(id, "weather.rain") on any entity values.entities() lists reads it; a water kit rings its lakes and puddles from it (Tidewater does), with no require of Cloudburst.
  • Weather.onStrike(fn) — every lightning strike, on every peer at once.
  • Weather.landsAt(x, z), Weather.isSheltered({x,y,z}), Weather.landings(centre, r, dt) — where rain lands.
  • #include "cloudburst.shaderModules.cb_common" and cb_ripples(...) in your water shader; Weather.bind(material) keeps its cb_rain input current. cb_pond / cb_puddle are ready-made.

Guides inside

  • How to make it rain in my game — adding weather, picking a kind, changing it over time, presets, shelter, sound, multiplayer.
  • Example: a village from dusk into a night storm — step by step from an empty world.

Works with

worldClockKit (day/night and lamps) — turn its own precipitation, lightning and sound off and Cloudburst does the weather; storms dim whatever sun it sets. Cloudburst needs no clock kit.