Sunday, April 17, 2016

The Math Of Clash Royale

This is the longest (non-officially-scientific) article/post I've ever written so, as is customary in scientific articles, I'll start with a TL;DR of the main interesting points:

  • Is Clash Royale "pay 2 win"? Technically yes. But we'll derive a rough skill estimation formula - neutralizing (most of) the "wallet size" parameter.
  • Turns out the resource that limits players' ability to upgrade cards in the long run is gold - not amount of card copies. Each chest contains only ~60% of the gold required to use the cards contained in the same chest. Choose wisely which cards to upgrade and which to ignore.
  • Don't buy cards in the shop unless you really need that very specific card.
  • Always donate to clan members - it's in your own best interest.
  • Almost half the gold income originates from "free" and "crown" chests - which you can get even without winning a single game.
  • Supercell used a pseudo-random hard-coded sequence of chest drops that seems to be carefully engineered to feel more random and "fair" than actual random drops, and to dispense "wow" moments at precisely planned time intervals.
  • We'll calculate how much time does a free 2 play player need to reach each level. It's possible to get level 5 in a few days but reaching level 12 takes years. Literally.


Clash Royale who?


Even if you are not a gamer, you've probably heard of Clash of Clans. After all, not many mobile games can afford a super bowl commercial featuring Liam Neeson: 


Don't let the cartoonish design fool you - in 2015 Clash of Clans produced an estimated 1.5 million dollars in revenue per day for Supercell, the game's creators. And now the Nordic company released a new blockbuster: Clash Royale. 

The game was globally launched about 1.5 months ago and already has tens of millions of downloads, an active community and user-generated content (Youtube videos, streamers, play guide websites, wiki etc. etc.) - basically every game developer's dream. Part of the reason for its meteoric success is the popular Clash of Clans brand (Clash Royale uses the same lore, characters and visual design), part is the huge marketing budget Supercell are willing to invest in the game, but perhaps the biggest part is that the game is actually good. 

The game's combat theory is quite deep so for now I'll only focus on a few strategic questions and try to provide answers using the power of MATH :). 
 

A tale of 2 progression systems


I'm usually more of a hardcore strategy gamer, but something in the play-and-counterplay PVP dynamics of Clash got to me. Click here for an example of the ~3 minute matches that comprise the "game itself". The winner of the match gains (and the loser loses) ~30 trophies - the game's standings system (similar to the Hearthstone star system).
The battlefield of Clash. Deploy troops and watch them fight autonomously.
This is the first progression system in Clash - basically the "better" you are the more trophies you have ("better" is not necessarily more skilled). Players are matched according to their trophy number - which is basically their MMR (match making rating) - accumulating or losing trophies until they reach a state of equilibrium: ~50% average win rate. The trophy progression system provides a goal for the players, an objective to strive for that supposedly proves their merit and provides bragging rights. Note that this progression scale is reversible: if you play poorly or choose a bad deck to bring into these duels then you will fall back down through the ranks. This is in contrast to the second progression system - a slow grind-like journey of upgrading the quality of your cards and gaining player XP and levels - where you can only progress.

As you play Clash, you get chests of various quality - containing cards and gold. You can sacrifice multiple copies of a card to upgrade it - making it 10% better and getting some player XP with each new card level. While the "merit" progress is measured in trophies, "grind" progress is roughly measured by player experience. Each player level makes your towers stronger by 7-8%, in addition to the stronger cards, so getting more chests gradually makes you objectively "better". 
[Side note: cards increase their power slightly faster than towers, so on higher levels it's easier to destroy towers and the natural defender's advantage of fighting on your side of the map is less pronounced - putting even more emphasis on unit vs. unit combat as the player progresses. A nice design touch.]
This process of acquiring and upgrading cards is the main mechanism of pacing long-term game progress.

A sample deck. Note the card levels, the amount of cards needed for the next upgrade, the card rarity (indicated by the blue-orange-purple colors), the player level in the top left and the adorable artwork :)
Unsurprisingly, you can buy chests and gold using real money. This brought about a lot of player backlash - it's not "fair" facing opponents with objectively stronger cards and towers just because they spent more money on the game - right? Which brings us to the first question:

