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:

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:

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 table
factor
winning combinationvr1vr2vr3
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.

winvr1vr2vr3combinationsminusactual
3x T8 T8112202
T8 T8 T8212404
3x D8 D8132606
D8 D8 D843224024
3x S8 S814416016
S8 S8 S854480080
3x A8 A8188
A8 A8 A81188
combinations(a) = n(a on reel 1) * n(a on reel 2) * n(a on reel 3)
actual(a) = combinations(a) — duplicates(a)

For mixed 8 with 3x multiplier (3x-A8-A8):

combinations(3x-A8-A8) = 1 * (1+3+4) * (2+2+4)
combinations(3x-A8-A8) = 64
actual(3x-A8-A8) = combinations(3x-A8-A8) - duplicates(3x-A8-A8)
actual(3x-A8-A8) = 64 - (actual(3x-T8-T8) + actual (3x-D8-D8) + actual (3x-S8-S8) )
actual(3x-A8-A8) = 64 - (2 + 6 + 16)
actual(3x-A8-A8) = 40
winvr1vr2vr3combinationsminusactual
3x A8 A8188402440
A8 A8 A81188596108596

Including pay amounts will allow returns to be calculated.

win1 credit2 credit
3x T8 T826644164
T8 T8 T88881388
3x D8 D8864864
D8 D8 D8288288
3x S8 S8264264
S8 S8 S88888
return(a) = probability(a) * pay(a)
return(3x-T8-T8 1cr) = 2/(64*64*64) * 2664
return(3x-T8-T8 1cr) = 0.020324707
return(3x-T8-T8 2cr) = 2/(64*64*64) * 4164
return(3x-T8-T8 2cr) = 0.031768799
paysreturn
winprobability1 credit2 credit1 credit2 credit
3x T8 T81/2266441640.020324707031250.031768799
T8 T8 T81/488813880.01354980468750.021179199
3x D8 D81/68648640.0197753906250.019775390625
D8 D8 D81/242882880.02636718750.0263671875
3x S8 S81/162642640.016113281250.01611328125
S8 S8 S81/8088880.026855468750.02685546875
3x A8 A81/401741740.026550292968750.02655029296875
A8 A8 A81/59658580.1318664550781250.131866455078125
3x TB TB1/4284840.0134582519531250.013458251953125
TB TB TB1/25228280.026916503906250.02691650390625
3x DB DB1/5654540.011535644531250.01153564453125
DB DB DB1/44818180.030761718750.03076171875
3x SB SB1/11024240.010070800781250.01007080078125
SB SB SB1/1100880.03356933593750.0335693359375
3x AB AB1/39215150.0224304199218750.022430419921875
AB AB AB1/12600550.2403259277343750.240325927734375
3x AS AS1/392990.0134582519531250.013458251953125
AS AS AS1/21856330.25012207031250.2501220703125
--- --- [?]1/4096060.7500.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
valueminimummaximumfactorcoin out
803132256
16324312192
244447496
3248514128
4052554160
4856594192
6460634256
medium value element
valueminimummaximumfactorcoin out
1802930540
28304011308
3841488304
5849546348
6855595340
7860634312
large value envelope
minimummaximumvaluenumbercoin out
88055564928
18856594752
38860612776
888626321776

The average value of all possible bonus combinations is 60.75 credits. The probability of getting a bonus is 1/64.

return(bonus) = 1/64 * 60.75 = 60.75/64
return(bonus) = 0.94921875

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.

vr1vr2vr3
0~~~~~~
1~~~~~~
2~~~~~~
3T8~~~~
4T8T8T8
5~~~~T8
6~~~~~~
7~~~~~~
8TB~~~~
9TBTB~~
10TBTBSB
11TBTBSB
12TBTB~~
13TBTB~~
14~~TBTB
15~~TBTB
16SB~~TB
17SB~~TB
18~~SBTB
19~~SBTB
20S8SB~~
21S8~~~~
vr1vr2vr3
22S8~~S8
23S8DBS8
24S8DBS8
25~~DBS8
26~~~~~~
27SB~~~~
28SB~~DB
29~~SBDB
30~~SBDB
31DBSBDB
32DB~~~~
33DB~~~~
34DB~~~~
35~~~~~~
36~~D8BS
37D8D8~~
38D8D8~~
39D8~~~~
40D8~~~~
41~~~~SB
42~~~~SB
43DBSB~~
vr1vr2vr3
44DBSB~~
45DB~~~~
46DB~~D8
47~~DBD8
48~~DB~~
49SB~~~~
50SB~~SB
51~~S8SB
52~~S8SB
53~~S8~~
54~~S8~~
553x~~DB
56~~~~DB
57~~DBDB
58~~DB~~
59~~DB~~
60SB~~SB
61SB~~SB
62SBSBSB
63SBSBSB

The stepper reels would be:

r1r2r3
0~~~~~~
1888888888
2~~~~~~
33BAR3BARBAR
4~~~~~~
52BAR882BAR
6~~~~~~
782BAR8
8~~~~~~
9BAR83BAR
10~~~~~~
112BARBARBONUS
12~~~~~~
1388888
14~~~~~~
153BAR2BAR2BAR
16~~~~~~
178BARBAR
18~~~~~~
193X WILD888
20~~~~~~
21BARBARBAR

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

paysreturn
symbolscombinationsprobabilitycredit 1credit 2credit 1credit 2
3x T8 T821/131072266441640.020320.03177
T8 T8 T841/6553688813880.013550.02118
3x D8 D861/436908648640.019780.01978
D8 D8 D8241/109222882880.026370.02637
3x S8 S8161/163842642640.016110.01611
S8 S8 S8801/327688880.026860.02686
3x A8 A8401/65531741740.026550.02655
A8 A8 A85961/43958580.131870.13187
3x TB TB421/624184840.013460.01346
TB TB TB2521/104028280.026920.02692
3x DB DB561/468154540.011540.01154
DB DB DB4481/58518180.030760.03076
3x SB SB1101/238324240.010070.01007
SB SB SB11001/238880.033570.03357
3x AB AB3921/66815150.022430.02243
AB AB AB126001/20550.240330.24033
3x AS AS3921/668990.013460.01346
AS AS AS218561/11330.250120.25012
-- -- BS0/40961/64060.7500.94922
0.934050.95117