Thursday, 9 October 2014

Clicker Heroes - Mammon

Summon ancients is a pretty enticing thing to do in Clicker Heroes. Odds are you should be saving up a huge bank of hero souls before you even get into summoning anything more than a couple of level ones, but hero souls are boring and ancients are fun.

Some of the ancients seems really bad, some seem really good, and then there are the ones that don't really seem that good but that you know must actually be good. Mammon is that last kind.

This post is drastically long for its subject matter, so I'm using a break. If you don't want to read a drastically long post about how I derived the results, you can scroll down to the header that says, "Results" and you'll find out how many hero souls you need to have in the bank before Mammon is worth buying.

Mammon gives 5% extra gold per level, he costs his level plus one soul to level up, and he has no maximum level. Adding a percentage to the gold you get just has to be right in the long run. It multiplies with everything else you are doing - if you do more damage, use your abilities more, get bonus gold from another source, get things cheaper, do literally anything in that game, it's multiplied through by the amount of gold you produce in some way or another. Basically even if it cost a million souls to get an extra .001% gold that would have to be worth it at some point.

At 5% for a couple of souls it seems obvious that Mammon is going to be worth it within your lifetime. But when exactly it is right to buy and to level this ancient? If you only have ten souls it might be okay to give up what amounts to 5% of your damage to get 5% more gold, but it probably isn't right to give up another 11.7% of your damage to get another 4.7% gold.

Ballparking is easy, getting the exact numbers is a little more complex. First of all, we need to define when it is right to buy Mammon. To me, the goal of the game is always to maximize damage per second so that you can get to higher zones, so the break point for buying Mammon levels is the point at which the extra gold Mammon has given you allows you to buy the damage you've missed by spending the souls. That is, if you spend 1 of your 10 souls you are doing only 95% of the damage you would have been doing. This is justified if the gold from the level of Mammon allows you to buy levels that increase the amount of damage you do by 5.26%. That would let you do exactly the same damage as if you hadn't bought Mammon. Because Mammon is multiplicative, as you get more souls this will be positive rather than equivalent.

There is no simple conversion from gold to damage. Gold lets you buy more levels and levels make you do more damage. If you have 50 gold you can buy a level of Treebeast and get 5 damage per second. But the cost of each level is exponential. If you want to buy 5 more damage per second you'll need 53 gold. If you want to buy 45 more you'll need 637 gold. But then the next 50 only costs 500 gold because it's an ability rather than more levels.

With different abilities on different heroes, different ratios between starting price and starting damage, and abilities that affect all heroes as well as abilities that affect gold production, the comparison between gold and damage becomes a tangled mess with a lot of "ifs" in it. But at some point all of that noise starts to even itself out and you are left with an endgame state where all of your heroes are high level, you have all the abilities, and buying 25 levels of hero multiplies that heroes damage by 4. Now that is something I can work with.

Of course buying 25 levels also increases the hero's base damage. If Treebeast is level 1000 and you buy 25 levels it doesn't increase Treebeast's damage by a factor of 4, it increases it by a factor of 4 times an additional 1.025. Furthermore, the amount of gold you need to do it isn't a constant factor of the amount you have already spent. The ratio between what you've spent and what you need to spend is actually:
1.07 to the power of n plus 25 minus one over 1.07 to the power of n minus 1
For n being the current level. Both of these problems are lessened by thinking of yourself playing some kind of hyper endgame where your hero levels are very large. As the level of the hero goes to infinity, the damage multiplier for buying 25 more levels goes to four and the cost multiplier for buying 25 levels goes to about 5.427. The numbers don`t even have to get that big. As described above, at level 1000 buying 25 more levels actually gives 4.1 times as much damage, which is a little bit more than four but not a whole lot. The extra cost of buying the levels approaches 5.427 very rapidly. Even at level 200 is equal to 5 significant figures.

So for this endgame state, it`s safe to say that spending 5.427 times as much gold will get you a little bit more than 4 times as much damage. We'll use 4 times as much damage to get a lower limit on how good Mammon is, knowing that he`s a little bit better than we are calculating.

So if we get x% more gold, then that means our gold is multiplied by 1 + .01x which means that our damage in increased by 4 to the power of one over the logarithm base 1 + .01x of 5.427. That allows us to convert gold to damage at least for endgame.

