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 bottomleft 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, copypaste 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,((201)/(360060))*($A$260)+1,IF($A$2<=86400,((26020)/(864003600))*($A$23600)+20,((1000260)/(60480086400))*($A$286400)+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 realworld 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 timepiece 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: 159 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:
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.
Amir Ebrahimi 
3 Apr 2014 at 1:15 pm PST

Excellent article. Thanks for doing this work and contributing it to the community!



Ara Shirinian 
Incidentally, this is highly analogous to gameplay mechanics tuning for things like platformers. You ideally want to be able to adjust parameters about any subset of your system's dynamics without having to affect any other part.
This is also why utilizing generalized physics systems to govern gameplay dynamics is such a bad idea. It is just like trying to force a mathematically elegant/ smooth curve to define your system when what really produces the most naturalfeeling movement is an arbitraryseeming set of values for every situation. 




Curtiss Murphy 
Have you tried their newest release, Boom Beach? You've done a brilliant analysis here and I wonder if it persists in their release. The new product adds the ability to skip resources, and I expect they used similar formulas here as well. And, they are initially quite generous with chests of free gems that quickly begin to become more rare  they train the player to look for them, and they have less and less value as the player becomes more integrated into the game economy. Boom Beach proves that Supercell's success is no accident.





Ross Kravitz 
One disadvantage of the piecewise linear graph instead of a simpler curve is that the former model has a lot more free parameters (i.e. each of the breakpoints between linear segments, as well as the price points of the breakpoints). This makes the optimization more difficult.
At the end of the day, the shape of this graph was probably made by a human with some intuition/domain knowledge. The single essential feature is the concavity of cost as a function of time, as you mentioned. Everything else was probably arbitrary, at least initially. Actually, a key question (the key question?) is whether this cost curve has changed over time. If it hasn't, then it was probably determined in beta or before, and there the amount of gem transactions was sparse enough to make a quantitative approach to optimization difficult to impossible. If this graph has changed over time, then presumably Supercell is taking some steps to optimize the curve based on game data. In one scenario, Supercell has highly granular data about the "funnel" to making gem speedups, which would allow them to determine whether a user attempts to speedup, given that they have "shown interest". It may not be possible to obtain this data, and often it is difficult to change processes to collect this after the game has started. The next step down would be to have logs of all potential speedups purchased. This would be not much worse from a modeling point of view. Supercell might have this data, and they might not. In a post hoc sense, it seems obvious that they should collect it, but when the game launched it was maybe not obvious, and changing the data collection pipeline while a game is already running is nontrivial. In the worst case, they have no granular data, and they try to model overall monetization as a function of this curve. This point of view is stupid, but it's prevalent because sometimes it's the only way. Even with the best data, modeling is still difficult, because it can be hard to perform experiments, which is by far the most efficient way to optimize. I believe CoC runs on individual servers (could be wrong), and this would typically mean that in an A/B test, two servers might have different pricing schedules. Therefore, you have limited data points on the effect of pricing, and this is why having a model with few parameters is important. I could go on, but I'm sure it's getting tedious. 




Ian Griffiths 
I wouldn't attribute all of the praise to Supercell as much of the principles here are probably based on typical game mechanics and these have definitely been used in many, many appointment based games that came before it  FarmVille for example.
On the psychology part of virtual currency, I agree that 'waste aversion' is a useful feature however the 'conversion factor' is more complex. Sorry to rain all over the Americentric analysis you link to but not everyone understands prices in dollars. Using 100 points to the dollar may be easy for Americans to do mental arithmetic with but would it make sense in Euros? Pounds Sterling? Or any of the multitude of other currencies? The irony being that the linked article even discusses Malaysian and Bahrainian currencies but only in relation to how hard they are to understand in dollars. Yes, the US dollar is the reserve currency for much of the world and Americans make up a large portion of gaming audiences but that doesn't solve the fundamental issues that virtual currency, when semantically pegged to one currency, is obscured in another. 


Michael Shavelieva 
Boom Beach appears to have the same approach. In CoC there is actually an additional multiplier in the usage of builders and how they allow you to multiply the number of things you can upgrade/build at a time. This then becomes limited/dependent on the resource production. I only mention this as Gems are spent on advancing a timer based item and the creation of builder's hut that house your builders. You could tangent on the effects of them starting you with one and then forcing you into a second, however. Boom Beach from my exposure(lvl15 so far) limits this multiplier aspect by reducing the build amount to a single builder at a time. Any takes on why they moved from 5x possible builders to 1? I definitely notice how it sometimes drags the time out.



Steven Johnson 
Excelent article, i'm happy that i found it in google! Thanks for putting time in this



Steven Johnson 
Also, i forgot to add, that if you are clash of clans player, you should not miss opportunity to visit this site, lot of valuable information here http://allexclusiveoffers.com/clashofclanshack.html


