Jump to content

Modding:Weather data: Difference between revisions

From Stardew Valley Wiki
imported>KNakamura
copy from canimod.com with permission, dual-licensed CC BY-NC-SA for compatibility with wiki. Main author is Kylindra, with contributions from Pathoschild."
 
imported>VulpesLucida
+zh link
 
(31 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<pre>
← [[Modding:Index|Index]]
---
layout: default
title: Weather
intro: >
    This page explains how the game handles weather. This is meant as an in-depth overview for
    modders.
permalink: /for-devs/weather
redirect_from:
    - /guides/weather
---


Weather in Stardew Valley runs from multiple sources.
This page documents how the game generates [[weather]] in the game.


## Coding Explanation
==Data==
First off, weather (for tomorrow) is controlled by the variable weatherForTomorrow. It's an _int_, and takes one of the following arguments
The weather is controlled by the string field <samp>Game1::weatherForTomorrow</samp>. The possible values are:


weather | value
{| class="wikitable"
------------ | -------------
|-
weather_sunny | 0
! value
weather_rain | 1
! constant
weather_debris | 2
! weather
weather_lightning | 3
|-
weather_festival | 4
| <samp>Sun</samp>
weather_snow | 5
| <samp>weather_sunny</samp>
weather_wedding | 6
| sunny
|-
| <samp>Rain</samp>
| <samp>weather_rain</samp>
| rain
|-
| <samp>GreenRain</samp>
| <samp>weather_green_rain</samp>
| green rain
|-
| <samp>Wind</samp>
| <samp>weather_debris</samp>
| windy
|-
| <samp>Storm</samp>
| <samp>weather_lightning</samp>
| lightning
|-
| <samp>Festival</samp>
| <samp>weather_festival</samp>
| festival
|-
| <samp>Snow</samp>
| <samp>weather_snow</samp>
| snow
|-
| <samp>Wedding</samp>
| <samp>weather_wedding</samp>
| wedding
|}


The weather debris for the season differs (weather_debris), and is offset _16_ in spring, _24_ in summer, _18_ in fall, and nothing in winter. It failsafes to _20_.
==Algorithm==
You can now change the weather algorithm by editing [[Modding:Migrate to Stardew Valley 1.6#Custom location contexts|location context data]], and (with a C# mod) implement custom weathers.


prepareSpouseForWedding() sets the weather to wedding.  
Fields like <samp>Game1.weather</samp> and <samp>Game1.weatherForTomorrow</samp> are now strings to support custom mod weather IDs. The change for vanilla weather has no effect on Content Patcher packs, since the new weather IDs match the ones Content Patcher was using before (i.e. <samp>Sun</samp>, <samp>Rain</samp>, <samp>Snow</samp>, <samp>Storm</samp>, and <samp>Wind</samp>). C# mods may also see a <samp>Festival</samp> weather, while Content Patcher packs will see <samp>Sun</samp> for it. The constants like <samp>Game1.weather_sunny</samp> have the new string values (with new constants like <samp>Game1.legacy_weather_sunny</samp> for the legacy values).


The meat of this is in newDayAfterFade()
The base game will treat an invalid weather as sunny. C# mods can implement custom weather effects using [[Modding:Modder Guide/APIs/Events|normal SMAPI events]] like <samp>UpdateTicked</samp>, or by [[Modding:Modder Guide/APIs/Harmony|patching]] methods like <samp>Game1.ApplyWeatherForNewDay</samp> and <samp>Game1.populateDebrisWeatherArray</samp>.


First, for weather, it checks if the wedding is today. It sets it to 6 if it is.
===Forced weather===
Certain dates always have the same weather:


On the following days, you get the following weather by force:
{| class="wikitable"
|-
! date
! weather
|-
| spring 1
| <samp>weather_sunny</samp>
|-
| spring 2 (year 1)
| <samp>weather_sunny</samp>
|-
| spring 3 (year 1)
| <samp>weather_rain</samp>
|-
| spring 4 (year 1)
| <samp>weather_sunny</samp>
|-
| summer 1
| <samp>weather_sunny</samp>
|-
| summer 13
| <samp>weather_lightning</samp>
|-
| summer 26
| <samp>weather_lightning</samp>
|-
| fall 1
| <samp>weather_sunny</samp>
|-
| winter 1
| <samp>weather_sunny</samp>
|}


day | season | year |weather
Green rain can only occur on Summer 5, 6, 7, 14, 16, 18 and 23.
----|--------|-------|-------
1|spring|any|weather_sunny
2|spring|1|weather_sunny
3|spring|1|weather_rain[1]
4|spring|1|weather_sunny
13|spring|any|weather_festival
24|spring|any|weather_festival
1|summer|any|weather_sunny
11|summer|any|weather_festival
13|summer|any|weather_lightning
26|summer|any|weather_lightning
28|summer|any|weather_festival
1|fall|any|weather_sunny
16|fall|any|weather_festival
27|fall|any|weather_festival
1|winter|any|weather_sunny
8|winter|any|weather_festival
25|winter|any|weather_festival


[1] The game first sets it to weather_sunny and then in a later check to weather_rain
Active festivals (defined in <samp>Data/Festivals</samp>) always have the <samp>Festival</samp> weather while passive festivals (defined in <samp>Data/PassiveFestivals</samp>) always have the <samp>Sun</samp> weather.


At this point, it checks if it's rainy or storming, and sets the flags.  
===Generated weather===
Weather in Stardew Valley is set within the <samp>Game1::newDayAfterFade()</samp> function (after the day change code, but before SMAPI's <samp>SaveEvents.BeforeSave</samp> event).


If it's 0-2-4-5-6, it clears all rainy, storm or lightning tracks. (it then manually sets snowing after this..)
The game follows these steps to decide which weather and debris to set for the next day:


It then sets the debris array to active, and then it starts setting weather for the next day (!).  
# Load the possible weather for the new day for each location, which is set just after the old day started.
# Check for [[#Forced weather|forced weather]].
# If today is a wedding, set the weather to <samp>Wedding</samp>.
# Sync the <samp>WeatherForTomorrow</samp> field for each location.
# Set <samp>Game1::wasRainingYesterday</samp> based on whether it was raining or storming.
# Clear the debris weather array.
# Reset all weather flags, and sets them in the following pattern
## If it is going to rain, set the rain flag to true (this does ''not'' include the green rain).
## If the weather is green rain, set the green rain flag to true.
## If it is going to storm, set the rain and storm flags to true.
## If it is going to be windy, set the debris flag to true.
## If it is going to snow, set the snow flag to true,
# Prepare for the possible weather the day after the new day:
## Default to <samp>Sun</samp>;
## If the day after the new day is an active festival, set the weather to be <samp>Festival</samp> and return;
## If the day after the new day is a passive festival, set the weather to be <samp>Sun</samp> and return;
## Apply randomized [[Modding:Migrate to Stardew Valley 1.6#What's new for locations &amp; weather#Custom location contexts|weather conditions]] from location contexts to get a possible weather.
# Prepare for the possible weather the day after the new day for those locations with [[Modding:Migrate to Stardew Valley 1.6#What's new for locations &amp; weather#Custom location contexts|<samp>CopyWeatherFromLocation</samp>]] specified (copy from source locations).
# Sync the weather.
# Apply all the weather flags to the valley area.
# Populate the debris array if it is debris weather.
# Reset (on the first day of a month) or increment the <samp>monthlyNonRainyDayCount</samp> for each location.
# Apply the green rain response logic (''e.g.'', show global message, send a mail, etc.)


In summer, the chance of rain the next day is : 0% if it's the first day, and  .13 + .003 * the day of the month
At this point, the main function is done setting weather.
In winter, the chance of 'rain' is 63%.
In fall and spring, it's 18.3%


It then picks a number, and if it's less than the chance of rain, it sets it equal to rain. It then checks if it's summer, and rain in summer has an 85% chance of becoming storms. OR: In any month that isn't winter, as long as you've played more than 27 days and it's at least the third day of the month, you have a 25% chance of the rain becoming a storm.
===TV Channel===
The TV will check the weather and show the following message:


In winter, rain always becomes snow.
{| class="wikitable"
|-
! weather
! message
|-
| <samp>Festival</samp>
| "It's going to be clear and sunny tomorrow... perfect weather for the Festival! The event will take place Location, starting between Time. Don't be late!"
Failed to fetch the data: "Um... that's odd. My information sheet just says 'null'. This is embarrassing... "
|-
| <samp>Snow</samp>
| 50% chance each:
* "Bundle up, folks. It's going to snow tomorrow!"
* "Expect a few inches of snow tomorrow."
|-
| <samp>Rain</samp>
| "It's going to rain all day tomorrow"
|-
| <samp>GreenRain</samp>
| "Um... There appears to be some kind of... anomalous reading... I... don't know what this means..."
|-
| <samp>Storm</samp>
| "Looks like a storm is approaching. Thunder and lightning is expected."
|-
| <samp>Wind</samp>
| Per condition:
* Spring: "Partially cloudy with a light breeze. Expect lots of pollen!"
* Fall: "It's going to be cloudy, with gusts of wind throughout the day."
* Default: "It's going to snow all day. Make sure you bundle up, folks!"
|-
| ''default''
| 50% chance each:
* "It's going to be clear and sunny all day."
* "It's going to be a beautiful, sunny day tommorow!"
|}


If the number is over the chance of rain, it checks you've played for at least 2 days, and that it's not a wedding day. In spring, there is a 20% chance of wind, and in fall, a 60% chance of the weather becoming windy.
'''Note:''' the TV will not necessarily be accurate for any other day than non festival days, the first of the month and the 3rd of spring, which are force-set by the <samp>Game1::newDayAfterFade</samp> method. Farmhands (and not host players) may not even get that accuracy for the first of the month and 3rd of spring.


Then, it finally sets the weather to sunny
'''Note 2:''' Passive festivals such as the Night Market are not considered to have "festival" weather. Instead, all passive festivals in the valley have "sunny" weather.


It then checks to make sure that the next day is a festival day. If so, it sets it to weather_festival. If the current day is the 2nd day of spring, it makes sure the third day is rainy. (again.) (It's sets this by making sure you've played 2 days.) and updates your current weather icon near the end of the function (After a bunch of other things.)
===Weather Icon===
The weather icon is set in <samp>Game1::updateWeatherIcon</samp>, which sets an index in <samp>LooseSprite/Cursors.xnb</samp>:


## TV channel
# If snowing: 7.
# If sunny: 2.
# If wedding: 0.
# If festival: 1.
# If raining: 4.
# If stormy: 5.
# If spring: debris weather is 3.
# If summer: unset (defaults to sunny).
# If fall: 6.
# If winter: 7 (same as snowing).
# If green rain: 999.


Now, if you check the TV, it both can check the current weather or alter it. (getWeatherForceast())
===Rain Totem===
The rain totem (item #681) and is controlled by <samp>Object::rainTotem</samp>, which is invoked by <samp>Object::performUseAction</samp>. If tomorrow is a festival day, the item is used up but nothing happens. Otherwise, it uses up the item and sets the weather for tomorrow to <samp>weather_rain</samp> and displays the message.


The TV force sets by:
==Weather probability by type==
This section explains the probability of each weather type. This only applies on dates with no [[#Forced weather|forced weather]].


day | season | year |weather
===Sunny===
----|--------|-------|-------
Sunny weather covers weather variables 0, 4, and 6.
1|spring|any|weather_sunny[1]
1|summer|any|weather_sunny[1]
13|summer|any|weather_lightning[2]
25|summer|any|weather_lightning[2]
1|fall|any|weather_sunny[1]
1|winter|any|weather_sunny[1]


[1] also set (and therefore overriden) by the newDay() function
* Spring: there's an 18.3% base chance of rain (81.7% chance remaining for other weathers). If it doesn't rain, there's an 80% chance to remain sunny (except on spring 3, which will always be rainy). That means that in spring there's a 66.4% chance of sunny weather.
[2] These are set by current_day mod 12, which results in the 13th and 25th.
* Summer: The chance of sunny weather diminishes steadily per day from 87.4% on summer 1 to 79.9% on summer 28. The precise chance is 1 - [12% + (0.3% * day of the month)] per day, with a 0% chance on day 1.
* Fall: identical to spring, but no forced weather.
* Winter: there's a 63% chance of precipitation, so only a 37% chance of sunny weather.


Description:
===Rainy===
* Spring: there's an 18.3% base chance of rain. If it rains, there's a 25% chance of storms ''except in year 1''. So the rain odds in Spring is a flat 18.3% in year 1, and 13.725% in year 2 or later. It will always rain on spring 3 (year 1).
* Summer: the chance of rainy weather increases steadily per day from 12.6% on summer 2 to 20.1% on Summer 27. There's an 85% chance that rain becomes storms. So you have a scale of [12% + (0.3% * day of the month)] * .15 to determine your chances of rainfall.
* Fall: same as spring, except fall in year 1 can be stormy so it's a flat 13.725% chance.
* Winter: never rains.


It will check the weather, and do the following:
===Debris===
Debris weather covers weather variable 2.


* Sunny or Wedding: A 50% chance of one of two strings: "It's going to be clear and sunny all day." or "It's going to be a beautiful, sunny day tommorow!"
* Spring: there's a 20% chance of this after rain, so approximately 16.6% chance of debris weather.
* Rain: "It's going to rain all day tomorrow"
* Summer: no debris weather.
* Debris: Spring: "Partially cloudy with a light breeze. Expect lots of pollen!" Not Fall: "It's going to snow all day. Make sure you bundle up, folks!" and defaults with: "It's going to be cloudy, with gusts of wind throught the day."
* Fall: there's a 60% chance for this after rain, so approximately 49.8% chance of debris weather.
* Storm: "Looks like a storm is approaching. Thunder and lightning is expected."
* Winter: no debris weather.
* Festival: It attempts to read the festival data, will spit out an amusing "Um... that's odd. My information sheet just says 'null'. This is embarrassing..." if it fails to read the data, other wise will read out where it is and when it is.
* Snow: A 50% chance of one of two strings: "Expect a few inches of snow tomorrow" or "Bundle up, folks. It's going to snow tomorrow!"


It returns an empty string for all other weathers. (which should be none, but.)
===Stormy===
Stormy weather covers weather variable 3.


### Notes:
* Spring: 4.57% chance of storms.
* Summer: variable chance of storms; starts at 10.71% and increases to 17.085%.
* Fall: 4.57% chance of storms.
* Winter: no stormy weather.


The TV will not neccesarilly be accurate for Summer 13,26 or Spring 2,4. Those are force set within the newDayAfterFade() function.
===Snowy===
In winter, there's a 63% chance of snow. No other season has snow.


## Rain Totem:  
==Save files==
The save file is a snapshot of the day at 0600 the next morning. The <samp>WeatherForTommorow</samp> field was used to calculate the weather, but changing it has no effect on the weather since the weather flags have already been set by this point. To change the weather, you need to set one of these combinations of flags:


It makes sure you aren't in multiplayer and that tomorrow isn't a festival day. If so, it sets the weather for tomorrow to weather_rain. Of an interesting note, see the TV notes above.
{| class="wikitable"
|-
! weather
! <samp>isRaining</samp>
! <samp>isDebrisWeather</samp>
! <samp>isLightning</samp>
! <samp>isSnowing</samp>
! <samp>isGreenRain</samp>
|-
| sunny
| ☐
| ☐
| ☐
| ☐
| ☐
|-
| rainy
| ☑
| ☐
| ☐
| ☐
| ☐
|-
| stormy
| ☑
| ☐
| ☑
| ☐
| ☐
|-
| debris
| ☐
| ☑
| ☐
| ☐
| ☐
|-
| snowy
| ☐
| ☐
| ☐
| ☑
| ☐
|-
| festival
| ☐
| ☐
| ☐
| ☐
| ☐
|-
| wedding
| ☐
| ☐
| ☐
| ☐
| ☐
|-
| green rain
| ☐
| ☐
| ☐
| ☐
| ☑
|}


===========================================
'''Note:''' changing <samp>isDebrisWeather</samp> during an active game will not create the array. You'll need to call <samp>Game1::populateDebrisWeatherArray</samp> to get the debris populated. Correspondingly, if you're removing the debris weather flag, remember to call <samp>Game1::debrisWeather::Clear</samp>.


Now that we've broken down the flow, here's a (long winded) breakdown of each weather's chances.
==Notes/FAQ==
* The TV can be fixed by overriding it - or just by using Entoroax's Framework.
* You can set snow and debris at any time, the game just won't.
* You cannot set debris and rain at the same time.


## Sunny Weather (0,4,6)
[[Category:Modding]]


In _Spring_, there is first an 18.3% base chance that it rains assuming that it's not overriden. (81.7% chance remaining for other weathers). If it doesn't rain, it has an 80% chance to remain sunny. (except on Spring 3, which will always be rainy.). This means in _Spring_, there is a 66.4% chance of it being sunny.
[[pt:Modificações:Dados climáticos]]
 
[[ru:Модификации:Погодные явления]]
In _Summer_, there is a diminishing chance daily of sunny weather, but generally, you have a 86% chance on the second day, to 79.9% chance on the last day. The precise chance is: 1 - [13% + (.3 * day of the month)] per day, and it's a 0% chance on day 1. Bear in mind that Summer 12,13,24 and 26 will be stormy.
[[zh:模组:天气数据]]
 
In _Fall_, the odds are precisely the same as Spring. There's no forced weather though.
 
In _Winter_, there is a 63% chance of preciptation, so only a 37% chance of sunny weather.
 
## Rainy Weather (1)
 
In _Spring_, you have a 18.3% chance of rain. If it rains, there's only a 25% chance of storms, _as long as it is not Year 1_. So the rain odds in Spring is a flat 18.3% in Year 1, and 13.725% in Year 2 and beyond. It will be rainy on Spring 3 Year 1.
 
In _Summer_, you have a steadily increasing chance of rain starting at 14% on Summer 2 to a 21.1% chance on Summer 27. However, during _Summer_, you have a 85% chance to make the rain into storms. So you have a scale of [13% + (.3 * day of the month)] * .85 to determine your chances of rainfall. (See the note about forced weather above.)
 
In _Fall_, it's the same as _Spring_, although Fall Year 1 can be stormy, so it's 13.725%.
 
In _Winter_, it does not rain.
 
## Debris Weather (2)
 
In _Spring_, you have a 20% chance for this after rain, so approximately 16.6% chance of debris weather.
 
In _Summer_ you cannot have debris weather.
 
In _Fall_, you have a 60% chance for this after rain, so approximately 49.8% chance of debris weather.
 
In _Winter_ you cannot have debris weather.
 
## Stormy Weather (3)
 
In _Spring_, you have a 4.57% of storms.
 
In _Summer_, you have a variable chance of storms. It starts at 11.9% and increases to 17.9% chance.
 
In _Fall_, you have a 4.57% of storms.
 
In _Winter_ you cannot have stormy weather.
 
## Snowy Weather
 
In _Winter_, you have a 63% chance of snow.
 
No other season has snow.
 
# Override Table
 
day | season | year |weather|overriden by
----|--------|-------|-------|--------
1|spring|any|weather_sunny|newday and tv
2|spring|1|weather_sunny|newday
3|spring|1|weather_rain|newday
4|spring|1|weather_sunny|newday
13|spring|any|weather_festival|newday
24|spring|any|weather_festival|newday
1|summer|any|weather_sunny|newday and tv
11|summer|any|weather_festival|newday
13|summer|any|weather_lightning|newday and tv
25|summer|any|weather_lightning|tv
26|summer|any|weather_lightning|newday
28|summer|any|weather_festival|newday
1|fall|any|weather_sunny|newday and tv
16|fall|any|weather_festival|newday
27|fall|any|weather_festival|newday
1|winter|any|weather_festival|newday and tv
8|winter|any|weather_festival|newday
25|winter|any|weather_festival|newday
 
# Weather Icon
Thanks to Entoarox, the logic for this is pretty simple:  
The following will always apply: snowing sets _7_, sunny _2_, wedding _0_, festival _1_, raining _4_, stormy _5_
 
In spring, debris weather is _3_, summer will be __unset__, fall _6_, and winter _7_ (the same as snowing)
 
These icons are located in _LooseSprite/Cursors.xnb_
 
# Weather and Save Files
 
Your save file is a snapshot of the day at 0600 the next morning. As such, changing WeatherForTommorow in there will not affect the day loaded. If you really need to alter weather, you'll want to look at the following attributes: ```isRaining, isDebrisWeather, isLightning, isSnowing```
 
# Detecting Current Weather
 
This is a brief overview. While it's generally obvious, I'll lay it out
 
weather | isRaining | isDebrisWeather| isLightning| isSnowing
-------|-----------|------------|-----------|--------------
Sunny|F|F|F|F
Rainy|T|F|F|F
Storm|T|F|T|F
Debris|F|T|F|F
Snowing|F|F|F|T
Festival|F|F|F|F
Wedding|F|F|F|F
 
# Comments (Modding)
 
Q. How do I fix the TV not being accurate, or add new strings?
 
A. Override the function that does forecasts. Very difficult, although theoretically possible in SMAPI (and probably more fully in FarmHand)
 
Q. I want to set snowy weather outside Winter!
 
A. You can, as long as you keep in mind what days try to override that.
 
Q. What about adding new weathers?
 
A. Err.. Outside the scope of this, I'm afraid
 
Q. I see that debris has code for winter but cannot be triggered
 
A. Correct. It's also got an offset of 0, so you might have to do something about drawing the debris.
 
Q. Any modding limitations?
 
A. _Yes_. Bear in mind that SMAPI's PlayerEvents.LoadedGame and TimeEvents.DayOfMonthChanged run before SDV runs it's new day. The overrides and festival days will override your weather. That said, you can get snow and windy weather out of season. Also, debris weather will generally render as whatever the day was before due to how updateWeatherIcon() handles that in summer, but as snow in winter.
</pre>

Latest revision as of 23:45, 10 January 2025

← Index

This page documents how the game generates weather in the game.

Data

The weather is controlled by the string field Game1::weatherForTomorrow. The possible values are:

value constant weather
Sun weather_sunny sunny
Rain weather_rain rain
GreenRain weather_green_rain green rain
Wind weather_debris windy
Storm weather_lightning lightning
Festival weather_festival festival
Snow weather_snow snow
Wedding weather_wedding wedding

Algorithm

You can now change the weather algorithm by editing location context data, and (with a C# mod) implement custom weathers.

Fields like Game1.weather and Game1.weatherForTomorrow are now strings to support custom mod weather IDs. The change for vanilla weather has no effect on Content Patcher packs, since the new weather IDs match the ones Content Patcher was using before (i.e. Sun, Rain, Snow, Storm, and Wind). C# mods may also see a Festival weather, while Content Patcher packs will see Sun for it. The constants like Game1.weather_sunny have the new string values (with new constants like Game1.legacy_weather_sunny for the legacy values).

The base game will treat an invalid weather as sunny. C# mods can implement custom weather effects using normal SMAPI events like UpdateTicked, or by patching methods like Game1.ApplyWeatherForNewDay and Game1.populateDebrisWeatherArray.

Forced weather

Certain dates always have the same weather:

date weather
spring 1 weather_sunny
spring 2 (year 1) weather_sunny
spring 3 (year 1) weather_rain
spring 4 (year 1) weather_sunny
summer 1 weather_sunny
summer 13 weather_lightning
summer 26 weather_lightning
fall 1 weather_sunny
winter 1 weather_sunny

Green rain can only occur on Summer 5, 6, 7, 14, 16, 18 and 23.

Active festivals (defined in Data/Festivals) always have the Festival weather while passive festivals (defined in Data/PassiveFestivals) always have the Sun weather.

Generated weather

Weather in Stardew Valley is set within the Game1::newDayAfterFade() function (after the day change code, but before SMAPI's SaveEvents.BeforeSave event).

The game follows these steps to decide which weather and debris to set for the next day:

  1. Load the possible weather for the new day for each location, which is set just after the old day started.
  2. Check for forced weather.
  3. If today is a wedding, set the weather to Wedding.
  4. Sync the WeatherForTomorrow field for each location.
  5. Set Game1::wasRainingYesterday based on whether it was raining or storming.
  6. Clear the debris weather array.
  7. Reset all weather flags, and sets them in the following pattern
    1. If it is going to rain, set the rain flag to true (this does not include the green rain).
    2. If the weather is green rain, set the green rain flag to true.
    3. If it is going to storm, set the rain and storm flags to true.
    4. If it is going to be windy, set the debris flag to true.
    5. If it is going to snow, set the snow flag to true,
  8. Prepare for the possible weather the day after the new day:
    1. Default to Sun;
    2. If the day after the new day is an active festival, set the weather to be Festival and return;
    3. If the day after the new day is a passive festival, set the weather to be Sun and return;
    4. Apply randomized weather conditions from location contexts to get a possible weather.
  9. Prepare for the possible weather the day after the new day for those locations with CopyWeatherFromLocation specified (copy from source locations).
  10. Sync the weather.
  11. Apply all the weather flags to the valley area.
  12. Populate the debris array if it is debris weather.
  13. Reset (on the first day of a month) or increment the monthlyNonRainyDayCount for each location.
  14. Apply the green rain response logic (e.g., show global message, send a mail, etc.)

At this point, the main function is done setting weather.

TV Channel

The TV will check the weather and show the following message:

weather message
Festival "It's going to be clear and sunny tomorrow... perfect weather for the Festival! The event will take place Location, starting between Time. Don't be late!"

Failed to fetch the data: "Um... that's odd. My information sheet just says 'null'. This is embarrassing... "

Snow 50% chance each:
  • "Bundle up, folks. It's going to snow tomorrow!"
  • "Expect a few inches of snow tomorrow."
Rain "It's going to rain all day tomorrow"
GreenRain "Um... There appears to be some kind of... anomalous reading... I... don't know what this means..."
Storm "Looks like a storm is approaching. Thunder and lightning is expected."
Wind Per condition:
  • Spring: "Partially cloudy with a light breeze. Expect lots of pollen!"
  • Fall: "It's going to be cloudy, with gusts of wind throughout the day."
  • Default: "It's going to snow all day. Make sure you bundle up, folks!"
default 50% chance each:
  • "It's going to be clear and sunny all day."
  • "It's going to be a beautiful, sunny day tommorow!"

Note: the TV will not necessarily be accurate for any other day than non festival days, the first of the month and the 3rd of spring, which are force-set by the Game1::newDayAfterFade method. Farmhands (and not host players) may not even get that accuracy for the first of the month and 3rd of spring.

Note 2: Passive festivals such as the Night Market are not considered to have "festival" weather. Instead, all passive festivals in the valley have "sunny" weather.

Weather Icon

The weather icon is set in Game1::updateWeatherIcon, which sets an index in LooseSprite/Cursors.xnb:

  1. If snowing: 7.
  2. If sunny: 2.
  3. If wedding: 0.
  4. If festival: 1.
  5. If raining: 4.
  6. If stormy: 5.
  7. If spring: debris weather is 3.
  8. If summer: unset (defaults to sunny).
  9. If fall: 6.
  10. If winter: 7 (same as snowing).
  11. If green rain: 999.

Rain Totem

The rain totem (item #681) and is controlled by Object::rainTotem, which is invoked by Object::performUseAction. If tomorrow is a festival day, the item is used up but nothing happens. Otherwise, it uses up the item and sets the weather for tomorrow to weather_rain and displays the message.

Weather probability by type

This section explains the probability of each weather type. This only applies on dates with no forced weather.

Sunny

Sunny weather covers weather variables 0, 4, and 6.

  • Spring: there's an 18.3% base chance of rain (81.7% chance remaining for other weathers). If it doesn't rain, there's an 80% chance to remain sunny (except on spring 3, which will always be rainy). That means that in spring there's a 66.4% chance of sunny weather.
  • Summer: The chance of sunny weather diminishes steadily per day from 87.4% on summer 1 to 79.9% on summer 28. The precise chance is 1 - [12% + (0.3% * day of the month)] per day, with a 0% chance on day 1.
  • Fall: identical to spring, but no forced weather.
  • Winter: there's a 63% chance of precipitation, so only a 37% chance of sunny weather.

Rainy

  • Spring: there's an 18.3% base chance of rain. If it rains, there's a 25% chance of storms except in year 1. So the rain odds in Spring is a flat 18.3% in year 1, and 13.725% in year 2 or later. It will always rain on spring 3 (year 1).
  • Summer: the chance of rainy weather increases steadily per day from 12.6% on summer 2 to 20.1% on Summer 27. There's an 85% chance that rain becomes storms. So you have a scale of [12% + (0.3% * day of the month)] * .15 to determine your chances of rainfall.
  • Fall: same as spring, except fall in year 1 can be stormy so it's a flat 13.725% chance.
  • Winter: never rains.

Debris

Debris weather covers weather variable 2.

  • Spring: there's a 20% chance of this after rain, so approximately 16.6% chance of debris weather.
  • Summer: no debris weather.
  • Fall: there's a 60% chance for this after rain, so approximately 49.8% chance of debris weather.
  • Winter: no debris weather.

Stormy

Stormy weather covers weather variable 3.

  • Spring: 4.57% chance of storms.
  • Summer: variable chance of storms; starts at 10.71% and increases to 17.085%.
  • Fall: 4.57% chance of storms.
  • Winter: no stormy weather.

Snowy

In winter, there's a 63% chance of snow. No other season has snow.

Save files

The save file is a snapshot of the day at 0600 the next morning. The WeatherForTommorow field was used to calculate the weather, but changing it has no effect on the weather since the weather flags have already been set by this point. To change the weather, you need to set one of these combinations of flags:

weather isRaining isDebrisWeather isLightning isSnowing isGreenRain
sunny ☐ ☐ ☐ ☐ ☐
rainy ☑ ☐ ☐ ☐ ☐
stormy ☑ ☐ ☑ ☐ ☐
debris ☐ ☑ ☐ ☐ ☐
snowy ☐ ☐ ☐ ☑ ☐
festival ☐ ☐ ☐ ☐ ☐
wedding ☐ ☐ ☐ ☐ ☐
green rain ☐ ☐ ☐ ☐ ☑

Note: changing isDebrisWeather during an active game will not create the array. You'll need to call Game1::populateDebrisWeatherArray to get the debris populated. Correspondingly, if you're removing the debris weather flag, remember to call Game1::debrisWeather::Clear.

Notes/FAQ

  • The TV can be fixed by overriding it - or just by using Entoroax's Framework.
  • You can set snow and debris at any time, the game just won't.
  • You cannot set debris and rain at the same time.