Then we need to know how good that is in terms of hero souls spent. This is pretty easy to do. If k is the ratio between the amount of damage we do with the extra gold and the amount of damage we do without, n is the number of levels we need to spend to get the increase, and x is our current number of hero souls then the increase is equivalent when:
1 plus 0.1 x over 1 + 0.1 time x minus n equals k
Which we can solve for x to get:
10 minus 10 k plus k times n over k minus 1 equals x
For example, if we wanted to know how many souls we should have before it's a good idea to buy the third rank of Mammon we would take the log base 1.15 of 5.427 and take that root of 4 which is about 1.121. Then do the same with 1.1 to find the value of two ranks of Mammon which is about 1.081. Divide to get the marginal gain for the third rank which is about 1.037. Then plug that in as k and 3 in as n in the formula above to get x = 73.85. Since we can't have fractional souls, that means we should buy the third rank of Mammon when we have 74 souls.

Obviously this calls for a spreadsheet. I can't find a way to protect a sheet without protecting an individual cell, so the "Results" sheet is protected and if you want to change the sheet you'll have to go to the ill-named "Parameters" sheet. More on what you'll do with that below.

Looking at the spreadsheet, you should buy Mammon rank two when you have 44 hero souls, rank three at 74, rank four at 107 and so on.

Of course it's more complicated than that. These formulae are great for telling you when to buy rank two and when to buy rank three and when to buy rank twenty, but they are not good at telling you when to buy rank one because rank one doesn't have a fixed cost. Right now for me Mammon is on my list of available ancients but summoning my next ancient costs 70 souls. If you plug in 70 as the cost of buying a 5% gold increase, you find you shouldn't do it until you have 1776 souls. But with that many souls I should be buying Mammon rank 26. Surely there is a point before I get to 1776 souls when it is worth it to buy a lower rank of Mammon.

The trick here is that the formulae I've described tell you when to buy the next soul incrementally. If you ask, "I already have rank two, when should I buy rank three?" the answer is 74 souls. But if buying ranks 1 and 2 were not an option, and it were just a question of when to spend 6 souls to buy 15% more gold, the answer would instead be 46 souls. Because the value of each soul spent decreases compared to the last soul spent, you'll get a lower answer if you look at spending larger blocks of souls at the same time.

So what we need to do use the starting cost of Mammon to determine how many souls you should have before buying a number of levels in one big chunk. This is easy to do with the formula above. Instead of using the marginal increase for a level, use the total increase for that level as k and instead of using the marginal cost of the level, use the total cost including the initial summoning cost.

Then we can see how many souls you should have before you invest in the chunk. So to buy one level of Mammon for 70 souls you need to have 1776 souls in the bank. But to buy two levels for 72 souls you only need to have 949 in the bank. This number continues to drop until level nine at which point it starts increasing again. Basically, once you invest 70 for 5%, two more for an additional 5% is increasing the value of the deal. But when you get up to 114 souls for 45%, then next 10 souls for another 5% is back to the norm - each level is more expensive than the last from a cost-to-benefit perspective.

That's not enough, though. Using this analysis, you would only need 425 souls to buy into Mammon at a starting price of 70 and you'd buy in for nine levels. The problem is that you still need to ask whether it is worth buying that ninth level from a marginal perspective. It may be worth it to buy 9 levels for 114 souls, but is it worth it to buy the ninth level for 9 when you already have eight levels? In this case it is, and it turns out that looking at the actual numbers you run into it pretty much always is. For small initial costs like two and four, the buy-in point for is actually lower than the number of souls to buy that marginal level but the difference is so small that it ends up being the same whole number of souls. For example, at an initial cost of two you should buy in for two ranks with just 43.2 souls, but you shouldn't actually buy the second rank until you have 43.4 souls. Fortunately you should do both with 44 souls and should do neither with 43, so the conflict never comes up.


So, to find out if you should buy Mammon with your current number of souls, download the spreadsheet or open it. Go to the Parameters tab and enter the initial cost of summoning Mammon, then look down the "Buy-In" column on the Results sheet to find the point when it is smallest. When you have that many souls, buy Mammon to that level. From then on, use the "Breakpoint" column to figure out when to buy the next level, regardless of what you bought in for.

What nice about this is that because Mammon multiplies with everything in the game, you really don't have to worry about what you are doing with the rest of your souls. No matter what you are spending them on and what bonuses you have, these will still be the breakpoints. That doesn't guarantee that Mammon is the best thing to buy, only that it is better to buy Mammon than to not buy Mammon at those point.

It is a much more complicated discussion to decide whether the increase to the summoning cost of your next ancient is justified by the bonus from Mammon. But eventually you are going to summon every ancient, so that's just a sunk cost.


  1. You're not going to summon the ancient who's only purpose is to make treasure chests take longer to kill!

  2. You're not getting to summon the traditional who\'s solely purpose is to create treasure chests take longer to kill!