Saturday, October 24, 2015

The Math of Hearthstone. Part I: Stars and Streaks.

In this post I'll talk about Hearthstone - the Collectible Card Game (CCG) by Blizzard that has been taking the world by a storm over the past ~2 years. As a big CCG fan (I grew up playing Magic the Gathering for many years) the game clicked with me immediately, and I've been playing ever since the closed Beta. I've recorded a series of tutorials for one of the play modes (Arena) and occasionally stream my gameplay - so I've dedicated quite some time to the game and couldn't help but analyze some of its mechanisms.

Background

In Hearthstone there are 2 main game modes - Ranked play and the Arena. In Ranked you play using a deck that you've made up from the cards you own and face opponents of similar strength in order to progress through the ranks (going from 25 - being the worst - up all the way to 1). Such a mechanism is crucial in almost any competitive game: it gives the hardcore players a worthy goal to strive for (climbing the ranks) and - even more importantly - protects the new or weaker players from the very frustrating experience of being repeatedly matched against substantially stronger players and/or decks and losing almost every game. For every duel you win you earn a star, for every loss you lose a star. Collect enough stars and you will progress to the next rank. Lose all your stars at a certain rank - you'll drop to the rank below. At the end of each month all player ranks undergo a partial reset - each player dropping to approximately half their rank - to start climbing again.

When the stars align

The first mechanism we can analyze is the star and ranking system. First of all, note that since your rank is solely determined by the number of stars you have - the ranks are just a cosmetic feature and the only meaningful variable is your number of stars. 

Now let's think of the total sum of stars ALL players have. As a result of every duel one player gains a star and another player loses a star - so the sum of stars in the game remains the same. In physics such a situation would be called a law of conservation (of stars) and in game theory it would be dubbed a zero-sum game. But we have a problem - each month about half the stars are lost from our system since all player ranks undergo the reset; so theoretically we'll "run out of stars" eventually - which would also make reaching high ranks increasingly difficult in the process.

How could this problem be remedied? The most obvious solution is setting a minimum rank/number of stars that no player can go under. If such a player loses a game he won't lose any stars - and so a net +1 star is added to the system. In reality players in ranks 20-25 can't lose stars at all - amplifying this solution further. So you can imagine the flow of stars: created at the lower ranks from thin air, they then proliferate upwards, pushing some players all the way up in a pyramid-like process.

Another star creation mechanism in Hearthstone is the win-streak feature. When you win 3 or more games in a row you get 2 stars instead of 1 per win after the second. To be honest I'm pretty sure Blizzard added this feature in order to give the players a sense of accomplishment (and a satisfying "shiny bling" to boot :) ) when winning continuously - not because they were counting stars - but it does have some interesting side effects:

Streaking for the win?


Theoretically, assuming you are neither a very bad nor a very good player, you should climb the ranks until your opponents become approximately as good as you are. Equal skill level implies a 50% win rate - right? Let's examine this statement.

Being "stuck" at a certain rank means your average stars-per-game = 0 - so you don't climb or drop ranks. Let's calculate the average stars-per-game given a certain win probability - q :

average stars-per-game = 
(+1 star) * (win probability) + (-1 star) * (lose probability) + 
(+1 bonus star) * (probability that this win is part of a streak) = 
2q + q^3 - 1

So if we indeed sustain a 50% win rate - q = 0.5 - we'll get +1/8 of a star per game on average - not 0. By playing a lot of games - even against equal rivals - we will gain an extra star once per 8 games on average just because we'll sometimes randomly have a win streak - and continue climbing the ranks.

How far will we actually get? Until our win probability actually satisfies stars-per-game = 0 - which happens to be q ~ 45.4% - so we'll actually lose more than win when we reach equilibrium. A ~4.5% difference might not sound like much but it results in a 9:11 win:lose ratio - 2 more loses per 20 games is significant.
This just goes to show how a seemingly all-around positive feature that only rewards players can have unintentional negative side effects.

One last thing - as I wrote in the first post - models are not perfect, especially the models presented in this blog :). In reality a player's win percentage is not constant over time - even if their skill remains the same, the competition changes as the better players progress up the ranks, leaving behind easier competition. A player can be "stuck" on a certain rank, then play again the next week and suddenly have a higher win rate. This effect, although transient, could perhaps balance out the drop in q that we've calculated.

To conclude, this was a simple example of how "thinking in models" and some basic probability theory may show us game design effects that are not immediately apparent.

Until next time, may you see the probabilities that surround you.


Michael.


EDIT:
I got some comments about a few of the details I brushed under the rug in my pursuit to make the post readable for people who never played Hearthstone, so I'll address a couple of them here.
First of all, when a player accumulates maximum stars at rank 1 - they transfer to the special "Legend" rank. There are no stars at that rank, and you cannot drop out of it. Occasionally high rank players get matched against Legend players - a duel that results in the creation or destruction of a star from the total pool since Legend players are considered to be maxed-out on stars - regardless of their wins or loses after they reach Legend. Though this mechanism could potentially influence our model - its effect is actually negligible. 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. Additionally, the number of rank 1 or Legend players is less than 1% of the player base so their effect on the star pool in negligible anyway.
Second, at rank 5 and higher there are no bonus stars - so in order to get to Legend you have to get more than 50% win rate - fair and square :).

{Thanks to Alma Smilansky for editing and making the world - and the post - a better place :) }


{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 :) }

1 comment:

  1. Thanks for making such a cool post which is really very well written. Will be referring a lot of friends about this. Keep blogging server privato

    ReplyDelete