How is rainfall calculated in Tribe Of Pok?
How rainfall works in real lifeTo answer this question, first we need to understand a bit about rain in real life. Water droplets form to become rain when the humidity in the atmosphere reaches 100%. Humidity is calculated as follows:
Atmospheric Humidity = (Current Water Vapor)/(Max Water Vapor at a given temperature)
Now Max Water Vapor at a given temperature varies depending on temperature, generally being higher when the current temperature is higher. So this means you need less Current Water Vapor at a lower temperature to reach 100% Atmospheric Humidity (which also explains why it tends to rain more at night time).
How this is implemented in the gameTribe Of Pok separates humidity into two groups, local humidity and atmospheric humidity. The local humidity is the humidity on the map, which affects rates of decay of various materials, as well as the "apparent temperature" felt by Pokians. The atmospheric humidity is humidity in the sky, as calculated by the formula above and affects whether it rains or not.
Now for the atmospheric humidity, every hour some Water Vapor is added to the Current Water Vapor to simulate evaporation and weather fronts. The amount added depends on the biome and season (e.g the Default biome has a constant stream of Water Vapor every day, while the semi-arid biome floods mid-spring and then stops during Summer, Autumn and Winter).
Once Atmospheric Humidity reaches 100% or higher, it starts raining. While it is raining, the Current Water Vapor decreases. This naturally means the Atmospheric Humidity decreases as well. Once the Current Water Vapor reaches 0, the rain stops and Water Vapor starts building up again, repeating the process!