Wind

From Terraria Wiki
Jump to navigation Jump to search

Wind is a mechanism in Terraria which influences the movement of various objects, as well as the occurance of Windy Days(Desktop, Console and Mobile versions) 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.

(Desktop, Console and Mobile versions) 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 (Desktop, Console and Mobile versions)

There are two core values in the code that control wind speed: windSpeedCurrent and windSpeedTarget, both of which are updated each tick[1]. The speed at which windSpeedCurrent changes is determined by the following formula:

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 windCounter 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]

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 (extremeWindCounter) 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.

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 BalloonWindy Balloon(Desktop, Console and Mobile versions) Affects movement direction and spawn location. Spawn rate will increase with increased wind speeds.
Angry DandelionAngry Dandelion(Desktop, Console and Mobile versions) 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.
LadybugLadybug(Desktop, Console and Mobile versions) Affects movement direction; Will only spawn if the winds exceed 20 mph in any direction.
Ecto Mist(Desktop, Console and Mobile versions) Affects movement direction.
Release DovesRelease Doves(Desktop, Console and Mobile versions) Affects movement direction.
KitesKites(Desktop, Console and Mobile versions) Pushes when not behind walls.
WaterWater Affects animation, distortion when Waves Quality is enabled.
Music BoxMusic Box(Desktop, Console, Old-gen console and Mobile versions) Affects note drift direction.
Precipitation (Rain, Blizzard, Sandstorm, etc) Affects particle movements.
Clouds Affects drift direction.
Bubble MachineBubbles Affects drift direction.
Detonating BubbleDetonating Bubble Affects drift direction.
Angry TumblerAngry Tumbler(Desktop, Console and Mobile versions) Pushes.
PartyParty Background Balloons(Desktop, Console and Mobile versions) Affects balloon drift direction.
Players with the Mighty Wind(Desktop, Console and Mobile versions) debuff Pushes.
North PoleNorth Pole Snowflakes (Old-gen console and 3DS versions) Affects drift direction.
Paper AirplanePaper Airplanes(Desktop, Console and Mobile versions) Carries.
Snake Charmer's FluteSnake Charmer's Flute(Desktop, Console and Mobile versions) 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.
ChimneyChimney(Desktop, Console and Mobile versions) Pushes the smoke particles that it emits.
FireflyFirefly / Lightning BugLightning Bug Will not spawn if the winds exceed 20 mph in any direction.
ButterflyButterfly Will not spawn naturally or from shaken trees if the winds exceed 20 mph in any direction.
Water StriderWater StriderWater Striders(Desktop, Console and Mobile versions) Will not spawn naturally if the winds exceed 20 mph in any direction.
Witch's BroomWitch's Broom(Desktop, Console and Mobile versions) Pushes the small light on the tip of the handle.
Leaf BlockTrees and Living Tree Leaf Blocks Leaves are dropped with increasing frequency with increasing wind speeds. Said leaves are also affected by wind.
TreeTreetops Animates the tops of trees with leafy tops.
VinesVines Pushes.
Lantern NightLantern Night Background Lanterns(Desktop, Console and Mobile versions) Affects drift direction.
Release LanternRelease Lantern(Desktop, Console and Mobile versions) Affects drift direction.
Wind ambience track Affects volume. Only plays if the windspeed is greater than 20 mph.
Waterfalls Affects animation.Verify
Pin WheelPin Wheel(Desktop, Console and Mobile versions) Affects spin animation.
Pin FlagsPin Flags(Desktop, Console and Mobile versions) Affects animation speed.
Weather VaneWeather Vane(Desktop, Console and Mobile versions) 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.

Mighty Wind (Desktop, Console and Mobile versions)

  • Mighty Wind by default will push players mph * 0.0012 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.
  • 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 Main.windPhysics 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.

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 wind mph * 0.36. This will change their x velocity by wind mph * 0.002 pixels per tick, or wind mph * 0.12 pixels per second.

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.

  • References

    1. 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.
    2. Information taken from the Desktop version Desktop 1.4.0.5 source code, method UpdateWeather() in Terraria.Main.cs. There may be inaccuracies, as the current Desktop version Desktop version is 1.4.4.9.