All work

pixi-reels

The reel engine for PixiJS v8

Everything between “spin” and “the reels have stopped”: speed profiles, anticipation, cascades, Hold & Win, MultiWays, big symbols, infinity reels. Math stays in your game. Spins run headless in Node.

Docs & 200+ live recipes Source npm
  • Mechanics become configuration

    Cascades, Hold & Win, MultiWays, big symbols and growing reel sets are builder options. A studio adds a mechanic to a game without forking its reel code.

  • Reel feel is specified, not eyeballed

    Motion is defined by fourteen laws checked in every orientation. A stop that jumps a pixel fails CI instead of reaching players.

  • Game teams test spins without a browser

    The engine ships its own headless harness, so a game's spin flows run as fast unit tests in Node.

pixi-reels 4.4 spinning five reels of primitive symbols. The result is set while the reels are already turning, and the win row is shown with the built-in spotlight.

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

DateRelease
2026-04-200.1.0 on npm
2026-05-301.0: legacy removed, internals hidden, docs rewritten
2026-06-21Hold & Win builder
2026-08-042.0: orientation and direction axis, motion contract
2026-09-183.0: skip modes, phase steps
2026-10-044.0: infinity reels, win lines, Spine one-shots
2026-10-254.2: tall symbols streaming during the spin
2026-11-194.4.1