Is Clash Royale "pay to win"?


Short answer: yes. You can make your cards and towers strictly stronger by paying money.

Longer answer: depends on what you call "winning".
Let's say I want to know how good am I at the game - what's my actual skill and competence - what's my "merit score". At the time of writing I am yet to spend any money on in game purchases during the 2-3 weeks of almost daily play. I am level 6 (which has nothing to do with my skill) and hang around ~1500 trophies (which does). Is 1500 a lot? Well, the very best players in the world reach ~4000, and anything above 3000 is considered "legendary" status. 1500 is a long way from that - but it's also a long way from the initial 0. Should I simply say then that my skill level is 1500 trophies? 

No. My "strength" in a dual is roughly the sum of 3 main factors:


Power = player level + in-game execution + deck choice

My player level defines my tower strength and is also an approximate indication of my card level. Obviously, the stronger my cards and towers the higher my chance to win. This has nothing to do with my "true skill".

Deck choice is a vague measure of how good your deck functions together, its various cards complement each other, as well as how good is it against the most popular decks you encounter. Skill does play a role here but sometimes the lack of access to certain cards limits deck building.
In-game execution is the most obviously skill reliant factor - how good am I at piloting my deck and responding to my opponent's moves. Money can't buy that.

Since I'm at my equilibrium state - I win and lose about the same number of games - my opponents and I have approximately the same power score. My opponents' average level is 6.3-6.4 (about 30-40% are level 7, the rest are 6, with a rare 5 here and there). Since I have a 50% win rate against players with a slightly higher player level than me, from our equation above it follows that my execution and deck building - hence my skill level - is slightly higher than theirs (on average). If my average opponent level was 7 or even more then it would mean I'm a substantially better player than they are - since I manage to overcome my handicap of having worse towers and cards.
This is a more objective measure of player skill - neutralizing the effects of card quality to the best of our ability. And it has almost nothing to do with the actual number of trophies:

Skill ~ (Average opponent tower and card level) / (your tower and card level)

As with all simple models - it's only an approximation and has many inaccuracies, but gives a more "fair" measure of merit.



Should you buy cards?


In Clash, the gold that you get from chests is used mostly to pay for card upgrading, but can also be used to directly buy specific cards in the shop.



Cards available for direct purchase. The more you buy, the more expensive they become.
At first glance the question seems silly - if you want the cards and have the money - why not? But the correct approach is to think long term: our goal is to eventually upgrade our cards, which requires both gold and multiple card copies. What is the limiting factor? In the long run will we run out of gold or out of cards first? Let the math commence...

Let's look at common and rare card upgrade quantities and prices:



Calculating the amount of gold per card needed for upgrade we get the following graphs:


Note that the price per card becomes a constant (10) after level 6 for commons and an almost constant (40-50) after level 3 for rares. Aha! Smells like hidden order :)
So, if we want to upgrade every card that accumulates the required number of copies, each chest has to contain, on average, about 10 gold per common and about 40 per rare. If the chests contain more gold than that - then we should buy a lot to spend the surplus gold, if they contain less - we can't upgrade all of our accumulated cards and have to "give up" on our least favorite/used cards.

Chest drop statistics in Clash are somewhat complex but fairly well documented on the game's wiki so we'll use their numbers and guesstimate the data they don't have. Most of the chests you get are of the "silver" and "free" variations, and they seem to produce approximately the same prizes. The chest content also depends on the number of trophies you had when you received it. Taking my current standings as an example, each chest contains 7 common cards - each has ~10% of being upgraded to a rare or epic [Side note: that means each 7 card pack has a roughly 50% chance of having at least 1 card better than common] and 46 - 58 gold (assuming an average of 52 gold per chest for simplicity, even though the real average seems to be slightly lower).
Let's compare the two resources. Using the most dominant gold-per-card numbers and ignoring the very rare occasion of getting an epic card, we can calculate the total gold required for using every card received in the chest:

Required gold per chest =  number of cards * [
(probability to be a common * gold per card for commons) + 
(probability to be a rare * gold per card for rares)] = 
7 * [0.9 * 10 + 0.1 * 40] = 91

