How "chance to not consume ammo" works (Explanation)

Samrux

Santa Claus


DungeonPaladin.gif
How does reduced ammo consumption work in Terraria?

It's a question that has been baffling me ever since I first joined Terraria, more than three years ago. You see, there are various items in Terraria that give a specified "chance to not consume ammo". The Minishark and Megashark both have an innate reduced ammo usage (33% savings and 50% savings, respectively), but this percentage can be stacked with other bonuses, such as the Ammo Box, a potion, and ranger armor. The real question has always been; "How do these bonuses stack?"
index.php


Now, here comes a problem: If these bonuses were added together (50 + 20 + 20 + 20) it would be very easy to reach over 100% ammo reduction, rendering the user with infinite ammunition.
It is no different if we try and calculate the bonus by multiplying them together (0.5 x 1.2 x 1.2 x 1.2); it is still very easy to go over 100% ammo reduction.
Of course, we know from testing that this isn't the case, since ammunition is always consumed no matter how many bonuses we stack! So the chance to not to consume ammo definitely can't go over 100% in the current version of Terraria. So how is the chance calculated? How can we optimize our chances to not consume ammunition?





PH-_
The concept

The answer relies on probabilities and statistics. You see, the bonuses are not calculated together directly, but are rather put one after the other in different "checks". Here is an example: Imagine you are using the following ammo-reducing items:
Megashark.png
(50%) +
Shroomite_Breastplate.png
(20%) +
Ammo_Box.png
(20%)

The game first checks the Megashark. There is a 50% chance of not consuming that bullet, so RNG will create a number between 1 and 100. If it is 50 or lesser, the bullet is preserved instantly. If it is 51 or greater, the game tries to check the next ammo-reducing item.
The Shroomite Breastplate has a 20% chance to not consume ammo. So RNG, again, creates a number between 1 and 100. If it is 20 or lesser, the bullet is preserved instantly this time. If it is 21 or greater, the game checks the next item.
Again, a number is generated for our Ammo Box. If it is 20 or less, the bullet is preserved. If it instead is 21 or more, and since we don't have any more items to help us, the bullet is consumed regardless. If the bullet is consumed, it means that the calculation has bypassed all our different "ammo defenses".

This can be exampled with an analogy. Imagine a castle with several layers of walls protecting it. To enter the castle, you'd need to break through the first wall, then the second, then the third. But if at any point you failed to break any of the walls, then you wouldn't be able to reach the castle. Every wall is equivalent to a chance to not consume ammo, and reaching the castle would signify consuming the ammo.


Concluding the idea: For the bullet to have been consumed, it had to avoid being stopped by all the item's percentages separately; the megashark, the breastplate, and the ammo box. If all items failed to preserve the bullet one after the other, and we have no more items reducing our ammo usage, the ammunition is consumed.
index.php
If it instead is stopped at any point during the checks (our "defenses"), it is preserved.





PH-_
The math

So, the game goes item by item when calculating when to and when not to use your ammo
...but how can this be calculated, as a real, final percentage? Using probabilities!
index.php


>100% is akin to 1, 50% to 0.5, 10% to 0.1, and so on.
>To know the chance of something not happening, we first need to know the chance of it actually occurring, and subtract that from 1 (the total).
>To know the chance of several events happening together, we multiply the chances of those individual events with each other.

index.php
Let's apply this to Terraria. So, to calculate the chance of consuming ammo for our example:
  • There is a 0.5 chance (1 - 0.5) to consume ammo with the Megashark.
  • There is a 0.8 chance (1 - 0.2) to consume ammo with the Shroomite Breastplate
  • There is a 0.8 chance (1 - 0.2) to consume ammo with the Ammo Box
  • Since all of those events have to occur together, one after the other, for the ammo to not be consumed, we multiply them: 0.5 x 0.8 x 0.8 = 0.32 (32% is the chance to use the ammo)
  • Finally, to convert this from consuming to preserving ammo, we do 1 - 0.32 = 0.68
= 68% chance to save ammo


index.php
Concluding that, with a 50% chance, a 20% chance, and another 20% chance, the final chance to not consume ammo is, in fact, 68%



Compared to adding or multiplying chances together directly, only 68% is actually not very much of an improvement.
index.php
In fact, the added chance gets progressively smaller as we add more and more items (and more work). The maximum chance to not consume ammo we can have with the Megashark (as of PC version 1.3.0.7) is:

Megashark.png
+
Vortex_Breastplate.png
+
Chlorophyte_Helmet.png
+
Ammo_Box.png
+
Ammo_Reservation_Potion.png

