Gemcraft: Some Vague Math

OK, I started talking before about how the exponentially-stronger enemies in Gemcraft: Chasing Shadows inevitably overtake the player. That’s a good safe way to design things where the numbers get arbitrarily large; it’s the cornerstone of the Clicker genre, for example. And this is certainly a game where numbers can get large. After you win a battle, you have the option to keep going in “Endurance mode”, which means letting additional waves keep coming for as long as you’re capable of fending them off, the better to rack up lots of XP. In this mode, I’ve seen it get to the point where it’s expressing enemy hit points in scientific notation.

I’d like to go into more detail about the efficiency of gems, and how it’s possible to keep pace with the exponentiation for longer.

First of all, more powerful grades of gem are created by fusing gems. In general, you make a grade n+1 gem by fusing two grade n gems. There’s a hotkey for upgrading a gem, but using it is exactly equivalent, in both effect and cost, to creating a duplicate of the gem and then fusing them. Creating a grade 1 gem and fusing two gems are both primitive actions that cost a fixed amount of mana. Creating a grade n gem from these primitives would require 2^(n-1) grade 1 gem creations and 2^(n-1)-1 fusions.

Now, the damage that a gem does per hit varies with the color of the gem, but one thing is consistent: the damage per hit of a grade n+1 gem is less than twice that of a grade n gem. Given that the cost of a grade n+1 gem is more than twice that of a grade n gem, it may seem like it’s always worthwhile to deploy multiple low-grade gems rather than a few high-grade ones. But there are several confounding factors. For one thing, there’s only so much space on the board. I’ve been routinely getting my strongest gems above grade 20 lately, and there’s no way to deploy 2^20 grade 1 gems, because that’s more than a million gems. Also, high-grade gems fire more shots per second than low-grade ones, although there’s a cap to that. Sometimes you need to do lots of damage in one hit to punch through armor or overwhelm regeneration effects. There’s a trick where you cast a beam spell on a mana-leeching gem to get lots of mana-leeching done at once, and you need a high-level mana-leeching gem to get the most out of that.

Regardless, the cost of gems rises exponentially with level, and the damage they do also rises approximately exponentially. I haven’t crunched the numbers, so the “approximately” there could be hiding a significant factor, like a penalty that increases with the grade. But let’s assume it doesn’t and say that the two exponentials cancel out and the resulting damage-per-second-per-cost is basically constant. That means that the damage you can put out is proportional to the mana you’ve collected.

Yellow gems increase this by doing critical hits some of the time. In the original Gemcraft, with its overall lower numbers, critical hits were simply triple damage, and the chance of getting a crit increased with the grade of gem. But triple damage doesn’t mean a lot in the exponential world of Chasing Shadows, so it works differently: the grade increases the crit multiplier. (The chance of a crit still increases with grade, but caps out at 80% before too long.) The multiplier increases in the same not-quite-doubling way as the base damage, so the overall damage from yellow gems is proportional to the square of the mana you’ve collected. This is clearly going to track the increases in enemy strength for longer.

Add a white component, and you have an additional factor, which is harder to analyze. White gems give an additional multiplier to both damage and specials — which is to say, on a yellow gem, it increases damage twice, once as a bonus to the base damage and once as a bonus to the crit multiplier. However, this multiplier increases only linearly with gem grade — which is to say, it increases logarithmically with the mana you’ve invested in it. It also increases with the size of your mana pool, but that also only increases at exponentially increasing intervals, so let’s call the end result log(n)^3. It’s a bonus worth getting, but in the long run, it’s going to be insignificant compared to the quadratic and even linear increases from just upgrading ordinary gems. I’ve seen it said online that the multipliers from black gems start outstripping white gems at around grade 30, but I haven’t got there yet.

Orange gems increase the rate at which you collect mana. Each hit from an orange gem gives you a fixed amount of mana that increases with the grade of gem at a less-than-doubling rate, just like the damage does. So with orange gems, your rate of mana collection is proportional to the amount of mana you’ve collected? Wouldn’t this yield exponential growth, potentially disrupting the Clicker-like guarantee of eventually losing that I described earlier? I suppose that as long as the enemies are getting tougher at a faster exponential rate than your mana collection, they still win. But it seems risky: all it takes to make one exponential function greater than another is a sufficiently large constant scaling factor, and the rules here are complicated enough that it doesn’t seem unreasonable that a player could figure out some trick to provide it.

No Comments

Leave a reply