by Wolfgang Graebner on 04/02/14 08:10:00 am

The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

In Clash of Clans (a super popular social building / defending game by Supercell) players can speed up actions such as building, upgrading or training troops with gems that can be bought for real money. They're basically monetizing the player's impatience. Every social building game I know of does it.

I set out to learn more about the hidden formulas at work and then blogged about it on my site allworkallplay.org. This is how CoC puts a price on time.

This line graph shows how many gems it costs to skip time. More time = more gems. As expected.

But there's a catch. It looks like the price increases exponentially. This is misleading! It only looks that way because the difference between 60 seconds (1 minute) and 604,800 seconds (1 week) is so vast. The time is increasing exponentially and it's distorting the data.

Switching from line graph to a scatter graph gives a more truthful picture. The horizontal time axis is scaled evenly. But it's hard to tell what's going now in the bottom-left corner now. The values are so bunched up you can't tell them apart anymore.

Let's try interpreting the data differently. Think of it in terms of cost in gems to skip 1 second. *Skipping more time costs more money, but you get a better deal*. Think of it as a set of increasing discounts.

My testing has shown that *the pricing algorithm graph consists of a series of linear line segments*. They are not simplified versions of curved graphs. I will explain why later.

To start, all we need to do is create a neat little table like this with your desired prices, and then I will show you how to use linear interpolation to calculate any other price.

It's a nice system. Breaking the pricing down into chunks of time that make sense to humans (hour/day/week) makes it easy to visualize. Everybody knows what it feels like to have to wait a day. It's also very easy to tune. If you change your mind later and decide that 1 day should cost more, all you need to do is update 1 value.

*The nice thing about using a linear segment graph is that it allows you to set and tweak specific price points.*

So let's turn it into a formula that we can turn into a graph.

We start simple enough with the basic formula to find the equation of a line:

From there we can work out the equation of a line between 2 points (x_{i} , y_{i}) and (x_{i+1} , y_{i+1}).

x, the horizontal axis, is time. y, the vertical axis, is gems.

With this information, we're ready to start substituting values. Using Clash of Clans' data, let's say for example you want 1hr (3,600 seconds) to cost 20 gems, and 1 day (86,400 seconds) to cost 260 gems. We can thus specify a function for such a line segment.

We can use this function to find the cost of any time between 1hr and 1 day. For example to find the cost of speeding up 4 hours, substitute x = 14,400 seconds and you get y = 51 gems.

All the formulas for the individual line segments can be combined into one very large piecewise function.

*This is the CoC gems -> time conversion rate formula.*

To enter it into excel, copy-paste this long formula into cell B1. If you then enter an amount of time in seconds in cell A1, the cost in gems will appear in B1.

=ROUND(IF($A$2=0,0,IF($A$2<=60,1,IF($A$2<=3600,((20-1)/(3600-60))*($A$2-60)+1,IF($A$2<=86400,((260-20)/(86400-3600))*($A$2-3600)+20,((1000-260)/(604800-86400))*($A$2-86400)+260)))),0)

**Try a live demo** using the Excel Web App. Double click the time to edit it and watch the cost in gems update.

So far I've just been talking in terms of CoC's ingame currency "gems". But gems are bought in the store for money, so we can put a price on them. This is how Supercell prices gems.

The cost per gem actually decreases the more you buy, but more about discounts later. For now I'm going to simplify things a little and use the average cost: £0.0055 per gem.

This is super useful because now *we can use the formulas from before to set real-world prices for things*. Someone at Supercell decided that in CoC a 1 day skip should cost on average £1.43 and 1 week £5.49. If we wanted to make a change, we could for example change the price of 1 day to £2.00 and have everything else update automatically. It's a really convenient and logical way to tune the game's monetization.

