Start exploring

Become a Space Engineer

Start Creating
Space engineer pointing

Modding Guide: Automatic Weather System

(created by Jakaria)

You can download an example mod here, open the Triton.sbc and use the find function (Ctrl-F) to find “Weather”
You should see this:

Weather Frequency

Each planet has its own frequency of weather. It is determined by the <WeatherFrequencyMin> and <WeatherFrequencyMax> variables. Every time the planets “weather counter” reaches a random range selected, the counter will reset and create at all players on said planet. There is also a <GlobalWeather> variable, this determines if the weather created will encompass the entire planet instead of localized weather. It’s a good alternative for small moons that all use a single biome, they do not use voxels.

<WeatherFrequencyMin>20</WeatherFrequencyMin>
<WeatherFrequencyMax>180</WeatherFrequencyMax>
<GlobalWeather>false</GlobalWeather>

All counting values are in time spans of seconds, in the example above this means a weather will be created every 20-180 seconds if there is not one already existing at the player’s position.

Weather Generators

In each planet definition, there is a list called “WeatherGenerators”, this is where you will define which voxel will create what weather effect. A WeatherGenerator contains a Voxel’s MaterialTypeName and a list of possible weathers for that voxel.

<WeatherGenerators>
    <WeatherGenerator>
        abc
    </WeatherGenerator>
    <WeatherGenerator>
        xyz
    </WeatherGenerator>
<WeatherGenerators>

Inside the Generator

A weather generator needs a voxel’s MaterialTypeName to function, the MaterialTypeName is used instead of the voxel’s SubTypeId to help prevent excessively long text files. You can think of MaterialTypeName’s as a “group” for the voxel.

<WeatherGenerator>
    <Voxel>Snow</Voxel>
    <Weathers>
     <Weather>
      abc
    </Weather>
    <Weather>
      xyz
    </Weather>
   </Weathers>
</WeatherGenerator>

Inside the Generator 2

Now that we’ve established what voxel we want to create weather, we need to define what weathers it will make! Each WeatherGenerator contains a list of what voxels it wants to create. It contains the Name, Weight, MinLength, MaxLength, and Offset.

The Name variable is used to create the weather, give it the name of a weather you want to make such as FogLight, or RainHeavy. You can enter the game and run /weatherlist to see all possible ones in that world.
The Weight variable is what it sounds like, it is a weight for the weather when it is being selected with RNG. A weather effect with a larger weight will be picked more often than ones with less.
The MinLength and MaxLength variables are for telling how long you want the weather to last, in seconds. It similarly selects a random range when the weather is being created.
The Offset variable is used when the weather’s position is being generated, if this value is 2000, it will generate (2000 + radius) meters away from the player.

<WeatherFrequencyMin>20</WeatherFrequencyMin>
<WeatherFrequencyMax>180</WeatherFrequencyMax>
 
<WeatherGenerators>
   <WeatherGenerator>
     <Voxel>Snow</Voxel>
     <Weathers>
      <Weather>
        <Name>SnowLight</Name>
        <Weight>3</Weight>
        <MinLength>300</MinLength>
        <MaxLength>1200</MaxLength>
        <SpawnOffset>1000</SpawnOffset>
      </Weather>
      <Weather>
        <Name>SnowHeavy</Name>
        <Weight>1</Weight>
        <MinLength>300</MinLength>
        <MaxLength>2400</MaxLength>
        <SpawnOffset>1000</SpawnOffset>
      </Weather>
    </Weathers>
  </WeatherGenerator>
  <WeatherGenerator>
    <Voxel>Ice</Voxel>
    <Weathers>
      <Weather>
        <Name>FogLight</Name>
        <Weight>1</Weight>
        <MinLength>300</MinLength>
        <MaxLength>900</MaxLength>
        <SpawnOffset>1000</SpawnOffset>
      </Weather>
      <Weather>
        <Name>FogHeavy</Name>
        <Weight>1</Weight>
        <MinLength>300</MinLength>
        <MaxLength>900</MaxLength>
        <SpawnOffset>1000</SpawnOffset>
      </Weather>
      <Weather>
        <Name>SnowHeavy</Name>
        <Weight>1</Weight>
        <MinLength>300</MinLength>
        <MaxLength>2400</MaxLength>
        <SpawnOffset>1000</SpawnOffset>
      </Weather>
    </Weathers>
  </WeatherGenerator>
</WeatherGenerators>

This is what a complete weather system may look like for a planet with only snow and ice on the surface.

Thanks for reading this guide, I hope it helps you create a good weather system for your custom planet. If you’d like to create custom weather effects, see this guide.

Powered by your "Need to Create"

Become a Space Engineer today!

Start Creating
Summarization