How it plays
- Cluster pays: 5 or more matching symbols touching horizontally or vertically win anywhere on the 6×5 grid. There are no paylines.
- Tumbles: winning symbols pop, everything above falls down, new symbols drop in, and the grid is evaluated again until no clusters remain.
- Scatters: 4 or more clovers trigger free spins. Clovers never pop, so they keep counting through the whole tumble chain.
- Persistent multiplier: during free spins, every winning tumble raises the multiplier by one, and it never resets until the bonus ends.
- Bonus buy: pay 100× the bet for a spin that is guaranteed to trigger the bonus, priced so it pays back the same as normal play.
Pricing the bonus buy
The hardest problem in the project was a single number. A fair bonus buy price is the bonus's average value divided by the base game's RTP, so it has to be derived by simulation, never guessed. Every change to the game moved it:
- 100×The first guess. Simulation showed the bonus was only worth about 26× the bet, which made the button a 26% RTP purchase.
- 27–28×Derived instead of guessed, then re-derived when the symbol set shrank from 10 to 8.
- 42×Scatters started counting across the whole tumble chain, so free spins retriggered far more often.
- 107×The multiplier became persistent and the buy got a guaranteed trigger spin. The bonus went from ~40× to ~100× in value.
- 100×A new, continuous lever that scales free-spin wins (to 91.3%) let the price land on an exact round number: 94.28% RTP for the buy against 94.27% for normal play.
How it's built
The project is layered so the game type can change without touching the random number generator or the RTP tools. That paid off when the game went from paylines to clusters: the simulator kept working unchanged.
Renders and animates. Sends a bet, plays back the result.
Owns the balance and validates every bet against a whitelist.
Reel strips, clusters, tumbles, free spins and a cryptographic RNG.
Plays millions of seeded rounds to measure RTP, volatility and prices.
The client is a video player: it sends a bet and receives the entire round, every tumble, cluster and grid, already decided. That is non-negotiable in real-money games, because anything running in the browser can be modified.
About this web version: GitHub Pages can't run a server, so the build on this page runs a Haxe port of the C# math directly in the browser. That's only acceptable because it's play money. The port was verified against 3,300 rounds recorded from the C# engine together with every random number they used: replayed through the port, every grid, cluster and payout matched exactly.
What I learned
- Find the number that really drives RTP. Almost every win is a minimum-size cluster, so the two lowest paytable columns controlled nearly all of the RTP. Tuning the big wins barely mattered.
- Move one lever at a time. Changing two things at once tells you nothing about which one did what.
- Hit rate and RTP are separate levers. The structure of the reel strips decides how often the game pays; the paytable decides how much.
- A price is a ratio. Scaling the whole paytable can't change a bonus buy's fair price. Only levers that move the bonus relative to the base game can.
- Fair randomness has details. A cryptographic RNG for play, a seeded one for reproducible simulations, and rejection sampling so no reel position is ever favoured.
- Presentation is its own craft. Gravity animations, scatter teasers, skipping and a win display that never covers what the player is watching all change how fair and exciting the same math feels.
A note on AI
For efficiency, I used AI to speed up the development process. Every technical part, from the reel math and RTP tuning to the server and the client, was still built with a full understanding of how and why it works. To me, AI is a tool that makes me faster, not a replacement for knowing how to build things.
A prototype, not a product
Gambling Guns is a learning project. It has no real money, player accounts, database, spin history, responsible-gambling tools or certification, all of which a real game would legally need. Nothing on this page can be bought or won.