*(Brief and mostly unrelated side note: have you ever wondered why companies like Supercell or Microsoft love using abstract virtual currencies with perplexing exchange rates? During my research I came across a great article on the psychology behind such virtual currencies. It's too good not to share. Read part 1 here, and part 2 here.)*

**Discounts**

The gem pack sizes are fixed. You can't buy 501 gems. You have to either get the 500 or the 1,200 pack. Regardless, I though it interesting to view it as a graph.

It's hard to see, but the line actually gets slightly less steep the more you buy. Supercell is giving you a discount if you buy a larger quantity.

You save a 16.4% for buying a pack of 14,000 when compared to the price of the 500 pack.

When you compare the discounts for buying gems to the discounts for skipping time, it becomes obvious that *the discount for skipping a longer time-piece is far more generous than the discount for buying a larger gem pack*.

You save a massive 90.1% buying a 1 week time skip when compared to the price of skipping 1 minute.

It's worth noting that the discount difference between 1 minute and 1 hour is 66.7%, but the discount difference between 1 hour and 1 week is only 23.4%. Instead of thinking of 1+ days as highly discounted, we could think of it the opposite way: 1-59 minute skips are overly expensive. Why are they so overpriced? I don't have a definitive answer... my hunch is that only the most impatient of players are willing to buy such short skips. They may also be the most willing to spend, so perhaps its a little bit of price discrimination at work? I'm not sure. I wish I had a better answer. Leave me a comment if you think you know better! :)

If you buy gems, and then use them to skip time, the discounts stack.

The worst deal you can get is to buy 500 gems for £2.99 and then use it to skip a 1 minute timer. You have just paid £0.000100 per second you skipped.

The best deal you can get is to buy 14,000 gems for £69.99 and then use it to skip a 1 week timer. You have just paid £0.000008 per second you skipped.

That's a price difference of 91.7%.

The cost per second sounds like a tiny insignificant amount, but when you are skipping 604,800 seconds it adds up. If you were charged the same rate for skipping 1 week as for 1 minute, it would cost you £60 instead of £5!!

*The generous discount for skipping longer stretches of time is essential. Without it prices would quickly become prohibitive and nobody would buy them.*

That's what I think Supercell must have realized. They needed a way to heavily discount long skips that is easy to tune. Linear segmented graphs are a great solution.

There are other ways Supercell could have done it. Considering alternative solutions teaches us more about the pros and cons of their method.

My first thought was to use a simple linear graph. Then there would just be a gems -> time conversion rate, like there is for $ -> £.

It's possible, but the cost of skipping 1 day would fall by 61.5% from 260 gems to 100 gems. Or, if you wanted to keep the 1 day price at 260 gems, the line would have to rise more steeply and 1 week would become more expensive.

Basically, it would only allow us to tune 2 price points. If you want to tune more than that - as Supercell obviously felt it was necessary - you need multiple linear segments. Theoretically they could tune even more price points. If they wanted to charge more or less for a 2 day skip, they could easily introduce 1 more segment.

Why not a smooth curve? Perhaps some exponential, quadratic or bezier function?

It looks nice and smooth, but it becomes really difficult to tune... the formulas involved are just a major pain to work with. Having messed around with it for a little while, I don't recommend it :P

The Clash of Clans way of monetizing time skips is really elegant. I can't think of a better system.

To summarize:

*Skipping more time costs more money, but you get a better deal.**The pricing algorithm graph consists of a series of linear line segments.**The nice thing about using a linear segment graph is that it allows you to set and tweak specific price points in a easy to understand way.**The discount for skipping a longer time-piece is far more generous than the discount for buying a larger gem pack*.*The generous discount for skipping longer stretches of time is essential. Without it prices would quickly become prohibitive and nobody would buy them.*

**Disclaimer:** I compiled the information in this article by playing lots of CoC and doing some research. To the best of my knowledge, is it accurate and I have triple checked all figures and calculations. Nevertheless, it is always possible that I have made a mistake somewhere or that the game has changed since publication. Use at your own risk, I don't provide any guarantees. Please get in touch if you find anything amiss.