Starbound

Starbound

Not enough ratings
Modding: Weather Guide
By Ceterai
This guide will tell you how to create and customize weather conditions.
WEBSITE[ceterai.github.io] | SUPPORT ME[buymeacoffee.com]
   
Award
Favorite
Favorited
Unfavorite
Preface
This guide assumes you have your game assets unpacked. If you don't, checkout the "Useful links" section of this guide.

Other helpful info

Difference between effects, status effects (statuses), particles and projectiles:
  • particle (assets/particles) - small graphical image or .particle configuration that acts as a particle;
  • projectile (assets/projectiles) - small object with physics able to emit particles, deal damage, emit light, spawn blocks/liquids and apply status effects;
  • effect (assets/effects) - a particle emitter with its own duration. Can loop and play sounds;
  • status effect (assets/stats/effects) - a status, which can be applied to an entity to modify its parameters add effects, or block other statuses. Here's more information[starbounder.org] on those.
What is Weather
Weather is a state of a planet in which the planet can:
  • spawn projectiles and particles;
  • apply status effects on entities (including players);
  • deal damage;
  • play sounds.

Examples:
  • rain - spawns rain particles, applies "wet" status effect, spawns "lightwater" projectiles which leave water on contact with surface;
  • clear - no particles, projectiles or status effects.

While you're on a planet, current weather will change from time to time to a random weather, listed in a weather pool, used by the primary biome of this planet.

Weather pool is basically a list of possible weathers to appear and their probabilities.
A biome can have a list of possible weather pools to choose from.

Weather pool example:
"garden" : [ [0.05, "rain"], [0.025, "storm"], [0.0125, "glowingrain"], [0.0625, "drizzle"], [0.85, "clear"] ],

Note: weather can only appear on open surfaces and I don't know if there is a way to make it spawn underground.
Note: since weather is defined by primary biomes of planets, a lot of default surface and all default underground Starbound biomes don't use any weather pools.
Creating new weather
For the sake of this guide let's call our weather my_weather.

Weather objects are stored in .weather json files.
So, to create your own weather, create a .weather file and open it.
{ "name" : "my_weather", "particles" : [ { "density" : 0.05, "autoRotate" : true, "particle" : { "type" : "textured", "image" : "/particles/rain/1.png", "velocity" : [0, -35.5], "approach" : [15, 15], "angularVelocity" : 0, "timeToLive" : 20, "destructionAction" : "Image", "destructionTime" : 0.1, "destructionImage" : "/particles/splash/1.png", "collidesForeground" : true, "collidesLiquid" : true, "ignoreWind" : false } }, { "density" : 0.15, "particle" : { "type" : "ember", "color" : [212, 219, 247], "size" : 1.0, "velocity" : [0, -12], "timeToLive" : 20, "collidesForeground" : true, "collidesLiquid" : true, "ignoreWind" : false } } ], "projectiles" : [ { "projectile" : "lightwater", "parameters" : { "power" : 0 }, "velocity" : [0, -100], "ratePerX" : 0.1, "spawnAboveRegion" : 30, "spawnHorizontalPad" : 10, "windAffectAmount" : 1 } ], "statusEffects" : ["wet"], "duration" : [40, 100], "maximumWind" : 15.0, "weatherNoises" : [ "/sfx/weather/rain_medium.ogg" ] }

Let's see what is happening here.
Variable
Description
name
The technical name of your weather. In our case it is my_weather. Keep in mind that this is NOT the name you will see in the game.
particles
List of particles that can spawn during this weather. Note that you can either config each particle here or in .particle files.
projectiles
List of projectiles goes here.
statusEffects
List of status effects that will apply to you (and anyone else) each tick while you (or anyone else) are in direct contact with the weather.
duration
Range of time the weather can last before changing to a different weather (in seconds).
maximumWind
Affects particles and projectiles that were configured to be affected by wind. More about the wind mechanic.[starbounder.org]
weatherNoises
List of ambient sound tracks that can play in the background during the weather.

Note: you can find default Starbound weather files on this path: assets/weather (if you have unpacked assets).

That's not everything! Now we need to make it so your weather has an icon and a readable name in the game, when it shows under the planet description!
To do that, we need to patch the cockpit.config file.

Note: if you don't know what JSON patching is, checkout the "Useful links" section of this guide.

Here's the code we would need to put in our patch file:
[ { "op":"add", "path":"/displayWeathers/my_weather", "value":{ "displayName" : "My ^#dc282d;Very^reset; Cool Weather", "icon" : "/interface/cockpit/weather/rain.png" } } ]

You can change the icon variable to any icon you want, I used rain weather icon as an example.
Adding weather to your planet
Let's say you have a planet called my_planet and its primary biome is a biome called my_biome.

Note: if you want to find out how to set your biome as primary biome of your planet, or how to make planets and biomes in general, checkout the "Useful links" section of this guide.

To start adding weather, we need to create a weather pool your weather will be a part of. It can also be the only weather in your weather pool, if you want. Also, your weather can be a part of multiple weather pools at the same time.
To create a new weather pool, we need to patch the weather.config file.

Note: if you don't know what JSON patching is, checkout the "Useful links" section of this guide.

This is the code you need if you want to create a weather pool called my_weather_pool with only my_weather in it:
[ { "op" : "add", "path" : "/my_weather_pool", "value" : [ [1.0, "my_weather"] ] } ]
Or with different weather objects:
[ { "op" : "add", "path" : "/my_weather_pool", "value" : [ [0.25, "my_weather"], [0.4, "my_other_weather"], [0.35, "rain"] ] } ]

Now, to add this weather pool to your biome, open the .biome file of my_biome.
Here, look for a "weather" variable. If there isn't one, create it and give it this value (if you only want my_weather_pool to be in it):
"weather" : [ [0, [ "/weather.config:my_weather_pool" ]] ],

There you go! That's basically it.
Editing existing weather, weather pools, etc
This section relies heavily on JSON patching. If you don't know what it is or how it works, checkout the "Useful links" section of this guide.

Editing weather
Since weather is stored in .weather files, to edit weather from original game (or from a mod) we would need to create a .patch file with the correct relative path, so if we want to edit rain, we need to create a your_mod/weather/rain/rain.weather.patch.

Editing weather icon and readable name
If you want to edit weather icon and name displayed in the cockpit - you should patch the packed/interface/cockpit/cockpit.config file, specifically the displayWeathers/your_weather_name keys.

Editing weather pool
Here you should patch the assets/weather.config file, specifically /your_weather_name.

Editing weather list of an existing biome
Since biomes are stored in .biome files, create a .patch file with the correct relative path and edit the /weather key. It's your choice whether to replace the original weather pool or add your own as an option, but depending on what you choose you might want to choose different patching operations.
Conclusion
That is all I can share with you on this topic. I will expand it if I find/learn more about it.
Please let me know if I forgot or mixed up anything.
Thank you for reading!
3 Comments
BΛBES 26 Jan, 2024 @ 2:49am 
Is it me or manipulating wind parameter does absolutely nothing?
Bliko 25 Nov, 2022 @ 2:25pm 
You saved my life thank you, I was just wondering if I could find anything that would help me make weather specifically :stella_hearts:
CloakNDagger 15 Jan, 2022 @ 5:35pm 
You know, I've never checked to see if it's been done, but I wonder if anyone will make a mod for 'Raining Cats & Dogs'?