Showing posts with label Math. Show all posts
Showing posts with label Math. Show all posts

Monday, February 2, 2015

Pandemic: The Cure - standard deviation and probability

Initial setup
Recently we have been playing Pandemic: The Cure. The goal of the game is (loosely) to cure all the diseases. Each player has a certain number of dice that they roll on their turn (5 for most players, 7 if you're the Generalist) that give them their possible actions for the turn. One of the actions lets you use one of your die to "bottle up" a disease die and at the end of your turn you roll your bottled up disease dice and if the total amount rolled on the dice for a particular color of disease is greater than 13, then you have cured that disease.

Bottling up the diseases is great because it removes that disease die from play and helps you discover the cure, but until you discover the cure that die of yours you used to "bottle" it up is locked up and you can't use it, meaning you'll have fewer possible actions on your turn, making you less effective until the cure is discovered.

Disease Dice
Each color of disease die has different face values from the other colors'. Each one has a "Cross" face (value 0) and 5 other values. The average value of the faces on each die is 3 but since the values are different the standard deviations of the values on the dice are different. The values on the faces of the dice are as follows.

ValueBlackYellowBlueRed
1st0000
2nd3211
3rd3221
4th3434
5th4566
6th5566
Avg3333
Std Dev1.6722.532.68

So in terms of trying to cure the diseases, the likelihood that the total of the values across all the dice you roll of a color will meet the required sum is different. Below is a table of probabilities of curing the disease with various numbers of a color of dice. The amount needed to cure a disease is normally 13, but sometimes can be 11.

BlackYellowBlueRed
# Dice11+13+11+P13+11+13+11+13+
20.00%0.00%0.00%0.00%11.11%0.00%11.11%0.00%
332.87%7.41%34.72%12.04%34.26%20.37%40.28%23.15%
470.14%46.91%67.67%45.76%60.88%45.06%62.73%45.76%
589.51%77.22%86.52%73.53%79.90%67.30%78.29%67.36%
696.81%91.85%95.03%88.94%90.71%82.81%88.70%82.04%
799.12%97.42%98.33%95.86%96.05%91.82%94.62%90.59%

You'll see that for certain numbers of dice and goal numbers to reach, the probability of curing the disease can be quite different. For example, with 3 dice and a goal of 13 the probabilities range from 7.41% to 23.15%. Most differences are <10%, but that can be a fairly significant difference.

You'll see that no die is universally easier or harder to find cures with. Getting 13+ is only really possible once you have 4 dice. A goal of 11 isn't very likely until you have at least 3 dice, and even then the odds are very bad. It's very hard for a single character other than maybe the generalist to amass 4 or more dice by themselves. After you have 3 dice bottled up you only have two dice left. So getting the 1 in 6 result of being able to bottle up on your dice when you only have two dice is fairly unlikely. The game allows you to trade your bottled up dice to another player if you're on the same square. This probability table tells me that that's a very important part of the game.

Advanced discussion:
In the above two tables, I ordered the dice colors by their standard deviations, lower on the left and higher on the right. One thing you might notice is that for 3 dice, the higher variance dice (aka higher standard deviation) have a higher probability of success. You'll notice that for higher numbers of dice, the colors with a lower standard deviation tend to have a higher chance of success.

When you have 3 dice, the average value of the sum is 9 (because the average for any given die is 3). Nine is insufficient for either goal so results near the average are bad. So you want a result that's far from the average, meaning you want a higher standard deviation. When you're at 5+ dice, the average result, 15, is above the goal so lower standard deviations are better.

When average is bad and you want that extreme result, you'll do better with a higher standard deviation. When the average is good and you don't need an extreme result, you'll do better with a lower standard deviation.

Player Dice, showing all faces
Epidemic Roll Change
Another place where probability plays a big role (roll?) is with epidemics. Each character die has one face which, when rolled, will advance the epidemic track. The generalist, with their seven dice instead of the normal 5, stands a much greater chance of rolling these values on their turn. To balance this, the generalist is allowed to ignore the effect of the first epidemic they roll each turn. This has a huge effect, and it makes the generalist have an overall lower change of advancing the epidemic track than other characters. Below is a table of probabilities for how far each character will advance the epidemic track on their initial roll of dice (with full dice i.e. no dice locked up from bottling up diseases).

AdvancementNormalGeneralist
040.19%66.98%
140.19%23.44%
216.08%7.81%
33.22%1.56%
40.32%0.19%
50.01%0.01%
6NA0.0004%
Avg0.830.45

The other advantage of being the generalist is that when you have no epidemics on your initial roll (28% of the time w/ 7 dice, higher w/ fewer) you can freely reroll dice to try and get a better result w/ no fear of the consequences of rolling an epidemic.

Friday, June 7, 2013

Your ideas about WoW players are wrong - engagement bias

Not that kind of engagement
The people you see when you log into WoW, no matter which server you play on, do not comprise a representative sample of the people who play WoW. 

That sentence might seem a bit surprising but I can assure you that it's 100% true. The primary culprit here is engagement bias, which is something you have to consider when you're analyzing a game-as-a-service, like WoW. Suppose 7 million people play WoW in a given week. Let's look at them by how engaged they hypothetically are (as measured by how many days they played that week).

EngagementPlayer Count% played today# played today% DAU in bucket
1 Days1,000,00014.29%142,8573.57%
2 Days1,000,00028.57%285,7147.14%
3 Days1,000,00042.86%428,57110.71%
4 Days1,000,00057.14%571,42914.29%
5 Days1,000,00071.43%714,28617.86%
6 Days1,000,00085.71%857,14321.43%
7 Days1,000,000100%1,000,00025%

Here we see that if you look at the people who play on a particular day (DAU - Daily Active User), there is a distinct bias towards users who have a higher weekly engagement. Side note: players who play in a given week are called WAU. Even though the WAU are evenly distributed among the engagement buckets, the DAU are heavily skewed towards the highly engaged. Then again, WAU isn't how Blizzard likely defines 'player' for WoW, they likely use subscribers as the definition of the player, since that's how they get their money and the $15 a low-engaged player gives them is the same as the $15 a heroic raider sends them.

What this means is that the people that you see every day in the game aren't really a good representation of WoW's subscriber base. People aren't as engaged with the game as they appear to be. From a development and design standpoint, the highly-engaged users are the least likely to let their subscription lapse, so features are often made to appeal to the casual crowd/make casual players more engaged. If you look at the history of WoW this is what you'll see. Even heroic raiding was oriented around this because it allowed them to make regular raiding easier and more accessible to the casual player.

This is just one example of engagement bias, which is a recurring problem in user-centric data analysis and therefore is a recurring problem in the games-as-a-service industry. Engagement bias is the phenomenon that more active users are often more likely to be counter/sampled.

Back when I was working on analyzing the results of my 2011 WoW Survey, one question I wanted to answer was "What are the correlations between classes?" meaning that I wanted to know which classes a player was more or less likely to play if they played another class. For example, "Are people who play Warlocks more or less likely to play a Death Knight than someone who plays a Rogue?"

Suppose that the average respondent to my survey listed two different classes among the ones that they play. At the time, this means that roughly 20% of respondents played any particular class (class representation actually varied wildly). When I pulled the percent of Warlock players that ALSO played Paladins I found a much higher number, 40% or greater. This baffled me for a long time. For each combination of classes, this same thing happened, the percentage of X players that also played Y was higher than the percent of the general population that played class Y.

Why was this?

Among the people that I surveyed, they varied widely among the number of characters they played. Some people only listed 1 or 2 characters, some listed 10 or more. When I selected all the players who played a Warlock, the highly-engaged players (those with more characters) were more likely to be in that group than the low-engaged players (those with few characters). So the group of Warlock players had, on average, more characters than the general population. So when I calculated how many of them also played Paladins, I received a much higher number than with the general population.

Of course, there was something else that would skew the results of my analysis. I got my data not via the actual numbers but by getting survey results that mainly came from MMO-Champion. Since these are people that are participating in the WoW community, they are going to tend to be more engaged than the general WoW playing population.

Engagement bias is just one of the many things you have to keep in mind when you're analyzing game players. For example, during my WoW survey, I also found that MMO-Champion users tend to skew more male than respondents from other sources that I've used. For this reason and more when I was doing my analysis I was careful to make sure to state that the numbers were not to be taken as absolute facts, but as being "directional", meaning that it'll likely indicate what the differences between two groups or what may be more or less popular for a group even if the exact values aren't true for the overall population.

This is just one of the slew of problems that you run into when doing user-facing data analysis, something which I'll be covering in a later post.

Wednesday, May 30, 2012

WoW: MoP Drop Rate Statistics Calculators

Normal Loot

Drop Rate
Number of Kills
Probability of drop =
Probability
Kills Needed =
Average Next Drop Prob Median
??? ??? ≤???

LFR Drops

Drops per boss
Pieces eligible
Pieces Needed
Average Next Drop Prob Median
??? ??? ≤???

Explanation of the Normal Loot section
First, you'll have to enter in the drop rate. From that, the table below will populate. It will tell you the average number of kills needed for the piece to drop, the probability that it will drop on the next kill (which should be equivalent to the entered probability) and the median number of kills required to see the item drop. If, for example the median number of kills is 4, then there is a 50% or better chance it will have dropped on or before the fourth kill.

Second, if you enter in the number of kills that you've performed, then it will tell you the probability that the item should have dropped at least once in those kills. If you enter in something in the "Probability" field, it will tell you the number of kills needed to have that probability of the item dropping at least once.

For example, if you have a drop rate of .5 and 5 kills, there is a 0.968 (actually 0.9875, but the results are rounded) probability that the item will drop at least once in those five kills. If the drop rate is still 0.5 and you enter a probability of .90, it tell you that 4 kills are necessary to have a 90% or better chance of the item having dropped at least once.

Explanation of the LFR Drops section
This is based on the LFR loot system that will be introduced in Mists of Pandaria. An explanation can be found here. You just enter in how many piece of loot the boss will drop among the raid, how many pieces of loot in its table you are eligible for, and how many of those pieces you actually want. When you have that entered the table will populate with the same type of information that is in the above table.

I based this on the assumption that a boss will drop a particular number of pieces. If it is the case that you have a fixed X% chance to win loot, then I will alter it. It is also based on a 25 player group. Furthermore, the top section is about a piece dropping and not necessarily that you'll win it. The bottom section involves you winning a piece that you want.

If you have any questions about this or about loot drops, please don't hesitate to ask below. If you have comments, recommendations or requests, then please ask.

Tuesday, May 29, 2012

The Myth of Compound Interest


Banks and mathematics courses will talk about how monthly compounded interested is better than yearly compounded interest. You might even see a demonstration of it such as this one dealing with 6% yearly interest.

Which shows that a 6% interest rate, when compounded monthly, provides a slightly higher amount of interest. Now, the amount of increase you get is dependent on your base interest rate. In our example, a 6% interest rate becomes a ~6.17% interest rate. A 12% yearly interest rate becomes a ~12.68% interest rate, which is a far better gain than what 6% achieves. But a 12% interest rate is incredibly unlikely to get anywhere.

So why am I calling this a myth? Well, because it's only better than yearly interest under certain conditions. The example they give you presumes that you aren't depositing or withdrawing money from the account. And if you're not depositing or withdrawing money from an account, what good is it? It's either a small amount of money, in which case the additional interest in negligible. If it's a large amount of money, then the person is likely financially secure or wealthy, so they could benefit significantly from the increased interest.

Suppose you're depositing money into the account every month. If you have monthly interest, then a small amount of interest is applied to small amounts of money at the beginning of the year, and larger amounts of money at the end of the year. If, however, you have yearly interest, all of the interest is applied to a large sum of money at the end of the year. Why apply interest to a small amount of money when you could instead have the interest applied to a large amount of money?

The question then becomes, how big of a deal is this discrepancy? Well, I'm glad you asked. I used an R program to come up with some numbers for us. I used a 6% yearly interest rate and invested in the account at $300 per month. Now, the $300 figure isn't important, these results will hold true no matter what the amount is, $300 just seemed like a good figure to work with.

YearsNo InterestMonthlyYearlyDifference
1$3,600$3,719.17$3,816.00$96.83
2$7,200$7,667.73$7,860.96$193.23
3$10,800$11,859.80$12,148.60$288.80
4$14,400$16,310.50$16,693.50$383.00
5$18,000$21,035.70$21,511.10$475.40

From this, it would appear that the yearly interest is always better than monthly interest, but when you carry the calculations out you find that monthly interest will eventually exceed yearly interest.
Click to Enlarge
From this chart, if you have a 6% interest rate and deposit money at a constant rate, then monthly interest overtakes yearly interest at the end of the year only at year 27. Monthly interest accounts exceed yearly interest accounts in the middle of each year because of the interest that is applied during the year, but at the end of each year prior to year 27, yearly interest comes back. From this graph we see that yearly interest provides, at most, a $1161.17 advantage (with a $0 initial balance and monthly deposits of $300). This scales as long as your monthly deposit is the same. So the advantage maxes out at roughly four times your monthly deposit.

There is another situation where compound interest is better. When the amount of money in an account is in decline, it is better to have compound interest because then the interest will be applied when you have more money (before you lose said money).

So what affects whether monthly or yearly interest is better? The factors are your initial balance and how much you invest each month. If you have a high initial balance, then monthly interest should always be better. If you have little to no initial balance, yearly interest will be better for a long time. If your investment rate increases with time, such as starting by depositing $100 and depositing more and more as time goes on, then yearly interest will stay relevant longer.

So banks tell you about this wonderful thing known as compound interest when it isn't necessarily better for you. I know how you all must feel right now. I mean, how could the banks betray you like this? It's just so hard to believe that they could be like that. I mean, that something they would tell you is a good thing can actually be a bad thing (unless you are financially secure enough to save a large amount of money for a long time.

I think I'll do a followup post that investigates some other investment situations. Keep an eye out for that. 

Sunday, May 20, 2012

How Many Diablo III Builds Are There?

In Diablo III you can have a an ability mapped to both of your mouse buttons and to the 1-4 keys on your keyboard. By default each skill in the game can only be placed on a particular button. For example, my Zombie Dogs have to be bound to the 1 key. This means that under the default settings you can't have some skills on your bar at the same time because they would have to be bound to the same key.

There is, however, an option called elective mode that removes this restriction and allows you to put whatever skills you want on whichever key/button you want. This has led me to wonder how many different builds you can get out of each particular mode. So to look at this, I will use my witch doctor, Tauzex, as an example. The number of skills I use in this post will come from him. Other classes have different numbers of skills, so these numbers will vary from class to class.

Some background on what goes into a build
  • You have 6 active skills and 3 passive skills at max level
  • Each active skill can have 1 of 5 runes attached to it. 
  • I will assume that you'd never want to use a skill unruned
  • In both modes at max level, you can pick any 3 of your passive skills with  no restrictions.
I will not be considering a build with the same skills but on different buttons as being a different build. 

For my witch doctor, the number of skills that I can attach to each key in standard mode is
  • 1 key: 4
  • 2 key: 3
  • 3 key: 4
  • 4 key: 3
  • Left Click: 4
  • Right Click: 4
  • Passive Skills: 15
In general, the number of builds in either mode is the number of choices you have for your active skills times the number of choices you have for your passive skills (since your active skill choices and your passive skill choices are independent of each other). In both modes, the number of passive skills that you can select is the same
The middle section is read as "15 choose 3" and is explained in the footnote*
To count the number of active skill choices, I will first count how many choices of skills you have and then factor in the different rune choices for those builds. If you have a selection of 6 skills and each of those skill has 5 runes, the number of ways that you can rune a particular set of skill is 
So now we just have to count the number of skill choices each mode has.

Active Skill Choices in Standard Mode
To figure out the number of builds in standard mode, I just have to multiply the number of choices I have for each skill slot. This comes out to
choices for your active skills. In whole, this brings active mode to 
builds for your character. That's over 16 billion distinct builds.

Active Skill Choices in Elective Mode
In elective mode, you aren't restricted by abilities needing to be placed in certain positions. So as a witch doctor I would just need to select 6 active skills out of my 22 total active skills. The number of choices in elective mode is 
choices for your active skills. In whole, this brings elective mode to 
builds for your character. That's over 530 billion distinct builds. This can be done for the other classes as well, which gives us the following table.

ClassGuided ModeElective Mode
Barbarian20,160,000,000652,863,750,000
Demon Hunter21,840,000,000717,670,078,125
Monk9,828,000,000308,626,500,000
Witch Doctor16,380,000,000520,451,796,900
Wizard34,125,000,0001,259,070,312,500

Followers
We shouldn't forget our followers! They play an important role in single-player gameplay. So how many choices do we have for our follower builds. Well, there are 3 followers, and each one requires that you make 4 choices that each have 2 options. 

So that multiplies the number of distinct was to outfit your character by 48. Of course, since you don't have a follower in multiplayer mode, this doesn't apply there.

Conclusion
Wow, that's a ton of different builds for your characters, and elective mode has so many more builds. In fact, elective mode over 32 times as many builds as standard mode does. I don't believe I have to tell you that that's an impressive number of choices!

* As I said above, that particular notation is read as " choose ." In mathematics it's known as a combination (as opposed to a permutation) and is calculated as follows.
where

Thursday, May 17, 2012

Differential Equations and Support Tickets

Slope fields are very useful in Differential Equations.
This one approximates the situation described below.


"It's been 3 days and my ticket still hasn't been resolved, this is bullshit"

"Why don't they just hire some temp support staff? Then they could just work through the backlog and then fire them and we'd have instantaneous response times."

I'm back with another entry that nobody asked for. Here I'm going to be talking about yet another practical use for mathematics that relates to World of Warcraft.

We often have to deal with situations where we have to wait for something to get resolved by someone else. And we'll find ourselves wondering why it's taking so long. We wonder why the queue is so long. We wonder why they don't just hire somebody else to work through the backlog.

The truth is that it probably wouldn't solve the problem. But looking at that is probably a question for differential equations. Normal equations relate to quantities. Here we'd be looking at the length of the support queue as a function of time or some other factor. For the purpose of this analysis I'll be looking at time. Often times it's incredibly difficult or impossible to come up with a function that describes certain situations. However, it can be relatively easy to come up with an equation that describes how a particular value changes.

You may have taken a calculus class at some point in time. You may remember that the derivative of a function describes how that function changes with respect to its variables. If we let Q(t) be the number of messages in the support queue at any given moment in time, then we'd be more concerned with
which is the rate of which Q(t) changes over time. So now we just have to ask ourselves, what causes Q(t) to change?

Well, Q(t) increases whenever somebody has some sort of error to report. And Q(t) decreases every time a petition is answered. So we might be inclined to say that
Where p is the rate at which petition-able items occur, and a is the rate at which the game masters can answer petitions. But that's not true. If the queue size is particularly large, people become less likely to submit a petition. We may do this because we're impatient or because it may be the type of issue that could resolve itself in that amount of time (say with a bugged mob). So I'm more inclined to say that the function more closely resembles.
Where k(q) is a function is always positive but decreases as q (the length of the queue/wait time) increases. It is the probability that a person will report their issue given the length of the queue. Now, if we presume that p and a are constants, meaning that petition-able items and the rate at which petitions are answered aren't affected by anything here, then our function is a differential equation of one variable, q.

So what does this mean. Well, if the queue is long, then q is high,  k(q) is small, and the value of our derivative is negative, meaning that the queue will get shorter. If the queue is short, then q will be small, k(q) will be higher, and the value of our derivative will be positive, meaning the queue will get longer. It turns out that if p and a remain constant, then the length of the queue will tend towards a value for which
 When the derivative is zero, that means that the length of the queue stays the same. So the length of the queue will tend to wards a particular length and then remain stable, provided p and a don't change. This is especially true of more demanding queues, such as the post office, where you must physically wait in line. It's still true for passive queues, such as WoW reporting system.

So hiring temp workers to reduce the queue length won't work, because once those temp workers are gone the queue length will return to normal. This is why it's very important for Blizzard (and other agencies) to create more automated support systems, so that smaller, easier-to-fix problems can be handled automatically and bypass the queue.

Wednesday, May 2, 2012

The Math of the Deeprun Tram

Moving Away At Other Station Coming Back Arrives At Your Station Leaves with you m w m w m How many times have you gone to the Deeprun Tram and it was there, waiting, but was gone before you could get to it? If you're a frequent Alliance player, probably tons of times. And whenever that has happened, have you said to yourself, "They should make it wait longer, then people wouldn't miss it so often and people would get to their destination faster." How would you feel if I told you that wasn't the case and that perhaps it waits too long?

On the left I have a little diagram, the part in orange is the part of your journey which you must always endure, the actual travel. The part in white represents where the tram may be when you are actually ready to board it (and not just running to be ready to board). When you are ready to board you may arrive at any one of those points. So your actual time spend waiting on the tram and traveling on it is
where X is a uniformly continuous random variable that ranges from zero to 2m+2w, where m is the amount of time spent moving from one side to the other and w is the amount of time the tram waits at each stop.

What we want to do is we want to minimize t. Or rather, we want to minimize the average value of t. We do this by calculating what's known as the expected value of t, E(t).
I'm fairly certain that I don't REALLY need to go through this next part, but it's a good indication of where calculus is helpful in real life type situations. That and I've spent a good amount of time teaching mathematics and I can't resist a good example. In order to minimize a function (which E(t) certainly is), you take the derivative and check the value of it when that derivative is zero, at endpoints, and at discontinuities. In this case, our variable is w, the amount of time spent at the station. The partial derivative of E(t) with respect to w is
This is because the partial derivative with respect to w of 2m is zero and the partial derivative with respect to w of w is 1.

Here we find that the derivative is never zero, so that means our function, E(t), must be minimized at an endpoint, in this case w=0. So with the goal of people arriving at the other side as fast as possible, it is optimal that the Deeprun Tram (and this can be said of other transports) not wait at all? Well, this is a mathematical model, and there were some limitations put on it to make it simple. What this tells us is that it is optimal for the tram to wait only long enough to let the people who are waiting for it board, which when you think about it, makes sense.

Why is that so? Wouldn't it benefit from waiting longer so that people who are close can get on? No, because if the tram waited longer, that would make its round trips longer and it would make the people who are on it and waiting for it to depart have to wait longer for it to leave.

This post was a fixed-up, more elaborate, better version of a blog post that I did when my blog was young. Many of those older posts have good content, but I was just terrible at writing/the web at the time and I feel they deserve a second chance. Furthermore, since it was old, I bet nobody saw it.

Friday, March 16, 2012

Obisidian's problem with reward cutoffs and continuity

There are tons of things in life which fall under the category of "If X is greater than Y, then you get this." For example, at my current job: I'm going to get laid off  eventually. I haven't been working here long, and by the time the layoff happens I will have been here less than a year. If I had been here longer such that when I get laid off I will have been employed for over a year, then my severance will be double  of what I will end up receiving. In simpler terms
  • Employed < 1 year: Severance=X
  • Employed ≥ 1 year: Severance=2X
Where X is a value that I'm not going to disclose. You've likely been in this sort of situation before if you've ever received a grade of 89, which for most school I've been to is the highest score you can get that isn't an A. You're so close, but not close enough, and it stings. I went to a Catholic high school where an A was 93 or higher. There were more situations that I'd like where my final grade was a 92. It was good, but not good enough, and at most other schools it would have been. I hated it.[1]

Obsidian, developers of Fallout: New Vegas, have found themselves in a similar situation recently. In their contract with Bethesda, Obsidian would only receive a bonus if the New Vegas received a Metacritic score of 85 or higher. The game has an 84. Therefore they receive no bonus, and this has likely led to their recent layoffs and the reported cancellation of an unnamed next-generation title. I'm guessing they needed that bonus to keep that team running. I feel bad for Obsidian, because as far as I'm aware they did pretty good work with Fallout: New Vegas. 

Now, I'm not here to discuss how using Metacritic as a measure of how good a game is quite flawed because Metacritic pulls from reliable, trustworthy sources and other, less reliable sources. I'm here to talk about the mathematics of the situation and how

Graphically, Obisidian's situations can be represented as such
We can all see this plainly, once they hit 85, they get the bonus. Otherwise, they don't. You see, the unfairness lies in the discontinuity in the graph. Does it make sense that they get nothing for an 84 but get it all for an 85? I argue that it's not. Instead of the function that is in their contract, I propose a different function. What if, starting at a score of 80 they receive a small bonus that increases until maxing out at 85.
This seems to make more sense to me, since it rewards different levels of accomplishment in varying amounts. Now, of course, this contract deal would obviously benefit Obsidian more than the previous contract, so if this were part of a discourse, a compromise would likely have to be struck. If might start at 82 instead of 80 and cap out at 87 instead of 85. I made a composite image of that with the payment model that was used.
As you can see, when comparing the two, my way benefits Obsidian if the score is from 82 to 85, It benefits Bethesda if the score is from 85 to 87, and it's the same everywhere else. Under this model, Bethesda still wouldn't have gotten the full bonus, but they would have gotten something. In fact, they would have received 40% of the bonus, which may not have been enough to save their game team, but it would have been something.

I think that people often underestimate the impact that a reward structure can have. Discontinuous ones such as the letter grade system, Obsidian's bonus, and my severance can have very harsh effects for falling just under the cutoff.

I don't think people understand just how important continuity is when we create functions (and these payoff systems are functions) for our life. Every real world phenomenon is continuous. Although things can seem sudden to the point of being an instantaneous difference, they never really are. Their change can be sharp, but it's always there. For example, the people who write the tax code understand this, although the marginal tax rate is a discontinuous function, it makes the actual amount of tax you pay a continuous (specifically, a continuous and increasing) function of your income. That is, until you start to talk about various tax exemptions and loopholes.

So what is it about continuous functions that makes them important? The important thing about a continuous function is that if you have a threshold on how much change you want in your output, there is some amount of change in your input that can be tolerated before breaching that threshold. To rephrase the problem with Obsidian's bonus payment function in these terms is that if you're sitting at a Metacritic score of 85, there is NO amount by which the score can go down and produce a small change in the bonus.[2]

[1] The grade scale at my high school was:
  • A=100-93,
  • B=92-85,
  • C=84-77,
  • D=76-70,
  • and F=69-0.
[2] The continuity of the function isn't the only important factor here. Frankly a continuous function, like the ones that I displayed, could have been made steep enough that it would emulate the bonus payment function that Obisidian had. It's not only the continuity of the function that's important, but also the continuity of all of it's derivatives. Continuity is just the first step at arriving to a function that would play more nicely. To note, a function for which all derivatives are continuous is called smooth.

Tuesday, March 13, 2012

Night School: The Math of Drop Rates

Hopefully that chestpiece is in this pile somewhere...
Drop rates are where most people will encounter and be aware of randomness in World of Warcraft. The other places would be in crits and random procs, of course. There can also be quite a bit of misunderstanding about how they work. Everybody knows the basics, of course: when the boss dies, the game rolls some random numbers and finds those numbers in the loot table to see what the boss should drop. Different items have different drop rates, which come from that item occupying a larger or smaller section of the loot table, making it more or less likely to drop. Other things, like tier tokens and legendary weapon fragments are often rolled for on separate tables from the normal loot.

For the duration of this post, I talk about drop rates with the percents, but all the math with be done with the decimal. So, 10% is 0.10, 5% is 0.05, and 100% is 1. Percents (Latin for "per 100") are a great way to talk about these things, but you cannot do the actual math with them, one must convert them to decimals.

How long until this item will drop?
That's the big question, isn't it. When will my shield drop? Why can't I get a shoulder token? Where is that stupid phoenix mount? Let's just assume that you're the only person contending for a particular item, and that when it drops it will go to you. Will you indulge me by allowing me a table? Who am I kidding? I'm putting a table here whether you like it or not.

Minimum Kills for X% of people?
Drop rate
% of players50%10%1%
50%2769
10%422230
1%744459

An entry from this chart should read as, "With a drop rate of 10%, 50% of players will have to kill the boss 7 or more tries."

So how do you like those numbers? That mount that has a 1% drop rate? There's a ~50% chance it will take you 68 or fewer tries. There's also a 10% chance it will take you 230 or more tries. You might notice that the numbers for 1% of players is roughly double that for the 10% of players. This is because 1% is 10% of 10%. But where does all this come from?

Suppose the probability that an item will drop is p, and the probability that it won't drop would then be 1-p. If you want to know the probability that something will drop after you've killed the boss x times, that's actually difficult to directly calculate, because it could drop multiple times. When calculating probabilities, you'll very often run into situations where the thing you want to know is hard to calculate directly, but the opposite of it (in this case, the probability that the item won't drop in x kills) is very easy to calculate. In that case you calculate the probability that it won't happen and then subtract the result from 1.

In our question, calculating the probability that something won't drop is easy. You simply take the probability that it won't drop from a single kill, 1-p, and raise it to the power of the number of kills, x. You multiply because these are independent events, meaning that the outcome of one event (a kill) does not affect the outcome of the other events. This makes the probability that the item won't drop is*
and the probability that it will drop at least once is
One thing that could be noticed from playing around with that equation is that, for any positive value of x,  unless p=0 or 1, the formula will never equal 0 or 1. In other words, the only times when there is absolute certainty is when the drop isn't random, or you haven't killed the boss yet. Here is a chart that depicts the probability that an item will have dropped based on how many kills have been attempted. Here, the probability of a drop is 10%.

Wolfram Alpha is a great source for doing math.** 
You'll notice that even at the number of kills get's very large, the probability that the item will have dropped never actually hits 1. So no matter how many times you kill, there's no guarantee that the item will drop.

There is an article written by Brian Wood on WoWInsider that contains a wonderful calculator for drop rate percentages such as this. I highly recommend that you check it out here.

Corollary: Average Number of Drops
Of course, the previous section is based on an assumption that you'll only want one of an item, and that it will only drop from one boss/monster. Say you are farming something that has a <100% chance of dropping from whatever you're killing. Let's say it's Relics of Ulduar. It has an 11% percent chance of dropping off of Mildred the Cruel If you want to know the average number that you should expect to get after so many kills, you just multiply the probability of it dropping by the number of kills. If you were to kill Mildred 26 times, then you should expect to have an average of .11*26=2.86 Relics of Ulduar.

The mousover text for those equations contains the LaTeX code used to produce them at the Online LaTeX Equation Editor. Note: "\left(" and "\right)" weren't actually necessary for those, I could have just used "(" and ")" but it's considered a best practice to use the longer ones because they scale in size with their contents. Consider the example below:


**I used Wolfram Alpha to produce the graph up above. It's an amazing thing. Like if Google could do your homework. It can factor polynomials, give population statistics, and even do calculus. I used the free trial of the pro service to get the graph above. The whole thing blows my damn mind.

Thursday, March 8, 2012

WoW Survey Results: behind the scenes of "crossplay"

I tend to round to two decimal places for all the stuff I do, just so you know. I like two decimal places because it's the same level of accuracy that you get with money; so it feels specific without being overly so.

During the writing of my post on crossplay, I encountered a problem. When I was looking at the difference in crossplay between the young and the old group, I wanted a way to talk about whether a particular increase for a race or class was more or less than the average increase. I've included a small sample of one of those tables below.

Crossplay by age for race
YoungerOlder
Average27.62%34.65%
Human31.28%41.51%
Troll16.67%26%
You'll notice that the last column has been removed also. That's because that's exactly what we're here to talk about. My first instinct for that last column, which I'll just refer to as the "change" column, was to just to take the difference. This would give us a difference of 10.23 for the humans and 9.33 for the trolls. I didn't like that, though, because I felt that the trolls' gain was more significant since they started off much lower than the humans.

My next instinct was to try ratios (division) for the last column. This would give the humans a result of 1.33, a ~33% increase, and the trolls a result of 1.56, a ~56% increase. While this looks good for these two numbers, I actually have conceptual problems with this as well. Suppose I included a third race here for which the young group had 90% female characters and 100% female characters for the older group. This would give us a result of 1.11 (repeating, of course). I feel that's too low though; going from having 10% male characters to zero is a pretty significant thing. So I wanted something that will scale well at the low end and at the high end. Just as gaining 10 percentage points is a big deal when you have very little, such as the trolls, it's also a big deal when there's not much left to pick from, such as for this hypothetical race.

So it occurred to me that just considering how many female characters there were would be insufficient, and that I would also need to look at how many male character there were. This is when I turned to looking at the odds. In short (if you don't want to read that link), the odds of something happening is the probability that it will happen divided by the probability it won't happen. So if the odds of something happening are 10:1, it's 10 times more likely to happen than to not happen. So I decided to look at the ratio of the odds for each age group, or as I summarized in the last post
where p is the percentage of female characters for that group. When I did all the calculations and thought about how I felt about the results, everything just looked right. The values that I felt should be bigger than others were all that way. 

So if you're wondering how this stuff get's done; that's how. It's trial, error, and intuition.

Wednesday, March 7, 2012

WoW Survey Results: Looking at crossplay

Actually a dude
There's a bit of an adage about World of Warcraft that the men are men, and so are the women. This is to say that no matter what the gender of the character you're looking at is, it's likely a guy playing that character. Now, given the percentage of female players that some studies have shown and the percent of the time that players of both genders play oppositely-gendered characters, this is actually unlikely.

For this article, and forever on until I manage to find a better one, I will use the term "crossplay" to refer to when a person plays a character whose gender is different from their gender.

In general, from my survey results, male respondents engaged in crossplay ~33.96% of the time and female respondents engaged in crossplay ~9.19% of the time. Right of the bat we see that men engage in crossplay far more than women do, almost 4 times as much. If you ask, most male players would likely tell you that you spend all of your time in this game looking at your character's butt and they would like to enjoy looking at what is presented to them.

Is that all there is too it? Guys, why do (or don't) you play female characters? Ladies, why do (or don't) you play male characters? Well, we can look at this ourselves a bit while we wait for potentially helpful comments. Let's get some breakdowns in here. Unfortunately, as in the past, I can't supply a breakdown of crossplay for female respondents due to an insufficient volume of female respondents. I'm so totally bummed about that. So, if I fail to stipulate it later on, I'm just talking about crossplay by male players.

Percent of crossplay for male respondents for each class
PriestPaladinMageShamanRogueDruidHunterWarlockDeath KnightWarrior
49.2140.5738.6234.0432.8131.5329.8828.7827.5924.66

What immediately springs out for me is something that I've noticed before. We find the warlock, Death Knight and warrior are at the bottom of a list. We saw this before when I was looking at gender and class, when those were 3 of the 4 least played classes for female respondents. It's interesting that three of the four least played classes for female respondents are the least crossplayed classes for male respondents. Although pinpointing why it's this way will have the same troubles that we had back then. The correlations between armor type, role, location in battle, and theme will confuse the analysis. We also see that our light-wielders, the priest and the paladin, hold solid leads in the top spots with the cloth-wearing mage in the third spot. Let's look at this a few different ways.

Average crossplay by armor type
ClothLeatherMailPlate
38.8732.17
31.9530.94
This table shows a pretty clear trend that indicates that as you go from the lighter armor types to the heavier armor types, the average amount of crossplay by male respondents decreases. This probably plays into the aesthetics of the armor as many male players probably don't imagine a male hero wearing a robe or a female hero wearing bulky plate.

Average crossplay by role
No HealHeal
No Tank32.5241.61
Tank26.1336.05
This table show us that healers tend to have more crossplay while tanks tend to have less crossplay. Does this show that male players consider tanking to be a masculine role and healing to be a feminine role?

Average crossplay by fight location
MeleeMixRanged
28.3535.3736.62
Here we can see that male players tend to crossplay less with characters in melee and more with characters at range. I feel less certain that this one plays into real feelings and feel that it may just be a correlation with the effects of role and armor type.

The three tables above really break down what I think are some of the predominant factors that influence whether a male player will crossplay. I think that armor type and how it affects aesthetics and role/fighting location and how that affects perception really make up the most of it. I'll admit that I am not immune to this as well, but I'll get into that after this next section. Now let's look at how race influences crossplay.

Percent of crossplay for male respondents for each race
DraeneiNEBEHumanGnomeGoblinWorgenUndeadTrollDwarfOrcTauren
59.7052.8752.6040.6435.7731.3625.3322.9421.7214.8313.9212.80

There is some wide variance here, huh. Analyzing the races is different since they can't be broken into groups as easily as classes can be. The thing that tends to stick out to me, is the comparative of the female model, especially when that is compared to the male model. We see that the female models that are the most attractive (according to human standards, of course) are at the top of this list. I have complete faith that the patented female Draenei hip wiggle has played no small role in vaulting them to the front of this list. Gnomes, while certainly not having human proportions, are much like tiny humans, which is probably the factor that has placed them in the number 5 spot above all the "monstrous" races and the dwarves. Interestingly, although dwarves are quite human, moreso than the gnomes in my opinion, they are at tenth place here. I guess guys just tend to be too shallow for them. They probably couldn't handle a playing a dwarven lady anyway. One last table for this section, you probably noticed this yourself with the last one.

Crossplay by faction
AllianceHorde
38.19%25.89%

This combined with the fact that the Horde has fewer female players than the Alliance means that the Horde is a bit of a sausage fest, comparatively. Sorry Horde bros, that's just the way it is.
Also really a dude

In full disclosure I must admit that I am not immune to the draw of the female characters, although I believe my percentage is lower than the average. My very first female character was a Night Elf priest (how typical, right?) and my second female character is a human warrior, which I've talked about before (and need to play more). I honestly can't remember any others that I may have.

So it seems that the trends that drive men to play a female character are the oft-quoted attractiveness and their perception of in-game gender roles. What I'm particularly interested in is why there is such a difference in the percentage of crossplay between male and female players. Do women play so few male characters because female characters tend to be more attractive? What other components are there to this?

But wait, there's more - Age and crossplay
There is an age component to all of this, too. In general, older male players are more likely to play female characters than younger male players. Going back to the two groups that I set up for my post about the ages of male players and how that impacted what they played, I found that in general, the 18 and younger group played female characters 27.62% of the time while the 25 and older group played female characters 34.65% of the time. Futhermore, the increase from one group to another was not uniform, some groups saw a higher increase than others.

Crossplay by age for class
YoungerOlderComparison of odds*
Average27.62%34.65%1.39
Priest46.02%47.26%1.05
Mage37.27%37.24%1.00
Paladin35.33%42.71%1.36
Shaman30.08%32.88%1.14
Hunter27.27%25.51%0.91
Rogue23.85%26.84%1.17
Druid23.81%39.87%2.12
Warlock21.11%27.78%1.44
Death Knight17.65%27.75%1.79
Warrior15.15%25.48%1.91

So every group except for the hunter and the mage saw an increase in their amount of crossplay among the male respondents at they ageds. When looking at this chart, however, some of the classes increased less than the average increase. So while female characters tend to appeal more as we move from the younger group to the older group, some don't increase as much. In summary, as male players age
  • Decreased: hunter, mage
  • Increased<Average: priest, shaman, rogue, paladin
  • Increased>Average: warlock, Death Knight, warrior, druid
One thing to notice is that the classes that had the lowest percentage of female players among the younger group saw the biggest increases. It's distinctly possible that as male players get older, they tend to throw away a bit of their preconceived notions about in-game gender roles. This isn't to say that the older male players are an enlightened bunch, but just that they don't subscribe to those gender roles as strongly.

Crossplay by age for race
YoungerOlderComparison of odds*
Average27.62%34.65%1.39
Draenei58.75%53.7%0.81
Night Elf47.58%47.11%0.98
Blood Elf44.44%52.02%1.36
Human31.28%41.51%1.56
Goblin23.61%30.43%1.42
Gnome22.92%39.19%2.17
Dwarf18.18%13.25%0.69
Worgen17.65%30.84%2.08
Troll16.67%26%1.76
Undead15.79%29.27%2.21
Orc10.62%9.17%0.85
Tauren10.48%21.88%2.42

 In summary, this is
  • Decrease: dwarf, draenei, orc, Night Elf
  • Increase<Average:Blood Elf
  • Increase>Average:goblin, human, troll, worgen, gnome, undead, tauren
 One thing to notice here is that in addition to being more open to crossplay, the older male group also seems to have lost their qualms with the "monstrous" female races, with all of them except for the orc receiving significant gains in popularity. Quite frankly, I can't come up with a reason that the orc and the dwarf would have a decrease in popularity. It's puzzling to me.

I could have done the various breakdowns that I normally do but I think what we saw was pretty clear and that I would spare you all.   ;-)

Conclusion
Male crossplay is something that has many factors. In general, it seems to be affected by the attractiveness of the female model of the chosen race as well as the aesthetics of the class's armor. Futhermore, it seems to be affected by the in-game gender roles that the players seem to ascribe to their character's PVE roles.

As male players get older, things seem to change. They seem to become more willing to crossplay in general. It seems likely to me that this isn't due to an increased desire to play female characters but a loss of feeling that they have to play male characters. Furthermore, they seem to becomes more open in how they crossplay, not feeling as strong a pull to tend to those perceived in game gender roles and becoming more open to crossplaying with races that they might not find as attractive as others.

All in all, no matter how much analysis I do here, we can't conclude anything about why a particular person engages in crossplay or why they crossplay with the particular character(s) that they do. For some, it could just be about having something nice to look at. For some, it could be for roleplay purposes. For others, it can be part of their transition process as a transgendered person.

In the future, I'd like to be able to take a look at female crossplay. The fact that it is more rare makes the possibility of analyzing it all the more appealing. If I get the chance to do a study like this again in the future I will go to great steps to get a large enough number of female respondents so that I can achieve such an analysis.

Next time, I intend to look at what I'm calling "class correlations." I'll be looking at what classes tend to be played by the same person and how if one person plays one class, how likely is it that they play the other classes. Are there some classes that are much likelier to be played together than others? We'll find out.

*The comparison of odds column is calculated as follows. If p(young) is the percentage of female characters for the young group and p(old) being the same for the older group, with both being between 0 and 1, then the comparison of odds,
This is a measure of the increase in crossplay from the young group to the male group. It is the odds that a older respondent crossplays for that class divided by the odds that a younger respondent crossplays for that class.

Friday, February 24, 2012

WoW Survey Results: Age Differences


MAAATTTTHHHHH
We've already covered the topic of how the different gender's pick their characters, but what about people of different ages? The differences are more pronounced than I thought they would be. To do this part of the study, I split the male respondent base into three groups, each as close to one-third of the total as I could. The groups were those 18 and younger, those from 19 to 24, and those 25 and older. I took the young group and the older group and then I summarized and compared them. Each group consisted of over 400 respondents, with approximately the same number of respondents in each group.

Since there was a correlation between the age and gender of respondents, I separated the male and female respondents so I could analyze each independently. Unfortunately, I did not have enough female respondents to split them into groups for a similar age analysis. I really wish I did. I intend on doing another survey in the future and I relly hope that I can not only have a more robust form, but that it will get a much better spread through the community.

Average Class Representation
ClassDeath KnightDruidHunterMagePaladinPriestRogueShamanWarlockWarrior
Younger10.95%11.84%10.63%8.86%12.08%9.1%8.78%9.9%7.25%10.63%
Older10.57%10.78%9.89%9.89%13.1%9.96%7.78%9.96%7.37%10.71%
Difference-0.38%-1.06%-0.74%+1.03%+1.02%+.86%-1.0%+0.06%+0.12%+0.08%

The classes that increased in representation as you go from the younger respondents to the older respondents were the mage, paladin, and priest primarily with the shaman, warlock and warrior receiving minor increases. The classes that decreased in representation were the Death Knight, druid, hunter, and rogue. I personally don't see any particular trend in the data. There is a decrease in the leather and mail wearers and an increase in the cloth and plate wearers as you go from the younger to the older respondents. When I tracked the preferences of the two age groups by role, the changes were incredibly small. Then I looked at things with respect to the class's location when fighting.

Average Representation by Location

YoungerOlder
Melee10.12%9.69%
Mix11.27%11.28%
Ranged8.96%9.28%

Here we see a decrease in melee-only classes and an increase in ranged-only classes, with the classes that do both remaining about the same. Is it possible that young men just feel a stronger need to hit things with weapons, and that drives them towards warriors, Death Knights, and rogues? I feel that's distinctly the case. Now, the difference we're talking about here is still somewhat small, but it is there. It likely reflects an overall trend for male players that if I had enough data and could make a category for each age, would pan out.

Average Race Representation
Blood ElfDraeneiDwarfGnomeGoblinHumanNight ElfOrc TaurenTroll UndeadWorgen
Y12.32%6.44%5.31%3.86%5.8%14.41%9.98%9.1%8.53%8.21%9.18%6.84%
O13.51%7.37%5.66%5.05%6.28%14.46%8.25%8.19%8.73%6.82%8.39%7.3%
D1.190.930.351.190.480.05-1.73-0.910.2-1.39-0.790.46

From this (crammed) chart, we can see that the blood elves, draenei, dwarves, gnomes, goblins, humans, tauren, and wrogen all increased in representation while the night elves, orcs, trolls, and undead decreased in representation.

Races Representation by Faction
Young46.84%53.16%
Older48.09%51.91%

And from this we can definitely confirm something the previous table hints at, which is that the Alliance is more popular among older players than younger players. Oddly, the Blood Elves had the most significant gain when going from younger to older respondents (tied w/ gnomes). This is very interesting given the Horde's overall decrease in popularity. Similarly, the Night Elves saw a dramatic loss in representation despite the Alliance's overall increase in popularity. Frankly, I find this odd and I'm somewhat at a loss as to why this may be. Are young men afraid of playing the less muscular blood elf? Does the night elf suddenly become "not cool" as men age? I certainly welcome guesses/perspective in the comments.

From the results presented above we can see that the age of a player (at least for male players) has an influence on how they pick and choose their characters. I unfortunately did not have enough data to do a similar study comparing different age groups of female respondents, but I hope to be able to do so in the future.

I plan on coming back to this sort of age comparison in a later post, when I talk about for which races and classes men like to play female characters. Men play far more female characters than women do male characters and we'll be looking at where they tend to do so the most.

          - Σ Δ