making a slot machine
Certain explanations are best handled with examples, so the site will need a demo slot machine. To avoid any legal issues with slot machine makers, the best solution for a demo machine is to make one from scratch. Understanding how a slot machine works will make this relatively easy. It will be the process of analyzing a slot machine in reverse.
the game concept
The first step in creating a slot machine is coming up with a design concept. The math will then be applied to concept to hopefully make a playable game.
Some of the questions that need to be answered during this process are:
- How many reels will the game have? Will the game feature wild symbols or bonus symbols?
- Will the game use stepper or video reels?
- How many stops will the reels have? How many virtual stops?
- Will there a bonus game? Will the outcome be predetermined or player controlled?
- Will there be a progressive?
To keep things simple, the game created here here will only have three reels with 22 physical stops. Each of those reels will be broken up into 64 virtual stops. The game will have a wild symbol that is also a multiplier, a bonus game, and pay on mixed symbols.
The game:
- Vaguely Chinese theme
- Name of game is "假老虎机"
- jiǎ lǎohǔjī
- 老虎机 literally means “tiger machine”
- All base pays, except any mixed symbols, will include an 8
- 8 is considered lucky in Chinese culture
- 4 is considered unlucky (pronounced similar to death), so no fours will be included on the paytable
- Hong bao (“red envelope”) player pick bonus game
- Wager one or two credits
- Second credit makes player bonus game eligible and boosts wins for highest paying symbol only (similar to IGT's Top Dollar game)
- Three stepper reels
- 22 stops on the steppers
- 64 virtual stops
- Eight symbols
- Eights
- 888 — T8
- 88 — D8
- 8 — S8
- Bars
- Triple — TB
- Double — DB
- Single — SB
- 3x multiplier wild — 3x
- Only on reel 1
- Wild for all symbols except bonus
- Bonus game initiator - BS
- Only on reel 3
- Does not participate in any symbol pays
- Blank spaces (~~)
- Mixed symbols will pay — any 8s (A8), any bars (AB), and any mixed symbol except bonus (AS)
- Player controlled bonus game
- Player's pick determines the amount they win
- No progressives jackpots or random features
- Target theoretical return to player is 95%
- Target hit rate is 15% (approximately one win per seven plays)
The math will be exactly the same as it was above, but the process will be in reverse. Instead of using math to determine the game's hit rate and RTP from the reels and paytable, these will be created through designing virtual reels in a bit of a trial and error fashion.
The first thing to do is to determine all the possible winning combinations. This can be done in any order, but using ascending or descending order by rank will make it easier. The highest pay will be a 3x wild symbol on reel 1 with T8 on reel 2 and reel 3. The next highest pay will be T8 on all three reels. The list much also include combinations of any 8 symbols (A8), combinations of any bar symbol (AB), and combinations of any non-bonus symbol (AS) because these will also pay.
factor | |||
---|---|---|---|
winning combination | vr1 | vr2 | vr3 |
3x T8 T8 | ? | ? | ? |
T8 T8 T8 | ? | ? | ? |
3x D8 D8 | ? | ? | ? |
D8 D8 D8 | ? | ? | ? |
3x S8 S8 | ? | ? | ? |
S8 S8 S8 | ? | ? | ? |
3x A8 A8 | ? | ? | ? |
A8 A8 A8 | ? | ? | ? |
3x TB TB | ? | ? | ? |
TB TB TB | ? | ? | ? |
3x DB DB | ? | ? | ? |
DB DB DB | ? | ? | ? |
3x SB SB | ? | ? | ? |
SB SB SB | ? | ? | ? |
3x AB AB | ? | ? | ? |
AB AB AB | ? | ? | ? |
3x AS AS | ? | ? | ? |
AS AS AS | ? | ? | ? |
Generally, the number of combinations for the highest pays will be relatively small. This allows for larger prize amounts as the overall return will remain low. The contribution of each winning combination to the return will increase as prize value decreases. Small wins will be much more frequent. The majority of the games pays will be very small wins.
Getting the math right will require some trial and error. This Excel spreadsheet might be helpful. The formulas are already applied. Just update the blue bordered cells and the sheet will take care of the rest.
win | vr1 | vr2 | vr3 | combinations | minus | actual |
---|---|---|---|---|---|---|
3x T8 T8 | 1 | 1 | 2 | 2 | 0 | 2 |
T8 T8 T8 | 2 | 1 | 2 | 4 | 0 | 4 |
3x D8 D8 | 1 | 3 | 2 | 6 | 0 | 6 |
D8 D8 D8 | 4 | 3 | 2 | 24 | 0 | 24 |
3x S8 S8 | 1 | 4 | 4 | 16 | 0 | 16 |
S8 S8 S8 | 5 | 4 | 4 | 80 | 0 | 80 |
3x A8 A8 | 1 | 8 | 8 | |||
A8 A8 A8 | 11 | 8 | 8 |
For mixed 8 with 3x multiplier (3x-A8-A8):
win | vr1 | vr2 | vr3 | combinations | minus | actual |
---|---|---|---|---|---|---|
3x A8 A8 | 1 | 8 | 8 | 40 | 24 | 40 |
A8 A8 A8 | 11 | 8 | 8 | 596 | 108 | 596 |
Including pay amounts will allow returns to be calculated.
win | 1 credit | 2 credit |
---|---|---|
3x T8 T8 | 2664 | 4164 |
T8 T8 T8 | 888 | 1388 |
3x D8 D8 | 864 | 864 |
D8 D8 D8 | 288 | 288 |
3x S8 S8 | 264 | 264 |
S8 S8 S8 | 88 | 88 |
pays | return | ||||
---|---|---|---|---|---|
win | probability | 1 credit | 2 credit | 1 credit | 2 credit |
3x T8 T8 | 1/2 | 2664 | 4164 | 0.02032470703125 | 0.031768799 |
T8 T8 T8 | 1/4 | 888 | 1388 | 0.0135498046875 | 0.021179199 |
3x D8 D8 | 1/6 | 864 | 864 | 0.019775390625 | 0.019775390625 |
D8 D8 D8 | 1/24 | 288 | 288 | 0.0263671875 | 0.0263671875 |
3x S8 S8 | 1/16 | 264 | 264 | 0.01611328125 | 0.01611328125 |
S8 S8 S8 | 1/80 | 88 | 88 | 0.02685546875 | 0.02685546875 |
3x A8 A8 | 1/40 | 174 | 174 | 0.02655029296875 | 0.02655029296875 |
A8 A8 A8 | 1/596 | 58 | 58 | 0.131866455078125 | 0.131866455078125 |
3x TB TB | 1/42 | 84 | 84 | 0.013458251953125 | 0.013458251953125 |
TB TB TB | 1/252 | 28 | 28 | 0.02691650390625 | 0.02691650390625 |
3x DB DB | 1/56 | 54 | 54 | 0.01153564453125 | 0.01153564453125 |
DB DB DB | 1/448 | 18 | 18 | 0.03076171875 | 0.03076171875 |
3x SB SB | 1/110 | 24 | 24 | 0.01007080078125 | 0.01007080078125 |
SB SB SB | 1/1100 | 8 | 8 | 0.0335693359375 | 0.0335693359375 |
3x AB AB | 1/392 | 15 | 15 | 0.022430419921875 | 0.022430419921875 |
AB AB AB | 1/12600 | 5 | 5 | 0.240325927734375 | 0.240325927734375 |
3x AS AS | 1/392 | 9 | 9 | 0.013458251953125 | 0.013458251953125 |
AS AS AS | 1/21856 | 3 | 3 | 0.2501220703125 | 0.2501220703125 |
--- --- [?] | 1/4096 | 0 | 60.75 | 0 | 0.94921875 |
The return will be equal to the sum of all individual win returns divided by the number of credits wagered. This will normalize the return to a percentage of a single betting unit. The return for 1 credit wagers is 93.405%. The return for a two credit wager is 95.117%. Changing the number of virtual stops for any symbol will change the game's theoretical RTP. This is how slot manufacturers offer casinos differing payback percentage options on a slot machine. The effect of removing just one occurrence of a symbol can be quite large. Changing one of the bar symbols on reel 3 to a blank would reduce the theoretical return to player from 95% to 94%.
The hit rate will be equal to the sum of the probabilities of each win. Since this game has different pays on one and two credit bets, the hit rates will be different. The hit rate for a one credit bet is 14.5% while the hit rate for a two credit bet is 16.1%. A player betting one coin will win about one game per 6.9 played. Betting the second credit will lower plays per hit to 6.22 games. The difference between the 1 credit and 2 credit return to player is due to the bonus game being available on a 2 credit bet.
making a bonus game
The majority of slot machines have some type of bonus game. To make things simple, the bonus game for this example is a pick a prize feature. The player is presented with 3 mystery objects—in this case red envelopes (红包)—and chooses one. The player is then awarded that prize.
The bonus feature will use three different buckets: a small value bucket from 8 to 64 credits in multiples of 8, a medium value bucket with values from 18 to 78 in increments of 10, and a large value bucket with values of 88, 188, 388, and 888. The values were selected to prevent duplicates in game. Values will be chosen by random number. The weighting for the bonus feature is as follows:
small value envelope | ||||
---|---|---|---|---|
value | minimum | maximum | factor | coin out |
8 | 0 | 31 | 32 | 256 |
16 | 32 | 43 | 12 | 192 |
24 | 44 | 47 | 4 | 96 |
32 | 48 | 51 | 4 | 128 |
40 | 52 | 55 | 4 | 160 |
48 | 56 | 59 | 4 | 192 |
64 | 60 | 63 | 4 | 256 |
medium value element | ||||
---|---|---|---|---|
value | minimum | maximum | factor | coin out |
18 | 0 | 29 | 30 | 540 |
28 | 30 | 40 | 11 | 308 |
38 | 41 | 48 | 8 | 304 |
58 | 49 | 54 | 6 | 348 |
68 | 55 | 59 | 5 | 340 |
78 | 60 | 63 | 4 | 312 |
large value envelope | ||||
---|---|---|---|---|
minimum | maximum | value | number | coin out |
88 | 0 | 55 | 56 | 4928 |
188 | 56 | 59 | 4 | 752 |
388 | 60 | 61 | 2 | 776 |
888 | 62 | 63 | 2 | 1776 |
The average value of all possible bonus combinations is 60.75 credits. The probability of getting a bonus is 1/64.
The majority of the return for the second coin is from bonus games. A very small amount is also coming from a small boost to the highest paying win combination. T8-T8-T8 gets a 500 credit boost for betting a second coin, which is boosted by 1500 with the 3x multiplier.
constructing the reels
Now it is just a matter of deciding how to distribute the symbols on the reels. The blank symbols will need to be broken up into 11 groups to evenly distribute then across the stepper reel that the player will see. The other 11 groups will be the game symbols.
vr1 | vr2 | vr3 | |
---|---|---|---|
0 | ~~ | ~~ | ~~ |
1 | ~~ | ~~ | ~~ |
2 | ~~ | ~~ | ~~ |
3 | T8 | ~~ | ~~ |
4 | T8 | T8 | T8 |
5 | ~~ | ~~ | T8 |
6 | ~~ | ~~ | ~~ |
7 | ~~ | ~~ | ~~ |
8 | TB | ~~ | ~~ |
9 | TB | TB | ~~ |
10 | TB | TB | SB |
11 | TB | TB | SB |
12 | TB | TB | ~~ |
13 | TB | TB | ~~ |
14 | ~~ | TB | TB |
15 | ~~ | TB | TB |
16 | SB | ~~ | TB |
17 | SB | ~~ | TB |
18 | ~~ | SB | TB |
19 | ~~ | SB | TB |
20 | S8 | SB | ~~ |
21 | S8 | ~~ | ~~ |
vr1 | vr2 | vr3 | |
---|---|---|---|
22 | S8 | ~~ | S8 |
23 | S8 | DB | S8 |
24 | S8 | DB | S8 |
25 | ~~ | DB | S8 |
26 | ~~ | ~~ | ~~ |
27 | SB | ~~ | ~~ |
28 | SB | ~~ | DB |
29 | ~~ | SB | DB |
30 | ~~ | SB | DB |
31 | DB | SB | DB |
32 | DB | ~~ | ~~ |
33 | DB | ~~ | ~~ |
34 | DB | ~~ | ~~ |
35 | ~~ | ~~ | ~~ |
36 | ~~ | D8 | BS |
37 | D8 | D8 | ~~ |
38 | D8 | D8 | ~~ |
39 | D8 | ~~ | ~~ |
40 | D8 | ~~ | ~~ |
41 | ~~ | ~~ | SB |
42 | ~~ | ~~ | SB |
43 | DB | SB | ~~ |
vr1 | vr2 | vr3 | |
---|---|---|---|
44 | DB | SB | ~~ |
45 | DB | ~~ | ~~ |
46 | DB | ~~ | D8 |
47 | ~~ | DB | D8 |
48 | ~~ | DB | ~~ |
49 | SB | ~~ | ~~ |
50 | SB | ~~ | SB |
51 | ~~ | S8 | SB |
52 | ~~ | S8 | SB |
53 | ~~ | S8 | ~~ |
54 | ~~ | S8 | ~~ |
55 | 3x | ~~ | DB |
56 | ~~ | ~~ | DB |
57 | ~~ | DB | DB |
58 | ~~ | DB | ~~ |
59 | ~~ | DB | ~~ |
60 | SB | ~~ | SB |
61 | SB | ~~ | SB |
62 | SB | SB | SB |
63 | SB | SB | SB |
The stepper reels would be:
r1 | r2 | r3 | |
---|---|---|---|
0 | ~~ | ~~ | ~~ |
1 | 888 | 888 | 888 |
2 | ~~ | ~~ | ~~ |
3 | 3BAR | 3BAR | BAR |
4 | ~~ | ~~ | ~~ |
5 | 2BAR | 88 | 2BAR |
6 | ~~ | ~~ | ~~ |
7 | 8 | 2BAR | 8 |
8 | ~~ | ~~ | ~~ |
9 | BAR | 8 | 3BAR |
10 | ~~ | ~~ | ~~ |
11 | 2BAR | BAR | BONUS |
12 | ~~ | ~~ | ~~ |
13 | 88 | 8 | 88 |
14 | ~~ | ~~ | ~~ |
15 | 3BAR | 2BAR | 2BAR |
16 | ~~ | ~~ | ~~ |
17 | 8 | BAR | BAR |
18 | ~~ | ~~ | ~~ |
19 | 3X WILD | 88 | 8 |
20 | ~~ | ~~ | ~~ |
21 | BAR | BAR | BAR |
random selections
Modern slot machines use some form of random number generation. Slot machines use very sophisticated random number generators that are tested and verified to ensure that the results are random. The javascript Math.random() method will produce sufficient randomness for the purposes of this demo. In the long term, the game return will trend toward the calculated return to player.
you still don't believe it?
If you still have doubts after reading how slot machines work and constructing a slot machine, the following verification tool may be helpful. Simulating millions of games may take a few seconds depending on the speed of your device.
session info
longest streaks for one run of the simulation (2 credit bet only)
game simulator
game number | coin 1 rtp | coin 2 rtp |
---|
paytable
pays | return | |||||
---|---|---|---|---|---|---|
symbols | combinations | probability | credit 1 | credit 2 | credit 1 | credit 2 |
3x T8 T8 | 2 | 1/131072 | 2664 | 4164 | 0.02032 | 0.03177 |
T8 T8 T8 | 4 | 1/65536 | 888 | 1388 | 0.01355 | 0.02118 |
3x D8 D8 | 6 | 1/43690 | 864 | 864 | 0.01978 | 0.01978 |
D8 D8 D8 | 24 | 1/10922 | 288 | 288 | 0.02637 | 0.02637 |
3x S8 S8 | 16 | 1/16384 | 264 | 264 | 0.01611 | 0.01611 |
S8 S8 S8 | 80 | 1/3276 | 88 | 88 | 0.02686 | 0.02686 |
3x A8 A8 | 40 | 1/6553 | 174 | 174 | 0.02655 | 0.02655 |
A8 A8 A8 | 596 | 1/439 | 58 | 58 | 0.13187 | 0.13187 |
3x TB TB | 42 | 1/6241 | 84 | 84 | 0.01346 | 0.01346 |
TB TB TB | 252 | 1/1040 | 28 | 28 | 0.02692 | 0.02692 |
3x DB DB | 56 | 1/4681 | 54 | 54 | 0.01154 | 0.01154 |
DB DB DB | 448 | 1/585 | 18 | 18 | 0.03076 | 0.03076 |
3x SB SB | 110 | 1/2383 | 24 | 24 | 0.01007 | 0.01007 |
SB SB SB | 1100 | 1/238 | 8 | 8 | 0.03357 | 0.03357 |
3x AB AB | 392 | 1/668 | 15 | 15 | 0.02243 | 0.02243 |
AB AB AB | 12600 | 1/20 | 5 | 5 | 0.24033 | 0.24033 |
3x AS AS | 392 | 1/668 | 9 | 9 | 0.01346 | 0.01346 |
AS AS AS | 21856 | 1/11 | 3 | 3 | 0.25012 | 0.25012 |
-- -- BS | 0/4096 | 1/64 | 0 | 60.75 | 0 | 0.94922 |
0.93405 | 0.95117 |