{"id":3088,"date":"2016-04-03T23:14:03","date_gmt":"2016-04-04T06:14:03","guid":{"rendered":"http:\/\/www.wurb.com\/stack\/?p=3088"},"modified":"2017-06-07T13:33:16","modified_gmt":"2017-06-07T20:33:16","slug":"gemcraft-some-vague-math","status":"publish","type":"post","link":"https:\/\/www.wurb.com\/stack\/archives\/3088","title":{"rendered":"Gemcraft: Some Vague Math"},"content":{"rendered":"<p>OK, I started talking before about how the exponentially-stronger enemies in <em>Gemcraft: Chasing Shadows<\/em> inevitably overtake the player. That&#8217;s a good safe way to design things where the numbers get arbitrarily large; it&#8217;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 &#8220;Endurance mode&#8221;, which means letting additional waves keep coming for as long as you&#8217;re capable of fending them off, the better to rack up lots of XP. In this mode, I&#8217;ve seen it get to the point where it&#8217;s expressing enemy hit points in scientific notation.<\/p>\n<p>I&#8217;d like to go into more detail about the efficiency of gems, and how it&#8217;s possible to keep pace with the exponentiation for longer.<\/p>\n<p>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&#8217;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.<\/p>\n<p>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 <em>more<\/em> than twice that of a grade n gem, it may seem like it&#8217;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&#8217;s only so much space on the board. I&#8217;ve been routinely getting my strongest gems above grade 20 lately, and there&#8217;s no way to deploy 2^20 grade 1 gems, because that&#8217;s more than a million gems. Also, high-grade gems fire more shots per second than low-grade ones, although there&#8217;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&#8217;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.<\/p>\n<p>Regardless, the cost of gems rises exponentially with level, and the damage they do also rises approximately exponentially. I haven&#8217;t crunched the numbers, so the &#8220;approximately&#8221; there could be hiding a significant factor, like a penalty that increases with the grade. But let&#8217;s assume it doesn&#8217;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&#8217;ve collected.<\/p>\n<p>Yellow gems increase this by doing critical hits some of the time. In the original <em>Gemcraft<\/em>, 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&#8217;t mean a lot in the exponential world of <em>Chasing Shadows<\/em>, 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&#8217;ve collected. This is clearly going to track the increases in enemy strength for longer.<\/p>\n<p>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 &#8212; 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 &#8212; which is to say, it increases logarithmically with the mana you&#8217;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&#8217;s call the end result log(n)^3. It&#8217;s a bonus worth getting, but in the long run, it&#8217;s going to be insignificant compared to the quadratic and even linear increases from just upgrading ordinary gems. I&#8217;ve seen it said online that the multipliers from black gems start outstripping white gems at around grade 30, but I haven&#8217;t got there yet.<\/p>\n<p>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&#8217;ve collected? Wouldn&#8217;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 <em>faster<\/em> 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&#8217;t seem unreasonable that a player could figure out some trick to provide it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OK, I started talking before about how the exponentially-stronger enemies in Gemcraft: Chasing Shadows inevitably overtake the player. That&#8217;s a good safe way to design things where the numbers get arbitrarily large; it&#8217;s the cornerstone of the Clicker genre, for example. And this is certainly a game where numbers can get large. After you win [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[460,563,557],"class_list":["post-3088","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-gemcraft","tag-gemcraft-chasing-shadows","tag-math"],"_links":{"self":[{"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/posts\/3088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/comments?post=3088"}],"version-history":[{"count":11,"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/posts\/3088\/revisions"}],"predecessor-version":[{"id":5235,"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/posts\/3088\/revisions\/5235"}],"wp:attachment":[{"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/media?parent=3088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/categories?post=3088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wurb.com\/stack\/wp-json\/wp\/v2\/tags?post=3088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}