Babada Hen

Irrelevant thoughts on code and games

Better scaling in incrementals

Last time, we looked at the math behind static pricing and linear scaling. There were two other scaling options and this article discusses both: Polynomial growth and exponential growth.

Polynomial cost scaling

If you remember our Gizmos from last time, they updated their cost by 10 every time a player purchased one. The more the player owned, the more expensive they became. Here is the Gizmo’s cost function again:

$$\begin{eqnarray}
gizmoPrice(n) & = & n * 10\\
gizmoPrice(1) & = & 1 * 10 & = 10\\
gizmoPrice(2) & = & 2 * 10 & = 20\\
gizmoPrice(4) & = & 4 * 10 & = 40\\
gizmoPrice(8) & = & 8 * 10 & = 80\\
\end{eqnarray}$$

The function \(n*10\) is interesting. What happens if we tweak it a bit and deliberately scale \(n\)?

$$\begin{eqnarray}
kajiggerPrice(n) & = & 10 * n^{1.1}\\
kajiggerPrice(1) & = & 10 * 1^{1.1} = 10\\
kajiggerPrice(2) & = & 10 * 2^{1.1} = 21.4355\\
kajiggerPrice(4) & = & 10 * 4^{1.1} = 45.9479\\
kajiggerPrice(8) & = & 10 * 8^{1.1} = 98.4916\\
\end{eqnarray}$$

This means that the cost of Kajiggers is growing faster than the cost of Gizmos. The growth pattern here is called polynomial scaling and you can replace the 1.1 with any number greater than 1. If you look at the differences between Kajiggers and Gizmos you can see that we are effectively adding a little extra punch to the cost:

$$\begin{eqnarray}
kajiggerPrice(1) & – & gizmoPrice(1) & = & 10 – 10 & = & 0\\
kajiggerPrice(2) & – & gizmoPrice(2) & = & 21.4355 – 20 & = & 1.4355\\
kajiggerPrice(4) & – & gizmoPrice(4) & = & 45.9479 – 40 & = & 5.9479\\
kajiggerPrice(8) & – & gizmoPrice(8) & = & 98.4916 – 80 & = & 18.4916\\
\end{eqnarray}$$

Conceptually, there isn’t an easy way to describe what is happening after each purchase. What we did was directly muck with the cost function and now we have a fancy polynomial scaling effect. So what does this do to the player’s purchasing power?

The time taken for the first purchase is still 10 clicks. The time taken for the second will be \(21.4355/2 = 10.7177\). The click cost function is:

\begin{eqnarray}
clickCost(n) & = & kajiggerPrice(n) / (1 + n – 1)\\
& = & 10 * n^{1.1} / (1 + n – 1)\\
& = & 10 * n^{1.1} / n\\
& = & 10 * n^{0.1}\\
\end{eqnarray}

The good news is that this solves the transparency issue that Gizmos have. If I have 1,000 Gizmos I knew I had clicked 10,000 times. If I have 1,000 Kajiggers, it means I clicked 18,145 clicks. Good luck doing that math in your head.

The second criticism of linear scaling was that multiple buildings gave the player a significant edge that outscaled the linear scaling’s effect. By adding Whatzits to the game, the scaling effect was halved. So what happens if we add a Kajigger clone? It again effectively halves the scaling effect but now that the scaling effect isn’t linear it doesn’t matter. It will eventually outgrow the effect.

Whether you want to use this type of scaling for your incremental is a personal preference. I don’t think I’ve seen a game explicitly use polynomial scaling — I included it purely for completeness. In theory it should work and I may revisit it in a later article to go over the intricacies of balancing buildings with this sort of scaling.

Exponential cost scaling

What if we switched from adding 10 gold after each purchase? What if we add Doohickeys that start at 10 gold and, each time one is purchased, we added 10% of the cost to the next purchase’s cost? The second Doohickey would cost \(10 * 1.1\) and the third would cost \(10 * 1.1 * 1.1\) and so on. The cost function would then be:

$$\begin{eqnarray}
doohickeyPrice(n) & = & 10 * 1.1^{(n-1)}\\
doohickeyPrice(1) & = & 10 * 1.1^{(1-1)} = 10\\
doohickeyPrice(2) & = & 10 * 1.1^{(2-1)} = 11\\
doohickeyPrice(4) & = & 10 * 1.1^{(4-1)} = 13.31\\
doohickeyPrice(8) & = & 10 * 1.1^{(8-1)} = 19.4872\\
\end{eqnarray}$$

This is probably the most common scaling pattern used in incrementals because it makes the early part of the game fast and fun but will automatically balance itself over time so that the player can never quite get out ahead. This is called exponential scaling because \(n\) has moved into an exponent. The difference between exponential scaling and polynomial scaling is where \(n\) lives. In polynomial scaling, the exponent was over \(n\).

As before, the interesting question is how long it will take for each building to pay for itself. If Doohickeys also increase the gold per click by 1, then the first Doohickey will pay for itself in 10 clicks. The second Doohickey will pay for itself in \(10*1.1 / 2 = 5.5 clicks\). The full function:

$$\begin{eqnarray}
clickCost(n) & = & doohickeyPrice(n) / (1 + n – 1)\\
clickCost(n) & = & 10 * 1.1^{(n-1)} / (1 + n – 1)\\
clickCost(n) & = & 10 * 1.1^{(n-1)} / n\\
\end{eqnarray}$$

If you plot this as a graph it will look something like this. Notice that the graph starts off getting “faster” for the player but eventually the exponential effect of the 1.1 will “kick in” and the player will end up slowing down automatically.

The major benefit of exponential scaling is that scales to such an extreme that players always get slowed down. It doesn’t matter much how the rest of your game is balanced; if you use exponential scaling then the game will eventually “catch up.” That initial “hey, it’s getting faster!” spike happens for each building and then for each combination of buildings as the player realizes that they should only purchase buildings in the order of most beneficial to least beneficial. But as long as all of the buildings are scaling their costs exponentially it should eventually fix itself.

The downside is that an exponent that is too high can cause a late game fatigue where your players feel like they are no longer making any progress. In a sense, the scaling effect can get too powerful and the game is unbalanced the other direction.

The time it would take for the player to go from the 99th Doohickey to the 100th Doohickey is \(10 * 1.1^{(100-1)} / 100 = 1,253 clicks\). If you click 10 times a second it would take you something like 2 minutes of straight clicking. To compare this to the polynomial scaling, going from 99 Kajiggers to 100 Kajiggers only takes \(10 * 100^{0.1} ~ 16 clicks\)

And it gets worse: Purchasing your 200th Doohickey takes over 8.6 million clicks (or 1.4273 weeks of nonstop clicking). The 200th Kajigger takes 16.9865 clicks.

This isn’t a terribly fair comparison, obviously, but it should serve to remind you that choosing an appropriate exponent is critical for a fun, long lasting incremental. But that is a topic for a different article. For now, here is a Wolfram Alpha plot of all four cost functions:

scaling

In upcoming articles, I’ll take a look at balancing polynomial and exponential cost scaling functions with an eye toward keeping the player entertained for as long as possible.

5 Comments

  1. I don’t even know how I ended up here, but I thought this post was great.
    I don’t know who you are but certainly you’re going to a famous blogger
    if you aren’t already ;) Cheers!

  2. Way cool! Some extremely valid points! I appreciate
    you writing this write-up plus the rest of the site is really good.

  3. Hello mates, nice piece of writing and good arguments commented at this place, I am genuinely enjoying bby
    these.

  4. Its like you read my mind! You appear to know so much about this, like you
    wrote the book in it or something. I think that you could
    do with a few pics to drive the message home a bit, bbut other than that, this is
    excellent blog. A fantastic read. I will definitely be back.

Leave a Reply

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2017 Babada Hen

Theme by Anders NorenUp ↑