Case study / 04
Retro Quest
C++17 / Exact RTP / Monte Carlo
A playable slot prototype backed by an independent C++17 probability engine and two complementary verification methods.
← All projects
Challenge
Create transparent game mathematics and verify that the designed behaviour matches the implemented outcome space.
Contribution
Extended an initial candidate exercise into a self-contained public project with a C++ math engine, exact enumeration, Monte Carlo verification and a zero-dependency playable web demo.
The probability budget
RTP is
a budget.
RTP = Σ (probability × payout)
Probabilities are fixed by the reel strips; payouts are what you allocate. The figures below come from the model’s own tuner data.
- Crown18.03%40× · 48 combos
- Potion19.53%10× · 208 combos
- Bag18.03%3× · 640 combos
- Chest7.89%15× · 56 combos
- Bonus≈ 26.4%Treasure Wheels via the quest meter
Total ≈ 89.9% against a 90% target
The reel strips
Three reels,
22 stops each.
Every outcome the game can produce comes from these 66 positions. Crown is weighted 2 / 2 / 1, so the near-miss happens about four times more often than a top win — using only real symbol positions.
- Crown
- Chest
- Potion
- Bag
- Wild
- Star
- Blank
22³ = 10,648 payline outcomes, enumerated exactly in slot_math.cpp.
Try it yourself
Lock the total,
move a payout.
The interactive RTP tuner runs on the game’s real combination counts. Lock the total RTP, drag any payout, and watch the remaining budget rebalance.
Open the RTP tuner ↗
Delivery process
How the work
came together.
From the first model of the problem to checking how the system behaves.
Define the model
Specified symbol weights, fixed reels, payout rules and the collection reward before verifying the implementation.
Enumerate exactly
Evaluated every 22³ reel-stop combination—10,648 outcomes—to calculate the theoretical result.
Simulate independently
Ran a separate 1,000,000-spin Monte Carlo path to detect implementation or modelling disagreements.
Expose the reasoning
Published the C++ engine, reward explanation and playable interface so reviewers can inspect more than a screenshot.
Engineering evidence
The details
that matter.
- 10,648 outcomes exhaustively enumerated
- 1,000,000-spin Monte Carlo simulation
- 89.9% verified RTP against a 90% target
- Independent RNG and fixed reel-strip design
- Base and collection-reward contributions separated
- Playable zero-dependency browser demonstration
Inside the decisions / Expand to read
01Calculate the finite space exactly
Three reels with 22 stops each produce 22³ = 10,648 payline outcomes. Enumerating every combination gives the exact base-game expectation; the collection bonus is calculated separately.
02Check the model with an independent simulation
A million-spin Monte Carlo session exercises line wins, collection progress and bonus triggers together. Comparing its observed return with the theoretical result helps reveal implementation or modelling disagreements.
03Keep presentation downstream of the result
Independent RNG chooses stops on fixed reel strips. Animation reveals that choice, and near misses use the real neighbouring symbols instead of changing the selected result.
04Make the probability budget legible
Separating the roughly 63.5% base-game return from the 26.4% bonus contribution makes the overall 89.9% return easier to reason about and tune. The repository includes the C++ engine and an interactive RTP tuner.
Outcome
The two verification paths converge on approximately 89.9% RTP, providing a compact, inspectable demonstration of C++, probability and responsible game-math reasoning.
The core began as an AGS candidate exercise. The C++ engine, dual verification, documentation and public edition were independently extended after the assessment.
- C++17
- Probability
- Statistics
- Monte Carlo
- JavaScript
- HTML
Next case study
05Commercial Game Engineering→