Skip to content

Vanilla Weather Variables

Weather variables are stored in RandomWeatherWithVariables - each level has its own set of them in SelectableLevel:

public RandomWeatherWithVariables[] randomWeathers;

They control weather behavior through TimeOfDay.currentWeatherVariable and TimeOfDay.currentWeatherVariable2.

In RoundManager.SetToCurrentLevelWeather(), the weather variables are loaded from the current level’s weather configuration:

TimeOfDay.Instance.currentWeatherVariable = (float)this.currentLevel.randomWeathers[i].weatherVariable;
TimeOfDay.Instance.currentWeatherVariable2 = (float)this.currentLevel.randomWeathers[i].weatherVariable2;

For challenge files, there’s a 20% chance each variable gets randomized to 20-80% of its original value.

Weather Reset

When leaving a planet in StartOfRound:

TimeOfDay.Instance.currentWeatherVariable = 0f;
TimeOfDay.Instance.currentWeatherVariable2 = 0f;
Weather TypeweatherVariableweatherVariable2
RainyUnusedUnused
FoggyMin fog densityMax fog density
StormyStrike frequency multiplier (higher = more frequent)Unused
FloodedBase water heightMax water rise
EclipsedMin enemy spawnsUnused
OthersNot used in codeNot used in code

Weather Variables: Both weatherVariable and weatherVariable2 are completely unused by the game code.

Rainy weather spawns quicksand hazards outside on the map, but the spawn logic is entirely hardcoded in the SpawnOutsideHazards() method in RoundManager.cs:

if (TimeOfDay.Instance.currentLevelWeather == LevelWeatherType.Rainy)
{
    int num = random.Next(5, 15);
    if (random.Next(0, 100) < 7)
    {
        num = random.Next(5, 30);
    }
    for (int i = 0; i < num; i++)
    {
        Vector3 position = this.outsideAINodes[random.Next(0, this.outsideAINodes.Length)].transform.position;
        Vector3 vector = this.GetRandomNavMeshPositionInBoxPredictable(position, 30f, navMeshHit, random, -1, 1f) + Vector3.up;
        GameObject gameObject = Object.Instantiate<GameObject>(this.quicksandPrefab, vector, Quaternion.identity, this.mapPropsContainer.transform);
    }
}

Behavior:

  • Spawns 5-15 quicksand objects normally
  • Has a 7% chance to spawn 5-30 quicksand objects instead (dangerous variant)
  • Quicksand positions are randomly placed near outside AI nodes within a 30-unit radius
  • No weather variables are consulted - unlike other weather types, Rainy weather ignores its configuration entirely
  • weatherVariable: Minimum fog density (mean free path)
  • weatherVariable2: Maximum fog density (mean free path)
  • A random value between these is chosen each round
  • Set in TimeOfDay.SetWeatherBasedOnVariables():
this.foggyWeather.parameters.meanFreePath = (float)random.Next(
    (int)this.currentWeatherVariable,
    (int)this.currentWeatherVariable2
);
  • weatherVariable: Controls lightning strike frequency (storm intensity)
  • Used as a divisor in StormyWeather.DetermineNextStrikeInterval():
this.randomThunderTime +=
    Mathf.Clamp(num * 0.25f, 0.6f, 110f)
    / Mathf.Clamp(TimeOfDay.Instance.currentWeatherVariable, 1f, 100f);
  • Lower values = less frequent strikes
  • Higher values = more frequent strikes (weatherVariable is a setting for strike frequency multiplier)
  • Also determines if lightning re-strikes same location:
if (this.seed.Next(0, 100) < 60
    && (this.randomThunderTime - this.timeAtLastStrike) * TimeOfDay.Instance.currentWeatherVariable < 3f)
{
    vector = this.lastRandomStrikePosition; // Strike same spot again
}
  • weatherVariable: Base water level height (Y position)
  • weatherVariable2: Maximum additional water level rise over time (delta of Y position)
  • Water level calculation in FloodWeather.OnGlobalTimeSync():
this.floodLevelOffset =
    Mathf.Clamp(TimeOfDay.Instance.globalTime / 1080f, 0f, 100f)
    * TimeOfDay.Instance.currentWeatherVariable2;
  • Final position: weatherVariable + (floodLevelOffset)
  • Water rises throughout the day based on weatherVariable2
  • weatherVariable: Minimum number of outside enemies to spawn
    • Also sets minimum inside enemies to spawn
    • Set in EclipseWeather.OnEnable():
RoundManager.Instance.minOutsideEnemiesToSpawn = (int)TimeOfDay.Instance.currentWeatherVariable;
RoundManager.Instance.minEnemiesToSpawn = (int)TimeOfDay.Instance.currentWeatherVariable;
  • weatherVariable2: Not used