Weather
The sky every client shows is one of the level’s time-of-day profiles - the same ones on all three levels - and the server
names it for everyone: SetWeather in a mode, /weather in the chat, [world] weather in
server.toml for the start. A preset is a friendly name for a profile, one per kind of weather; a profile name passes through as
it is, which also admits the profiles the game’s own quests use (q_* names in the level’s mission file). Each client blends a
change in over [world] weather_blend seconds (10 by default) unless the call names its own blend.
| Preset | Profile | What it looks like | Rain | Chance by default |
|---|---|---|---|---|
clear, sunny |
cloudless_sunny |
a clear sky | - | 20 |
fair |
semicloudy_clear |
a few clouds, clear light | - | 25 |
cloudy |
cloudy_no_rain |
overcast without rain | - | 20 |
overcast |
summer_overcast |
a heavy summer sky | - | 12 |
showers, rain |
cloudy_frequent_showers |
clouds and passing rain | 0.5 |
10 |
drizzle, fog |
foggy_drizzly |
fog and a fine rain | 0.25 |
6 |
storm |
foggy_storm |
a storm with rain | 1 |
4 |
dry_storm |
foggy_storm_no_rain |
the storm’s sky without the rain | - | 3 |
The server’s rotation
Section titled “The server’s rotation”"" (an empty name, and the shipped [world] weather) hands the sky to the server’s rotation: every 3 to 5 game hours it rolls
the next sky from the chances - the column above unless the mode set its own with
SetWeatherChances - and every client follows it, so all players stand under the same
sky (each game’s own rotation is switched off), and a player who joins gets the sky up now. The chances are relative weights: with the
column above a storm comes up about one sky in 25. The same sky may come up again and simply stays, so over a long run each kind is up
about its share of the time. /weather auto goes back to the rotation and /weather chances shows the chances in force.
-- a wet autumn: rain most of the time, a storm now and then, each sky for 2 to 4 game hoursSetWeatherChances({cloudy = 20, overcast = 15, showers = 35, drizzle = 20, storm = 10}, 2, 4)The same from a C# game mode, in its OnInit (the C# API: -1 for the
hours keeps the server’s own hold, null chances its own mix):
var chances = new Dictionary<string, double>{ ["cloudy"] = 20, ["overcast"] = 15, ["showers"] = 35, ["drizzle"] = 20, ["storm"] = 10,};if (!api.SetWeatherChances(chances, 2, 4, out var reason)) api.Log($"weather: {reason}");A mode sets its chances at its start or at any time later (a season, an event); until it does, the server rolls the column above. The game modes that come with the server
keep theirs in a WEATHER table at the top of the script, with the default mix in it.
The rain
Section titled “The rain”The rain comes with the profile - the Rain column, the rest stay dry - the same amount on every client.
SetRain (/rain, [world] rain) forces another amount from 0 to 1; -1 hands the rain
back to the weather. GetWeatherPresets returns the presets and their profiles to a
mode.
The variants and the game’s own chances
Section titled “The variants and the game’s own chances”In single player the game rolls its own sky from more profiles: most kinds have a _B (and some a _C) variant - another look of the
same weather, some with rain of their own. A mode may name any of them in SetWeather or as a
key of the chances. The game’s own chance of each, for a mode that wants the single-player mix:
| Profile | Kind | The game’s chance | Rain |
|---|---|---|---|
cloudless_sunny |
clear | 0.2 | - |
cloudless_sunny_B |
clear | 0.4 | - |
semicloudy_clear |
fair | 0.5 | - |
semicloudy_clear_B |
fair | 0.6 | - |
cloudy_no_rain |
cloudy | 0.5 | - |
cloudy_no_rain_B |
cloudy | 0.6 | - |
cloudy_no_rain_C |
cloudy | 0.2 | - |
summer_overcast |
overcast | 0.2 | - |
summer_overcast_B |
overcast | 0.2 | 0.4 |
summer_overcast_C |
overcast | 0.1 | 0.3 |
summer_overcast_B_no_rain |
overcast | 0 | - |
cloudy_frequent_showers |
showers | 0.5 | 0.5 |
cloudy_frequent_showers_B |
showers | 0.5 | 0.8 |
foggy_drizzly |
drizzle | 0.1 | 0.25 |
foggy_drizzly_B |
drizzle | 0 | 0.25 |
foggy_storm |
storm | 0.3 | 1 |
foggy_storm_B |
storm | 0.2 | 1 |
foggy_storm_no_rain |
dry storm | 0 | - |
-- the single player's own mix (the weights only need to be in proportion)SetWeatherChances({ cloudless_sunny = 2, cloudless_sunny_B = 4, semicloudy_clear = 5, semicloudy_clear_B = 6, cloudy_no_rain = 5, cloudy_no_rain_B = 6, cloudy_no_rain_C = 2, summer_overcast = 2, summer_overcast_B = 2, summer_overcast_C = 1, cloudy_frequent_showers = 5, cloudy_frequent_showers_B = 5, foggy_drizzly = 1, foggy_storm = 3, foggy_storm_B = 2,})