I haven't been able to spend as much time blogging as I'd like of late, mostly due to a fairly intense few weeks at work.
When I started this job about 20 months ago, I was working on back-end server software for my company's casino gaming products (essentially slot machines, but technically they're not -- long story).
But about 6 months ago, I started to work on the games themselves, helping out with some of the internal utility work (accepting money for credits on the machine, printing tickets when the payer cashes out, etc.) Then a few months ago, I started working more on the presentation portion of the games -- the spinning reels of the machines, managing the user interface, etc.
And a few weeks ago, I started working on the internal "math models" of our games. So I've gone from having nothing to do with our games to having just about everything to do with our games in less than a year. It's been an exciting and very educational journey.
This latest phase, working on math models, has been fascinating.
A math model is really just a big spreadsheet that lists all of the possible outcomes of a game, and the odds/total payback for each outcome based on a particular cycle of runs. It defines the payback/hold percentages for a game, but more importantly it defines the sort of experience that a player will have with the game. It is incredible how many different levers there are to push and pull, and the dramatic effect each of them has on the feel of the game.
First, a bit of background. Slot machines work essentially by generating a random number when the player starts a game, and looking up that random number in a predefined table of outcomes to determine how much (if anything) to pay back the player for that game. The odds of a given outcome are determined by how many of all the possible random numbers are assigned to that particular outcome.
Machines are designed to pay back some percentage of all the money wagered on them. And believe it or not, while it often doesn't feel like it, most machines actually pay back at a rate between 85%-96%.
It is important to remember, however, that these percentages are averages over the life of the machine, and across all possible outcomes for the game. It's also important to remember that the payback is based on the money wagered on the game, not the money put into the machine. It is possible to put $20 into a machine, play to 95% payback, and still lose all of your $20.
How?
Because as you play the game, you'll occasionally get a few credits back. Sometimes quite a few. And if you continue to play those credits, you're wagering much more than the $20 that you put into the game. It's not uncommon for $20 of cash in the machine to generate $50 or more of wagers. That $50 in wagers might have generated $30 in winnings. Of course, the $50 of bet less the $30 of win would leave you in the hole by $20 -- which is where your original twenty went.
Anyhow, the math model defines how much you can get paid on any given game, and how likely you are to be paid that particular amount. They are usually defined in terms of millions of games played, but here's a simple example to illustrate the point.
Let's say that we want to design a game with 95% payback based on a cycle of 100 games. We have lots of choices that will work out the same mathematically, but will give vastly different experiences to the player.
One option we have is to pay back 1 credit on 95 out of 100 games. Your chance of being paid back one credit would be 95% -- pretty darn likely. And the "hit frequency", or the number of times a win of any kind occurs, would also be 95%, which is extraordinarily high. But the game would be boring as hell, and nobody would play it. Not only would you have a real good idea in advance of what the next game would pay, but there would literally be no possible way to make any money playing the game, because the best you could possibly do is win back what you just bet -- and that wouldn't always happen. It's a sure loser for the player, and a very poor math model.
At the other extreme, we could easily pay 95 credits back on 1 out of 100 games. Our payback would of course still be 95%. Your chance of being paid 95 credits would be 1% -- really not good at all. And the hit frequency would also be 1% -- only 1 out of 100 games has any sort of payback. On the other hand, this is a game at which you could certainly make money -- if you were extraordinarily lucky. It would be possible to win $95 on your first $1 wagered. But it's still a boring game, because 99% of the time it wouldn't pay you anything at all.
So the trick is in finding the right balance of hit frequency (giving the player some money back occasionally) and pay values (giving the player an opportunity, however unlikely, to make money on the machine).
We might instead try to offer a relatively large pay, and a few medium-size pays, and several smaller pays, to make the game more interesting. Keep in mind that our goal is to pay back on average 95 of every 100 credits wagered. So as we build our model, we have to keep track of how much each outcome is expected to pay.
In 100 games, we might offer 1 pay of 25 credits. Taking that pay away from our 95 credit goal, we still have 70 credits to pay back in 99 games.
We might offer 3 pays of 10 credits. That's worth 30 credits total, bringing us down to 40 credits left in 96 games.
We might offer 6 pays of 5 credits. That's also worth 30 credits total, so we have 10 credits left to pay back in 90 games.
If we offered 10 pays of 1 credit, that would give us a total payback of 95 credits in 100 games.
So adding up all of our pays, we have 1+3+6+10 possible winning outcomes, for a total of 20 wins out of 100. Our hit frequency would be 20%. Put another way, 1 in every 5 games we'd expect to get something back for our wager. We'd lose our bet in 4 out of 5 cases.
Our payback would be 95% as desired. But obviously, with an 80% chance that any given play of the game will result in losing your wager, the typical player experience will emphatically not be a loss of merely 5% of his or her money.
As I'm fond of saying, "That's how they get ya!"
Also, it is absolutely critical to remember that these models are based on averages (means) over the life of the machine. Because the pays are actually determined by random numbers, it is entirely possible (just very improbable) that you could hit the top award twice or even three times in a row, and make a lot of money at the machine. It's also possible to play 100 straight games without a winner of any kind.
One of the big surprises I've found is that an event that should happen on average 1 in every 5 times will occasionally take 30 or 40 tries to achieve, yet in a sizable majority of cases will take fewer than the average number of tries to achieve. This is an area where the difference between "mean" and "median" becomes crystal clear.
Anyhow, actual math models are composed of many more pay outcomes over a cycle of millions of games rather than 100. As simple and mechanical as the calculations behind the whole thing may be, there's a real art to shaping the pays to provide an interesting "ride" for the player. Allowing the player an opportunity to occasionally get ahead of the game without giving away too much money is a huge challenge. I've personally tried dozens of different models over the past few weeks that looked fine on paper, but played like crap. Each was a learning experience, though, and while it's been a great deal of work, it's also been a great deal of fun.
I'm not doing anything remotely like what I was hired to do originally, and that's too cool for words. ;-)

Too. Much. Math.
Posted by: Chris Snethen | Wednesday, February 14, 2007 at 12:15 PM