The problem
Every slot studio writes its reels from scratch, and then writes them again. The reel set is where the game feels expensive or cheap, and it's also where the edge cases live: a stop request that arrives mid-anticipation, a cascade that has to look like gravity and not like a respin, a 3×3 symbol that has to stream past during the spin and land whole.
pixi-reels is the reel layer and nothing else. Win math, paytables, RNG and audio stay in the game (ADR 007). You build a reel set, call spin(), hand it the server's grid, and await the landing.
import { ReelSetBuilder, SpriteSymbol, SpeedPresets } from 'pixi-reels';
const reelSet = new ReelSetBuilder()
.reels(5).visibleCells(3).symbolSize(140, 140)
.symbols((r) => {
r.register('cherry', SpriteSymbol, { textures: { cherry: cherryTex } });
r.register('seven', SpriteSymbol, { textures: { seven: sevenTex } });
})
.weights({ cherry: 40, seven: 10 })
.speed('turbo', SpeedPresets.TURBO)
.ticker(app.ticker)
.build();
const spin = reelSet.spin();
reelSet.setResult((await fetchSpinFromServer()).map((visible) => ({ visible })));
await spin;
What's in it
- Spin lifecycle as phases. Start, Spin, Anticipation, Stop and Adjust, plus Fall / DropIn / Place for cascades. Each phase can be overridden, and skip, slam and hurry behave consistently across all of them.
- Mechanics: cascades and tumbles, MultiWays (per-reel row counts), big M×N symbols that land or stream past, splitting symbols, sticky, expanding and multiplier wilds via cell pins, nudges, Hold & Win boards, infinity reels that grow at runtime.
- Geometry: vertical, horizontal and reversed layouts on one engine, curved reels, pyramid and custom masks.
- Symbols: Sprite, AnimatedSprite, Spine, Card and Empty, all pooled.
- Typed events (
spin:reelLanded, …) and a debug overlay drawn with pixi-silk.
Headless first
The engine runs in Node without a renderer. pixi-reels/testing ships createTestReelSet, spinAndLand, expectGrid, captureEvents and a FakeTicker, so a game team can test its own spin flows without a browser.
The motion contract
From 2.0 on, reel motion is defined by fourteen rules, checked as property tests in all four orientation and direction combinations and against golden frame-by-frame traces. I validated the suite by breaking the engine on purpose and checking which rules caught which mutation. One lesson from that: a test that only compares two layouts misses a bug that breaks both of them the same way, so every rule needs at least one absolute check. The contract also found a real defect in the version that was already shipping. (ADR 018)
Cascades that look like cascades
The obvious approach, tweening every cell to its new position, makes a tumble read as a respin. pixi-reels computes how far each surviving symbol actually falls, never touches cells that fall zero, and takes the list of winning cells as input instead of diffing two grids. (ADR 010)
How it's run
- Architecture decisions are recorded next to the code, so "why doesn't the engine do X" has a written answer.
- CI fails if the bundle grows past a committed baseline.
- The docs site is built from runnable recipes, with markdown copies of every page and
llms.txt, so it works for people and for coding agents.
Timeline
| Date | Release |
|---|---|
| 2026-04-20 | 0.1.0 on npm |
| 2026-05-30 | 1.0: legacy removed, internals hidden, docs rewritten |
| 2026-06-21 | Hold & Win builder |
| 2026-08-04 | 2.0: orientation and direction axis, motion contract |
| 2026-09-18 | 3.0: skip modes, phase steps |
| 2026-10-04 | 4.0: infinity reels, win lines, Spine one-shots |
| 2026-10-25 | 4.2: tall symbols streaming during the spin |
| 2026-11-19 | 4.4.1 |