Breath meter

From Terraria Wiki
Jump to navigation Jump to search
Breathe.png
An air bubble

The breath meter appears when a player's head is under either water or honey, representing the time the player has until they begin drowning. The breath meter consists of 10 (Nintendo 3DS version 5) air bubbles (one shown on the right) which fade and disappear gradually as long as the character's head is submerged. When the breath meter is depleted, the player begins to drown and health is lost. The breath meter will start refilling as soon as the player emerges from liquid. It refills at a fixed speed, taking 1.11 seconds to refill from empty to full.[1]

For breathing purposes, the player is considered "in liquid" when the pixel right above their eye is under liquid surface. This roughly correlates to just a pixel above where the liquid will be if the player stands in two full tiles of liquid with a tile of air in the third tile they occupy. In older versions and the Old-gen console version Old-gen console version, this was actually the very top pixel of the head. It was changed to prevent players from drowning when their head bumped liquid-filled blocks.

Breathing time

The breath meter's duration changes depending on which breathing equipment or potions are used. Times shown below are in real-world time (not game time).

  • Without any equipment, the breath meter lasts for 23.33 seconds.
  • With a Breathing Reed, breathing time is doubled to 46.67 seconds.
  • While wearing diving equipment, the breath meter lasts (Desktop, Console and Mobile versions) 140 seconds (i.e. 2 minutes 20 seconds) or (Old-gen console and 3DS versions) 93.33 seconds (i.e. 1 minute 33 seconds).
  • When both the Breathing Reed and diving equipment are used, the breath meter lasts (Desktop, Console and Mobile versions) 280 seconds (i.e. 4 minutes 40 seconds) or (Old-gen console and 3DS versions) 186.67 seconds (i.e. 3 minutes 6 seconds).
  • Neptune's Shell and its upgrades – Moon Shell and Celestial Shell – eliminate the breath meter while in liquids, making breathing time unlimited.
  • The Gills Potion eliminates the breath meter while in liquids for the length of the buff (4 minutes in total).

Technical explanation

Every player in Terraria bears two attributes called breath and breathCD. breath is initially (i.e, upon every spawn) set to a constant value of 200 and breathCD to 0. When the player is detected to be submerged in water or honey and neither the Gills buff nor the Merfolk buff is active/applicable, breathCD is incremented by 1. This happens every tick[2] and as soon as breathCD surpasses a certain limit, breathCD is reset to 0 and breath is reduced by 1. The limit of breathCD is 7 by default, multiplied by 2 to 14 if a Breathing Reed is held and further multiplied (Desktop, Console and Mobile versions) by 6 to 42 or 84 / (Old-gen console and 3DS versions) by 4 to 28 or 56 if diving equipment is equipped (also checked and updated every tick). As soon as breathCD hits the limit, breath is decremented by 1. This is repeated until breath reaches 0, at which point the player starts drowning. In result, it takes breath * limit ticks until breath reaches 0.[3]

Notes

  • If a Fish Bowl is worn in the equipment slot, the breath meter appears because the player's head is technically underwater. Breathing equipment and potions can still be used to counter this effect.
  • The lava timer from the Lava Charm and its derivatives overrides the breath meter visually. This means that if the player's head is in water and the feet are in lava, the player will lose breath without seeing the breath meter.

History

  • Desktop 1.2: Lava no longer activates the breath meter, allowing players using Obsidian Skin potions or other means to survive under it indefinitely.

References

  1. Information taken from the Desktop version Desktop 1.4.4.9 source code, method CheckDrowning() in Terraria.Player.cs. After emerging from liquid, the internal player variable breath (see Technical explanation below) is increased by 3 every tick. Since the maximum value of breath (i.e. a full breath meter) is 200, it takes 200 / 3 = 66.67 ticks (1.11 seconds) to refill from zero. If the breath meter is half full, it takes 100 / 3 = 33.33 ticks (0.56 seconds) to refill.
    In other words, 1.5% of the breath meter is refilled each tick (200 / 3 = 100 / 1.5).
  2. 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.
  3. Information taken from the Desktop version Desktop 1.4.4.9 source code, method CheckDrowning() in Terraria.Player.cs and property breathCDMax in Terraria.Player.cs.