pixi-reels

Reference

Migrating to 4.0.0

4.0.0 touches debugging and one Hold & Win default. A game that never imported debugOverlay, never called __PIXI_REELS_DEBUG.showMask() or .overlay(), and has no Hold & Win board with its own speed profiles has nothing to do.

Why#

The debug overlay drew with PixiJS Graphics, which tessellates. Thin outlines crawled and rounded corners faceted whenever a reel set was fitted to a canvas at anything but 1x, which is always. It now draws with pixi-silk, which renders every shape as an exact signed distance field. A production build should not pay for that dependency, so the drawing half of debugging moved behind its own subpath, the same way Spine support lives behind pixi-reels/spine. pixi-silk is an optional peer, and only pixi-reels/debug imports it.

Install pixi-silk for the overlay#

pnpm add -D pixi-silk

It is only needed where you import pixi-reels/debug. A dev dependency is enough, since the overlay should be dev-only.

What pixi-silk needs to draw#

pixi-silk 0.1 draws through a WebGL shader, and everything in pixi-reels/debug that draws (debugOverlay, DebugPlaque, WinLines) is built on it. Two things follow:

  • A WebGL renderer. On WebGPU the plates, outlines and lines draw nothing (Pixi logs Mesh shader has no gpuProgram); only plaque text shows. Ask for WebGL while you debug: await app.init({ preference: 'webgl' }).
  • A DOM, or a stand-in for one, to build them. A SilkGraphics probes the shader’s precision through DOMAdapter.createCanvas(), so in plain Node new DebugPlaque(), new WinLines() and debugOverlay() (its describe() included) throw document is not defined. A headless test hands Pixi a canvas without WebGL, and the probe settles on mediump:
import { DOMAdapter, BrowserAdapter } from 'pixi.js';

DOMAdapter.set({
  ...BrowserAdapter,
  createCanvas: (width = 0, height = 0) =>
    ({ width, height, getContext: () => null }) as unknown as HTMLCanvasElement,
});

enableDebug(), debugSnapshot() and debugGrid() stay in the main entry and need neither.

debugOverlay and OVERLAY_LABEL moved#

// before
import { debugOverlay, OVERLAY_LABEL } from 'pixi-reels';
import type { DebugOverlayHandle, DebugOverlayLayer } from 'pixi-reels';

// after
import { debugOverlay, OVERLAY_LABEL } from 'pixi-reels/debug';
import type { DebugOverlayHandle, DebugOverlayLayer } from 'pixi-reels/debug';

The options, the layer names and describe() are the same. Each layer is now a SilkGraphics rather than a Graphics, still labelled pixi-reels:debugOverlay:<layer>; code that read a layer’s bounds keeps working. Three layers are new: hud became a plaque, and metrics and timeline were added. layers: 'all' draws more than it did, and the two new panels sit under the mask, so fit your camera after enabling them, or list the layers you want.

showMask() and overlay() left the window hook#

enableDebug() still attaches window.__PIXI_REELS_DEBUG with snapshot(), grid(), log(), trace() and the recorder, and gained metrics(). The two helpers that drew are gone, because the main entry no longer draws:

// before, in the console
__PIXI_REELS_DEBUG.showMask(true);
__PIXI_REELS_DEBUG.overlay({ layers: ['cells'] });

// after, in your debug build
import { debugOverlay } from 'pixi-reels/debug';
debugOverlay(reelSet, { layers: ['mask'] });   // what showMask drew, above the spotlight
debugOverlay(reelSet, { layers: ['cells'] });

showMask drew into the masked container, under the spotlight; the mask layer draws the same box and per-reel rects above everything.

Hold & Win: the landing wave follows stopDelay#

A board’s cells land in a diagonal wave, and its step is now the active profile’s stopDelay instead of a fixed 70 ms. A board built on the builder’s defaults is unchanged (its 'normal' profile sets stopDelay: 70). A board that registers its own profiles and never calls .stagger() now waves by their stopDelay: 140 ms a step on SpeedPresets.NORMAL, none on TURBO and SUPER_TURBO. To keep the old wave:

new HoldAndWinBuilder()
  .speeds({ normal: NORMAL, turbo: TURBO })
  .stagger((reel, cell) => (reel + cell) * 70);

Or set stopDelay on each profile, which is what the wave reads now.

New, if you want it#

  • SpinMetrics: the per-round recorder behind the metrics and timeline layers, usable on its own. See Debugging.
  • DebugPlaque: the readout plate every panel and every recipe label uses.
  • __PIXI_REELS_DEBUG.metrics(): the same rounds as plain JSON for an agent.