Roulette Royale is a 3D European roulette table on a dim casino floor. A lacquered mahogany wheel with a brass turret, chrome frets and diamonds, and an ivory ball sits beside a green baize layout under the table lamps. A lit tote board shows the recent numbers, and rows of slot machines, chandeliers, and marquee lights fill the room around it.
The ball is simulated, not animated: it rides the rim, spirals down the bowl, glances off the diamonds, and rattles between the frets until it settles. A test suite spins it hundreds of times to check that every pocket comes up evenly. You place chips from 1 to 500 credits on every European bet, from straight up to red or black, with undo, rebet, and double. Winners are paid beside their stacks and a dolly marks the winning number. You can follow the spin from the seat, the wheel, or overhead, and there are touch controls for phones in either orientation. It plays for credits only, with no real money involved.
How it works
The game logic is kept apart from rendering and input. Everything under src/game/ (wheel geometry, physics, bets, layout, session rules) is framework-free, with no DOM, no Three.js, and no Math.random or Date, so the tests run directly in Node. The Three.js engine, the wheel, table, tote board, casino room, spectators, and confetti live in src/render/, and React handles the menu, HUD, chip rack, and result banner.
The ball is simulated in the plane of the wheel, in inches and seconds, a thousand steps a second. Each band of the wheel has its real slope: the ball track leans slightly inward, the stator cone more steeply, and the number ring down into the pockets. A fast ball presses against the rim and rides it. As friction slows it, the slope wins and it spirals down onto the stator, where eight diamonds can knock it sideways. On the rotor, which turns the other way, it rolls over the number ring, drops into the pocket ring, and bounces off the frets. A hard hit hops it into another pocket, a soft one does not, and the ball settles once it has rested in one pocket for a moment.
Each spin starts from a random 32-bit seed that sets the release point, the ball's speed, and the rotor's speed. After that nothing is random, so the same seed always plays the same spin. The tests simulate hundreds of spins and fail if a ball escapes the wheel or never settles, if it rides the track too briefly or too long, or if the winning numbers are not spread evenly across all 37 pockets.
The scenery is generated too. Every texture is drawn in code at start-up (the felt layout, number ring, chips, tote board, carpet, slot machine reels, wood grain, and brushed metal), and every sound is synthesised with Web Audio, including a lounge trio and vibraphone in the background and the crowd's cheers and groans. Reflections in the chrome, brass, and lacquer are captured from the casino room itself. The engine steps its rendering quality down by itself when frames stay slow, and ?quality=high or ?quality=low pins it.
Controls
- Pick a chip (1, 5, 25, 100, or 500) and click or tap the felt to bet. A tap in the middle of a number bets it straight up, and a tap on a line between numbers bets the split, corner, street, or six line.
- Right-click a stack, or press and hold it on a touch screen, to take it back.
UNDO,CLEAR,REBET, and×2are buttons on the table. SpaceorEnterspins;1to5select a chip;ZorBackspaceundoes;XorDeleteclears the table.Rrebets,Ddoubles,Cchanges the camera,Qis a quick spin,Mmutes, andEscapeopens the menu.
Built with
React 19, TypeScript, and Three.js, built with Vite. Sound is synthesised with Web Audio, tests use Node's built-in test runner, and credits, history, and settings are kept in localStorage with no backend.