It's important to remember that all of our data and calculations are approximate and might contain 10-20% error, but a 91 gold requirement for upgrades vs 52 received gold per chest is a huge discrepancy. Including epic cards in the calculation only makes matters worse, as their gold-per-card is ~200 - requiring even more gold.
"Gold" and "crown" chests are the next tier of chests. At the same trophy level a gold chest contains 161 - 184 gold (~172 average), 23 cards - 2 of which are guaranteed to be rare or better. Conducting the same calculation will show a requirement of ~320 gold - again much more than the amount provided.

The situation in the highest rankings is just as bad: a silver chest contains ~85 gold on average and 11 cards - resulting in 143 vs 85: 60% of the required amount.

The first apparent conclusion is that I can upgrade only ~60% of my cards in the long run (assuming progression through chests alone) - so I should prioritize and think before upgrading every card I can. 
The second conclusion is that I shouldn't buy cards from the shop unless I really need these very specific cards - the limiting factor is gold, not card quantities. 

Another meta-game mechanism in Clash Royale is the option to donate cards to the clan. Every 8 hours, each clan member may ask to receive donations of a specific card - if you choose to donate, not only do the cards get transferred to the requesting player but you get some gold and player XP for your trouble. This mechanism is purely beneficial for the players - for example because you and a friend can decide to request the same card and simply donate back and forth between the 2 of you - earning gold and XP for each transaction while not losing any cards. There is a lot to say about the game's efforts to create social cohesion and incentivise positive player interactions, but I'll focus on the math side: you should donate almost every card you can - even for purely selfish reasons. As we said, the limiting factor is gold, so "selling" unneeded cards is the correct choice - even if you don't care about helping your clan-mates.

EDIT:
Quite a few people disagreed with my (admittedly unintuitive) conclusion that you shouldn't buy cards even for the "discounted" price at the store, claiming that you can donate them to the clan - netting you some profit. Suppose we buy the first common of the day (costs only 3 gold), the calculation is trivial: 


Sell price - buy price = 5 gold 1 XP - 3 gold = 2 gold 1 XP profit

Can't argue with that right? Not exactly. First, my proposal is to donate the cards that you've opened in chests and are laying around anyway - getting even more profit:


5 gold 1 XP - 0 gold = 5 gold 1 XP profit

Seems trivial doesn't it? The only situation the first calculation applies instead of the second is if there's a donation request for a card that you don't have any copies of at the moment - and happens to be at the store right now. You don't have to buy cards in order to sell them...
Second, not every card is requested. In my clan 4-5 cards constitute at least 80% of the donation requests (half are asking for "barbarians"). So if you buy an unpopular card from the shop you won't even be able to get the 2 gold profit.


How fast is (free 2 play) progression?


Almost the first thing you see after installing Clash Royale is a message saying something like "Clash Royale is free to play but you can speed up your progress through in-game purchases". What is the natural progress speed?
Obviously, we are talking about the "grind" part of progression. It's hard to predict how fast your actual game skill will increase. The natural parameter that measures "grind" progression is XP - so let's see how fast it's gained.

The main method of getting XP is via upgrading cards. Again ignoring epic cards as they are very rare, we get the following table of XP gains per level:



As we've seen in the previous section, the limiting factor in upgrading cards is gold,  so we can safely assume we have enough cards for the upgrades - and focus on the "XP yield" of every gold coin. Dividing "XP for upgrade" by "Cost of upgrade" we get:



Note that after the first few levels the "XP per gold" conversion rate becomes approximately constant (at 0.05 XP or less per coin). [Side note: the high efficiency in early levels is one of the mechanisms that create the "fast progress" feeling that's often very important during the first few hours of play]. Since the vast majority of gold is spent on upgrades of higher level cards, we can use the 0.05 conversion rate as a reasonable approximation (instead of taking into account the myriad of possible options).

How fast do we acquire gold? Assuming we don't pay cash and neglecting the donations mechanism for now (which provides both gold and XP in small amounts), we are left only with the 6 types of chests to provide us with gold:


Gold values for chests received at ~1500 trophies.
What does "Time To Unlock" mean? One of the best design decisions Supercell made in Clash is the chest storage and unlocking mechanism. For every win you get a chest, but you can't open it and get the rewards inside right away - you first have to unlock it. The process of unlocking a chest takes a varying length of time, depending on its type, and only 1 chest can be unlocking at any given moment. Furthermore, you only have 4 chest storage slots (1 of which will probably be unlocking at any given time) - so if you win a match while your slots are full you'll get the trophies but no chest. 
This mechanism not only ties "grind" progression to real time instead of play time, it also encourages players to play in short bursts of a few games each time. Most free 2 play games limit play frequency by some form of energy mechanism - basically preventing you from playing more than X times per Y time (unless you pay some money of course) - which often annoys players and hurts the game's immersion. Energy systems are not there just to increase monetization (relatively few players pay for energy), but to decrease player burnout. The metaphor that's usually used is eating too much of a delicious cake - it was very tasty but you ate it all in 1 day and now feel like you never want to see another cake in your life...
Clash (like Fallout Shelter) tackles the burnout problem without annoying players with artificial play limits. It makes you feel smart for not playing too much because you want to get chests for your efforts.


The chest slot system, while slightly annoying at first, is a great method to keep players coming back to the game several times a day for short play sessions.
The "free" and "crown" chests are obtained differently and don't need to be unlocked or stored in the 4 slots, so they are a parallel source of gold.

The second point that requires clarification is why "random" has quotation marks around it. The type of chest you get after winning a battle might seem random but is actually determined by a hard-coded cycle of 240 chests - containing exactly 180 "silver" chests, 54 "golden" chests, 3 "magic" and 3 "giant" chests each. Assuming the (unrealistic) scenario of optimal efficiency - keeping a chest actively unlocking at every given moment - it would take exactly 1044 hours to unlock the whole cycle, or 43.5 days. 
Since we know the exact order of the dropped chests, and using the table above, we can plot the rate of gold production per hour from the different chests for the whole 1044 hour cycle:


Gold from chests per hour. The high spikes are "giant" chests, the medium ones are "magic" and the tiny ones are "golden"
Note the very constant gold generation rate (about 39 gold per hour) most of the time - "silver" and "golden" chests produce almost the same amount of coins per hour because "silver"s unlock much faster, and the "free" and "crown" chests are independent of the cycle. The actual cycle average is closer to 43.5 gold per hour - because of the special chests' contributions. Almost half of the income comes from the "free" and "crown" alternative chests - so don't underestimate them!

[Side note: the timings of the special chests were carefully chosen by the smart designers at Supercell - every drop of an unusual chest is an emotional high point. The first "magic" chest drops very early in the game - to help players get started and hook them in, but then there are ~500 hours (in the impossibly optimal case) - half the cycle - with only 1 "giant" chest. Among other things, it shows Supercell's confidence in the quality and addictiveness of their core gameplay - since they believe players won't stop playing during the ~3 "baren" weeks, despite not getting "wow" moments from exotic chest drops. Then during the second half of the cycle the players are "compensated" - perhaps to reignite some of the passion for the game that naturally decays after weeks of daily play.
Another possible reason for using a pseudo-random drop cycle instead of actually random probabilities is that sometimes real random doesn't feel "random enough". The distribution of "golden" chests vs "silver" ones is carefully chosen so that there are always 1-4 "silver" chests between one "golden" to the next - which "feels" more random and fair than actual random would.]

Now that we have an estimate of the flow of gold, let's multiply by our approximate XP per gold rate and get:


XP/hour = XP/gold * gold/hour = 0.05 * 43.5 = 2.175 XP/hour = 52.2 XP/day

Note that it's quite possible to get ~10-15 XP or even more per day by actively contributing cards to clan members - both by directly earning XP and from the XP that the received gold will eventually turn into. This makes clan contributions even more recommended - as they can speed up leveling by 20-30%.


Now let's compare it to the amount of XP required per level and calculate a rough lower boundary on the time it takes to get to each level. I've added 25% to the XP/day rate as an estimate of XP from clan contributions (and achievements):


An estimation of the number of days required to reach each level, assuming free 2 play and ~1500 trophies. Levels 10-12 are too high to show on the same scale as levels 4-5.
Level 10: 270 days, level 11: 700 days, level 12: 1850 days (?!?).
After several days of active play you can reach level 5, but the higher levels seem to require unreasonable lengths of time for a non-paying player. Level 8 requires ~2 months, level 9 ~4 months - even at optimal play speed. Not to mention levels 10-12, which are simply unfeasable.
On the other hand, it's reasonable to assume a player will get more trophies as he plays more and gains levels - so for higher levels it's perhaps more accurate to take higher trophy counts, which means chests with more gold - meaning more XP/hour. Sadly, this effect speeds up progress only by an additional ~20-25% even if we assume a high trophy count (2000+). Reaching level 12 still takes years...

So I guess the most accurate answer to the question "how fast can I level up without paying" is "not fast at all". Perhaps the goal is to reach level 8 and just be content with that.
Even better - perhaps the goal is to reach level 8 and then show those level 10 "wallet warriors" that money can't buy skill :)

Until next time, may you have faith in your abilities, even in the face of "unfair" circumstances.


Michael.



EDIT:
I've intentionally left gem usage for last, but then forgot to include it. Oops...


How should I use gems?


Clash's premium currency is gems. You can buy them directly at 80-140 gems per dollar, depending on the purchase size. Gems have 3 uses: speeding up chest unlocking (worst use of gems), buying high quality chests (seems to be the most popular use) and buying gold (the best use - since gold is the limiting resource).
As a free2play player you get some gems for one-time achievements and sometimes 2-4 gems from "free" and "crown" chests. I couldn't find reliable statistics about the chance of getting gems in "free" chests (in "crown" you always do) so I'll use a very crude estimate of 1 gem average per "free" chest and 3 per "crown" (if anyone has better data on the subject I would love to see it). That means about 9 gems per day, assuming optimal play.
There are 3 gold purchasing options: 1000 gold for 60 gems (least cost efficient), 10000 for 500 (most reasonable) and 100000 for 4500 (best value but it takes ~17 months to accumulate so many gems...). 500 gems can be hoarded within ~2 months of free play, or ~1.5 if we take into account the ~150 gems from all the achievements - so this purchase is quite feasible.
Assuming that's how we choose to spend our gems, each gem has an effective value of 20 gold, bringing the total gold per hour (averaged over months of play) to 51 - up by 7.5, a ~15% difference.
Unfortunately, the first chance we get to use this "gem value" is ~1.5 months into the game. So somewhere near the end of level 7 we'll get a 10000 gold boost - which translates to 500XP, probably taking us all the way to level 8 - saving ~10 days. Nice.


{If you find my ideas or analysis interesting - consider subscribing (box on the right). You'll never miss a post and I'll know I'm not talking only to myself :) }

27 comments:

  1. You haven't accounted for the gems that can be used to buy caches of gold. I presume it would affect your whole of life calcs.

    ReplyDelete
    Replies
    1. Fair point. Forgot to include that case.
      Now added a gem section.

      Delete
    2. You havent taken into account the fact that you earn gold from winning battles as well. However, this might be an insignificant amount, giving only maybe 1 more Xp/day? i dont know. (im replying here because i cant seem to find the comment button)

      Delete
  2. I have a question about your statement that you should never buy cards. Both common and rare cards in the shop start at a price lower than the return you get from donating these cards, would it not make sense then to buy cards that you know you will be able to donate and make a profit? Or is this not worth it because by the higher levels you become so gold starved that you always have excess cards available to donate anyway?

    ReplyDelete
    Replies
    1. The idea is that it would be even better to donate the same cards without first buying them from the shop - but simply from your own collection that you randomly got from chests.
      It's somewhat counterintuitive, I know.

      In any case, remember that all my models are approximate and should not be followed over-zealously :)

      Delete
  3. Never buy cards...pfffttt I use the card buying for my clan mates. The first couple will always make it worth the exchange

    ReplyDelete
  4. Interesting write and I love the math. While I understand your point about only leveling the cards that you use, that seems to neglect a key mechanic. I have not extensively research this, so some of my information may be wrong, but the cards that you receive from chests are pseudo random and based on which cards are the lowest level in your available cards.

    This means if you only level the cards that are in your deck at a certain point the game will stop giving you cards to upgrade your deck. This mechanic severely limits your ability to only upgrade the cards that you are using. With this in mind how do you recommend countering this mechanic?

    ReplyDelete
    Replies
    1. I heard about this mechanic but never seen specific data or information - but I would love to see some and try to take it into consideration.
      In my personal experience, the difference between "fair" card drops and reality doesn't seem to be very big.

      Delete
    2. I don't believe there to be any quantifiable data floating around but anyone who has reached Arena 6 or 7 has seen the insane influx of Mortars/Royal Giants as the game balanced out the number of cards you have. Without buying cards in the shop the game will slow the progress of your deck down to a standstill.

      Delete
    3. I did get endless Royal Giants at A7. I've tried upgrading them a few times to see if it changed the drop statistics but it didn't seem to help.
      Perhaps a good approximation is that you get cards in an even distribution on average - meaning you'll hit 1000 total lifetime Goblins approximately at the same time as you'll hit 1000 total lifetime Mortars.

      Delete
  5. You also neglected to discuss the issue of how upgrading certain cards over other cards decreases the probability of u getting those cards in future chests, another mechanism to hold back player progress

    ReplyDelete
    Replies
    1. For different levels you need to upgrade different cards in the deck (We cant just use a "Princess" at level-1). Assuming you upgrade 50% of your deck still takes lots and lots of years :-)

      Delete
  6. Just for the record, the battlefield picture of the positively italian player is amusing.

    ReplyDelete
  7. Excellent article.
    Now that Clash has been updated to give gold on every win, how does that change the picture?

    ReplyDelete
  8. Article it's 90% outdated with so many gold generating game mechanics that none of these figures can be relied upon, even remotely. The inky truth is that at levels 12-13 card upgrades the gold required, while possible individually on free to play will never be maxed out free to play, as they keep adding cards and will eventually increase levels. Level 14-& possibly 15 likely soon, as the money potential is just too great as revenues tighten. Free to play though will die if they do this, as max levels will officially be unobtainable w/o $. In truth, unless you're unemployed, or only game for a living, or already is... And there are hundreds of thousands of other options out there that isn't making the bank of China rich, .. The end owner.

    ReplyDelete
  9. Clan chests, tournaments, legendary card increases, gold changes, yes this article is woefully obsolete.

    ReplyDelete
  10. The win percentage between rank 1 and Legend players isn't substantially skewed in either direction so an approximately even number of stars are created and destroyed this way. clash royale

    ReplyDelete
  11. I am sorry, this probably should be trivial; how could you write a formula or two formulas that calculate shop card cost, say in R or excel? What I mean is - if the first card costs say 20 and you buy n cards what is 1) the total cumulative price you pay and 2) what is the price for the last card you buy (that's what _is_ shown in the shop after you buy a card)? I started to think about this, but did not come to an easy answer. --Robert

    ReplyDelete
  12. If you donate like a madman you can level up significantly fast

    ReplyDelete
  13. I reached level 11 in a year after beginning..dont remember when but game was released last year only..im free to play..got a clue?Could you please also calculate my time played if total matches I played were 4900(2400 lost 2500 won) thanks!

    ReplyDelete
  14. Much thanks for this helpful article. I like it. playmotupatlu

    ReplyDelete
  15. Hi.. I'd like to know what determines the amount of coins given to a player after their battle win. Sometimes I get 29 and at most have received maybe 31. That's with 3 crown wins. The coins always differ. Why? And thank you in advance.

    ReplyDelete
  16. Hi.. I'd like to know what determines the amount of coins given to a player after their battle win. Sometimes I get 29 and at most have received maybe 31. That's with 3 crown wins. The coins always differ. Why? And thank you in advance.

    ReplyDelete
  17. . In the past investigates, it was discovered that around a huge number of individuals in the United States approach video and pc recreations. This fair implies a greater part of the populace is glancing around and endeavoring to find what's accessible for them http://www.hack4clashroyale.com

    ReplyDelete
  18. Really Interesting Article. I finally found something worth reading lol. Do you have any guides on other games like this one - www.ordodracul.com/walking-war-robots-hack-cheats/

    ReplyDelete