1 - (0.5 x 0.75 x 0.8 x 0.8 x 0.8) =
1 - (0.5 x 0.75 x 0.8 x 0.8 x 0.8) = 80.8% chance to not consume ammo


Which turns an extra 5% from the improved breastplate, an added 20% from the potion, and another added 20% from the helmet, into a total 22% increase from our previous 68%. It sure goes up (specially compared to our initial 50%), but keep in mind that to save more and more ammo, you have to put more and more work into it. In general, the potion buff is the hardest to keep active, since it requires a constant supply of materials (and farming for them). If you take that into account, you'll get more satisfying results!


Here is an amazing online calculator you can use yourself. You can paste the calculations used in this post directly into it, or try your own combinations.




PH-_
Guide on Ammo Usage Reduction bonus

For reference, here is a table with all the possible sources of reduced ammo usage. They can all be stacked with each other. However:
  1. Logically, you can't equip more than a single helmet, breastplate, or leggings at the same time. Similarly, you can only use one weapon at a time.
  2. If you have the Chlorophyte Helmet and the Shroomite Breastplate both equipped at the same time, only one of them will be counted, and the other, ignored. This is a fault in the game's coding. The Vortex Breastplate doesn't have this issue, and stacks properly with the Chlorophyte Helmet (as far as we are aware of).


