Wind is a mechanism in Terraria which influences the movement of various objects, as well as the occurance of Windy Days and Sandstorms.
Wind speed ranges between 0 and 60 mph. The wind can blow from either the west or east. Informational accessories such as the Weather Radio show the direction the wind is blowing from, not towards (so for example, "25 mph W" means that the wind is blowing 25 mph from the west).
Wind primarily affects things that have no effect on gameplay, such as cloud movement speeds, blizzard and sandstorm background effects, and the animations of the surface of water and trees. However, it occasionally plays a part in how the game plays, such as its effects on Detonating Bubbles and its effects on players afflicted with Mighty Wind. The UFO Mount summoned by the Cosmic Car Key also seems to be slightly pushed by wind, but it is unnoticeable unless firing a weapon that bounces at a corner for a long period of time.
The Windy Day event occurs when the wind speed is 20 mph or higher, and ends when wind speed decreases below 16 mph.
The Weather Radio, Fish Finder, PDA, Cell Phone, and Shellphone all list the wind speed in the upper right corner of the screen.
Functionality []
There are two core values in the code that control wind speed:
and windSpeedCurrent
, both of which are updated each tick[1]. The speed at which windSpeedCurrent changes is determined by the following formula:
windSpeedTarget
speed = |windSpeedTarget/50 * (1 + rain intensity * 5/9) - windSpeedCurrent/50| * 0.0015;
where windSpeedTarget and windSpeedCurrent are in the mph values used by the game. The game stores both values as float values, where < 0 is eastward wind, and > 0 is westward wind.
When a world is created, it will generate with winds up to but not exceeding 20 mph, and a variable
is set to prevent changes for the next 15 - 45 seconds. After this period is over, there are a series of random chances that the wind will increase or decrease by up to a certain amount, which occurs on loop every 15 - 45 seconds (a "gust").[2]
windCounter
Chance | Target wind speed change |
---|---|
25% | -1.25 mph to 1.25 mph |
37.5% | -2.5 mph to 2.5 mph |
37.5% | -5 mph to 5 mph |
A second counter (
) decreases by one each time a gust occurs. When it hits zero, it causes an "extreme gust". It is both reset on world generation and when an extreme gust is triggered.
extremeWindCounter
Chance | Occurance |
---|---|
21.66% | Target wind is set to 0, and no gusts will occur for the next 2 - 8 minutes. |
21.66% | Target wind increases by -10 mph to 10 mph |
36.83% | Target wind increases by -20 mph to 20 mph |
19.85% | Target wind increases by -40 mph to 40 mph |
When an extreme gust occurs, the target wind speed will dictate how many more gusts it will take for another extreme gust to occur.
Target wind speed | Amount of gusts until an extreme gust |
---|---|
0 - 15 mph | 10 - 30 gusts |
> 15 mph | 15 - 40 gusts |
> 25 mph | 20 - 50 gusts |
> 35 mph | 25 - 60 gusts |
Finally, if a gust has flipped the direction of the wind, there is a 66% chance that the target wind speed will flip its direction back to the original direction it was facing in. After all these steps, the target wind speed is capped to 40 mph.
Effects[]
Wind affects the following:
Object | Effect |
---|---|
Windy Day | Event occurs when wind speed is 20 mph or higher in any direction. |
Sandstorm | Has a chance to occur when wind speed is 30 mph or higher in any direction. |
Windy Balloon |
Affects movement direction and spawn location. Spawn rate will increase with increased wind speeds. |
Angry Dandelion |
Affects the direction, animation and movement of fired projectiles, and the animation of the enemy itself. The enemy can only fire in the direction the wind is moving. Spawn rate will increase with increased wind speeds. |
Ladybug |
Affects movement direction; Will only spawn if the winds exceed 20 mph in any direction. |
Ecto Mist |
Affects movement direction. |
Release Doves |
Affects movement direction. |
Kites |
Pushes when not behind walls. |
Water | Affects animation, distortion when Waves Quality is enabled. |
Music Box |
Affects note drift direction. |
Silly Balloon Machine |
Affects balloon movement. |
Precipitation (Rain, Blizzard, Sandstorm, etc) | Affects particle movements. |
Clouds | Affects drift direction. |
Bubbles | Affects drift direction. |
Detonating Bubble | Affects drift direction. |
Angry Tumbler |
Pushes. |
Party Background Balloons |
Affects balloon drift direction. |
Players with the Mighty Wind |
Pushes. |
North Pole Snowflakes | Affects drift direction. |
Paper Airplanes |
Carries. |
Snake Charmer's Flute |
Affects the notes spawned by the usage of the flute. |
Ambient entities | Affects the movement of lost kites, groups of butterflies, the pegasus, pixie posses, vultures, groups of birds, seagull groups, gastropod groups, balloon slime groups, hellbat groups, bat groups, wyverns, air balloons and airships in the background. |
Chimney |
|
Firefly / Lightning Bug | Will not spawn if the winds exceed 20 mph in any direction. |
Butterfly | Will not spawn naturally or from shaken trees if the winds exceed 20 mph in any direction. |
Water Striders |
Will not spawn naturally if the winds exceed 10 mph in any direction. |
Witch's Broom |
Pushes the small light on the tip of the handle. |
Trees and Living Tree Leaf Blocks | Leaves are dropped with increasing frequency with increasing wind speeds. Said leaves are also affected by wind. |
Treetops | Animates the tops of trees with leafy tops. |
Vines | Pushes. |
Lantern Night Background Lanterns |
Affects drift direction. |
Release Lantern |
Affects drift direction. |
Wind ambience track | Affects volume. Only plays if the windspeed is greater than 20 mph. |
Waterfalls | Affects animation. |
Pin Wheel |
Affects spin animation. |
Pin Flags |
Affects animation speed. |
Weather Vane |
Affects animation. |
Furniture[]
Some furnitures are affected by wind when on the surface and either in front of any of the following walls, or behind no wall at all.
The following furnitures are affected by wind when the above conditions are met.
- Chandeliers
- Lanterns
- Pigronata
- Disco Ball
- War Table Banner
- Hanging Pot
- Hanging Brazier
- All Tall Grasses
- Mushrooms
- Acorns
- Vile Mushroom
- Jungle Spores
- Nature's Gift
- Glowing Mushroom
- Herbs
- Vicious Mushroom
- Strange Plants
- Lime Kelp
- Blue Berries
- Yellow Marigold
- Sky Blue Flower
- Green Mushroom
- Teal Mushroom
- Oasis Plants
- Gemcorns
- Sakura Saplings
- Yellow Willow Saplings
- Sunflowers
- Sea Oats
Mighty Wind []
- Mighty Wind by default will push players
pixels per second. If the wind speed is > 25mph, then this value increases by 37%. If the player is falling or jumping, this value increases by 50%. Finally, if the player moves left or right, this value is decreases by 20%, and will be capped at 0.072 pixels per frame.mph * 0.0012
- Running into opposing wind with enough speed will cause the player to emit particles similar to the effect of running with Hermes Boots.
- Moving left or right on a mount while at a stationary height negates the effects of mighty wind.
Notes[]
- At exactly 0 mph, the game will prefer westward wind, but due to the decimal system used for wind speeds, this value will often be near, but not exactly 0.
- On the title screen, wind is initialized with speeds up to 40 mph. This will not carry over to generated worlds, however, which will instead start with winds up to 20 mph.
- Due to the these initial speeds, there is a 1/400 chance that the world will spawn with a Windy Day in progress.
- Winds will decrease to zero during Lantern Nights, provided the player is not controlling the windspeed with Journey Mode.
- Only the target wind speed will be saved with a world, and when the same world is loaded the current wind speed will be set to the target. This can cause slight differences in wind speeds when a player exits and re-enters a world.
Trivia[]
At lower wind speeds, the leaves drop with a lower frequency from trees each tick (5 mph → 1/2000 chance, 10 mph → 1/1000, 15 mph → 1/450, ... 40 mph → 1/50). While the maximum speed is 40mph, however, there is code for cases up to and exceeding 55 mph, with chances being as low as 1/10 each tick.
Scrapped Projectile Physics[]
In the game code, there is a boolean
that triggers a feature where projectiles would be affected by wind. As it is disabled, there is no such feature in the game currently. Below is a detailed description of the feature's effects.
Main.windPhysics
Notably, this feature would attempt to disable wind effects on the North Pole, however it is unknown if this was to prevent conflict with existing code or to remove the feature outright.
When the feature is active, all projectiles below, when on the surface, and not stuck in tiles or behind walls, will be affected by wind. This occurs only if they are moving against the current wind direction, or if their x velocity is less than
. This will change their x velocity by wind mph * 0.36
pixels per tick, or wind mph * 0.002
pixels per second.
wind mph * 0.12
A projectile's x velocity in this state cannot exceed 16, but this limit is never reached as the max possible wind speed, 40 mph, can only push projectiles up to 14.4 pixels per tick.
|
Functionality []
There are two base values the game uses when determining windspeed, "windSpeed" and "windSpeedSet". windSpeedSet is a value set to determine what value windSpeed should gradually change to, but both values are used intermittently throughout the code to affect certain objects. The game takes the following steps to determine windSpeed:
- If windSpeed is not already equal to windSpeedSet, move it closer by .001
- Change windSpeedSpeed by a value from -.001 to .001 (-.002 to .002 when night)
- Cap windSpeedSpeed to -.002 or .002
- Change windSpeedTemp by windSpeedSpeed (windSpeedSpeed x 2 if raining)
- Cap windSpeedTemp by
.3 + .5 * (Percentage cloud cover / 100)
- Set windSpeedSet to windSpeedTemp
- Loop
Overall this means that there are stronger wind speeds when it is nighttime and/or raining. However, as sandstorms do not count as rain, sandstorms do not actually cause increased wind speeds. Also notable is that more clouds in the sky means higher potential for higher wind speeds, whether it is raining or not.
References[]
- ↑ A tick is a time unit countable by the software. Most of Terraria's updating logic happens every tick. A tick has the length of 1/60th of a second, hence there are 60 ticks in a second and 3600 ticks in a minute.
- ↑ Information taken from the PC 1.4.0.5 source code, method
UpdateWeather()
inTerraria.Main.cs
. There may be inaccuracies, as the current PC version is 1.4.4.9.