Item picture
| Item Name | Type | Chance not to consume ammo (%)
Necro_armor.png
Cobalt_armor_Mask.png
Mythril_armor_Hat.png
|Necro Armor, or Ranged Cobalt/Mythril/Chlorophyte armor|Full armor equipped|20%
Female_Adamantite_Mask.png
Hallowed_armor_Helmet.png
|Ranged Adamantite/Hallowed armor|Full armor equipped|25%
Chlorophyte_Helmet.png
Shroomite_Breastplate.png
|Chlorophyte Helmet/Shroomite Breastplate|Armor piece (These two don't stack)|20%
Vortex_Breastplate.png
|Vortex Breastplate|Armor piece|25%
Ammo_Box.png
Ammo_Box_%28buff%29.png
|Ammo Box|Buff (reusable, lasts 10 minutes)|20%
Ammo_Reservation_Potion.png
Ammo_Reservation.png
|Ammo Reservation Potion|Buff (consumable, lasts 7 minutes)|20%
Magic_Quiver.png
|Magic Quiver|Accessory (Only applies to bows)|20%
Minishark.png
Candy_Corn_Rifle.png
|Minishark/Candy Corn Rifle|Weapon|33%
machineguns.png
|Gatligator/Megashark/Chain Gun/S.D.M.G.|Weapon|50%
Phantasm.png
Vortex_Beater.png
|Phantasm/Vortex Beater|Weapon|66%





PH-_
The aftermath, and a little more math

The final question now is: What is the absolute maximum chance not to consume ammo in Terraria? That honor goes to the Phantasm, with a 66% innate reduction and access to the Magic Quiver:

Phantasm.png
+
Vortex_Breastplate.png
+
Chlorophyte_Helmet.png
+
Magic_Quiver.png
* +
Ammo_Box.png
+
Ammo_Reservation_Potion.png

1 - (0.34 x 0.75 x 0.8 x 0.8 x 0.8 x 0.8) =
1 - (0.34 x 0.75 x 0.8 x 0.8 x 0.8 x 0.8) = 89.55% chance to save ammo



The way additional items affect the final percentage is clearly showcased in this following list, complementing our previous "math" section, and for easy comparison:
  • Phantasm Alone = 66% chance to not consume ammo (base)
  • Phantasm + Vortex Armor = 75% chance to not consume ammo (9% increase)
  • Phantasm + Vortex + 1 other item = 80% chance (5% increase)
  • Phantasm + Vortex + 2 other items = 84% chance (4% increase)
  • Phantasm + Vortex + 3 other items = 87% chance (3% increase)
  • P. + V. + 3 other items + Magic Quiver = 90% chance (3% increase)
  • S.D.M.G alone = 50% chance to not consume ammo (base)
  • S.D.M.G. + Vortex Armor = 63% chance (13% increase)
  • S.D.M.G. + Vortex + 1 other item = 70% chance (7% increase)
  • S.D.M.G. + Vortex + 2 other items = 76% chance (6% increase)
  • S.D.M.G. + Vortex + 3 other items = 81% chance (5% increase)
  • Tactical Shotgun alone = 0% (no base bonus)
  • Tactical Shotgun + Vortex Armor = 25% chance to not consume ammo (25% increase)
  • Tactical Shotgun + Vortex + 1 other item = 40% chance (15% increase)
  • Tactical Shotgun + Vortex + 2 other items = 52% chance (12% increase)
  • Tactical Shotgun + Vortex + 3 other items = 62% chance (10% increase)
  • Tsunami + Vortex + 3 other items + Magic Quiver = 69% chance (7% increase)
Replace SDMG with Megashark, Galtigator or Chain Gun for same results.
Replace Phantasm with Vortex Beater for same results, but ignore the quiver.
Replace Tactical Shotgun or Tsunami for any other ranged weapon without innate savings, for same results.

(Results are rounded up or down accordingly)









-_PH
Conclusion
-_PH


If you want to spend the lowest possible amount of ammo, grab a Phantasm or Vortex Beater, and some Vortex Armor (breastplate included). That will put you at about 75% chance to not consume ammo. Having the Ammo Box and Ammo Reservation Potion buffs active at all times will add another 10% to that, which might or not be worth the hassle, depending on your opinion.
The added chance to save ammunition is much more noticeable in weapons that don't naturally get a bonus, though; making the ammo box and potion raise your chances to save ammo from 25% to 40%.
However, while the Chlorophyte Helmet (and Magic Quiver, for bows only) further reduce your chances of consuming ammunition, they might also hinder your DPS. And remember that one of the best ways to save ammo is to kill things quickly!

index.php


Concluding Note:
Having the numbers and facts in front of you, it is for you to decide if putting work into saving ammo will be worth it. What will take you more time; putting effort into obtaining ammo, or into saving it? And will lowering your DPS actually increase the amount of ammo you use overall, breaking the point?

You could also ignore this thread altogether, and use an endless musket pouch or endless quiver, instead
index.php
(Don't, they have terrible damage)
Endless_Musket_Pouch.png
Endless_Quiver.png








Many thanks to the Official Terraria Wiki for providing the exact percentage values, and all the item images inside this post.
The calculations and conclusions present in this post were first theorized by me, and supported by other sources (users) on several different places across a large span of Terraria's history. Finally and definitely, the method explained in this post was confirmed by looking at the game's code.

And Thank you for reading.
index.php


Disclaimer: This post was my attempt at making a comprehensible and updated thread about the subject, open for any user of the forum to see and easily access. This post contains PC-exclusive content, but no console-exclusive content. This post, in its entirety, was written and organized by me, but I am merely providing the reader with the information. Please notice I was not the first to theorize or discover this information. Mistakes in my math were corrected by users in this thread: Thanks! An additional thanks to W1K for confirming the veracity of this thread's claims.

 
Last edited:
Math and probability have always been my favorites. Too bad rng goes against the odds quite often for me. %:sigh:
So many bullets/arrows are done per minute that overall, your ammo consumption will be average compared to the expected. We could throw away the RNG factor altogether and get practically exact results on all computers (with the same calculations, of course)
 
So many bullets/arrows are done per minute that overall, your ammo consumption will be average compared to the expected. We could throw away the RNG factor altogether and get practically exact results on all computers (with the same calculations, of course)
When firing the SDMG, it dosn't even look like the number ever stops going down. I know it fires hilariously fast, but it still looks and feels odd, considering I put so much effort into getting all the reduced ammo buffs.
 
Really, RNG is a troll, you sometimes get what you want, but sometimes, you get what you want time after you got something you didn't want, that means everything is same, just the moment is different.
 
The first time, I was checking into this was when I got my first Coin Gun, it's very useful to know how ammo preservation works before using it. especially if you're going to use platinum coins, though in my experience IF you're going to use a Coin Gun and IF you're going to use Platinum Coins is because you don't have problems with spending coins, anyway there's additional info I didn't know!, so thanks
 
When firing the SDMG, it dosn't even look like the number ever stops going down. I know it fires hilariously fast, but it still looks and feels odd, considering I put so much effort into getting all the reduced ammo buffs.
Considering you're getting around 63% ammo reduction tops, and that the S.D.M.G. fires 12 bullets per second (15 if it is unreal), it is only normal. Don't worry. You can instead focus more on critical hits, to spend less ammo as stuff dies faster
index.php


Critical hits over damage is something for another time, though. For now, let's just say they're basically the same.
 
I'm sorry, the post completely messed up and I had to reformat it all again by hand. It looked very ugly for a few minutes.
 
Considering you're getting around 63% ammo reduction tops, and that the S.D.M.G. fires 12 bullets per second (15 if it is unreal), it is only normal. Don't worry. You can instead focus more on critical hits, to spend less ammo as stuff dies faster
index.php


Critical hits over damage is something for another time, though. For now, let's just say they're basically the same.
That paladin with the tounge is the cutest thing ever
 
Nice maths, understood the concept already but you explained it well for those who are stronger in other skills.
 
Sorry to tell you this, but your math is wrong.

To calculate the chance of NOT consuming ammo, you take the chance of CONSUMING ammo, and multiply it by the other chances of CONSUMING ammo. Then subtract the final chance of CONSUMING ammo from 100% to get the chance of NOT consuming ammo. So say we have the Megashark/Shroomite Breastplate/Ammo Box. you have a base 100% chance of CONSUMING ammo, multiplied by 50% for the Megashark, 80% for the Shroomite Breastplate, and 80% for the Ammo Box. This results in a 32% chance of CONSUMING ammo, meaning a 68% chance of NOT consuming ammo.

For the combination of Vortex Armor and either the Vortex Beater or Phantasm, you have a 75% chance of NOT consuming ammo. An Ammo Box raises this chance to 80%.

If you go with Phantasm/Vortex Breastplate/Chlorophyte Helmet/Magic Quiver/Ammo Box/Ammo Reservation Potion, you get a 89.76% chance of NOT consuming ammo.
 
Sorry to tell you this, but your math is wrong.

To calculate the chance of NOT consuming ammo, you take the chance of CONSUMING ammo, and multiply it by the other chances of CONSUMING ammo. Then subtract the final chance of CONSUMING ammo from 100% to get the chance of NOT consuming ammo. So say we have the Megashark/Shroomite Breastplate/Ammo Box. you have a base 100% chance of CONSUMING ammo, multiplied by 50% for the Megashark, 80% for the Shroomite Breastplate, and 80% for the Ammo Box. This results in a 32% chance of CONSUMING ammo, meaning a 68% chance of NOT consuming ammo.

For the combination of Vortex Armor and either the Vortex Beater or Phantasm, you have a 75% chance of NOT consuming ammo. An Ammo Box raises this chance to 80%.

If you go with Phantasm/Vortex Breastplate/Chlorophyte Helmet/Magic Quiver/Ammo Box/Ammo Reservation Potion, you get a 89.76% chance of NOT consuming ammo.
While I understand the point you're getting at; I'm pretty sure math works in reverse too. Calculating a chance and its inverse shouldn't yield different results depending on which point of view you're using, since for math, there is no original and inverse, both are equally true. It is us that decide which of the two values is the inverse. Under this ideology, both methods, if done correctly and under the same rules, should yield the exact same results. For example, if the chance to save ammo gave me 40%, the chance to consume it shoud prove to be 60% once calculated.

I could be completely and uglyly wrong, but for now, I have faith in my calculations, which, under all my common-sensed analysis, appear to make sense. Can a few more people with experience come and certify Alaron's claims?
 
While I understand the point you're getting at; I'm pretty sure math works in reverse too. Calculating a chance and its inverse shouldn't yield different results depending on which point of view you're using, since for math, there is no original and inverse, both are equally true. It is us that decide which of the two values is the inverse.

I could be completely and uglyly wrong, but for now, I have faith in my calculations, which, under all my common-sensed analysis, appear to make sense. Can a few more with more experience come and certify Alaron's claims?
*raises hand slowly*

Umm... After seeing his post and looking back at yours, his math seems to check out. Going back to the first example (megashark + shroomite + ammo box), you'd start with the megashark, which would only consume ammo 50% of the time. Next for shroomite armor, you take away 20% or one fifth of that 50% (one fifth of 50 is 10, and taking that away leaves you with 40%). Do the same thing for the ammo box: one fifth of 40 is 8, and taking that away leaves you with a 32% to consume ammo. I'm pretty sure this is how it works, it makes the most sense without letting you get a 100% chance to not consume ammo (of course I don't really have anyway to test this myself). Sorry... :(
 
I think it's as simple as multiplying the inverse of the chances to not consume ammo, and inverting the outcome.
(that sounded a lot simpler in my head...)
For the highest chance to not consume ammo, it should be 0.33 x 0.75 x 0.8 x 0.8 x 0.8 x 0.8. Putting that mess into a calculator gave me 0.101376, which means about a 90% chance not to consume ammo.
 
Back
Top Bottom