Phaser AE

Card decks

Free packv3.0.0-22DGrid

The deck every card game starts from: suits, ranks and names, decks of any number and any subset shuffled from a seed, piles, and the stacking rules card games share. Your rules build on it; the other card packs make it look like a real table.

This is a Free pack. Every phaser.io account can use it in their games.

Released October 14, 2026 · updated October 19, 2026

Card decks: a screenshot of its demo
A note about these graphics

Expansion packs don't come with graphics. This screenshot is one way of drawing what the pack does, made for its demo: none of the sprites, tiles or backgrounds in it are in the pack.

That's by design. A pack is a game's logic, mechanics and effects, and it works with whatever art you give it. Some packs draw effects, backdrops or 3D scenes of their own, but none carries a game's sprites.

So the look is yours. Make the art on phaser.io, bring your own, or let your agent draw it in code: the same pack can look like anything.

What it does

A card is plain data: a uid, a suit, a rank and whether it is face up. buildDeck makes one or more ordered decks, each card with a uid that stays unique across all of them, so you can key sprites by it even with two decks on the table. shuffledDeck shuffles through the engine's seeded random stream, so a seed reproduces a deal exactly, for daily deals, replays and tests.

The helpers answer the questions every card game asks: a card's name ("Ace of Spades"), its short id, its colour, its label and whether it is a court card. A pile is an id, a kind and its cards, and four stacking tests say whether one card may go on another under the usual rules, so a patience game's moves are a line each.

Features

  • Decks of any shape — any number of decks, and any subset of suits and ranks, such as a piquet deck, euchre or two suits.
  • Seeded shuffles — shuffledDeck(seed) deals the same order every time; shuffle takes any of the engine's random streams.
  • Unique card ids — every card's uid stays unique across mixed decks.
  • Names and labels — cardName, cardId, suitColor, rankLabel, isCourt and each suit's glyph.
  • Piles — makePile and top, with the kinds stock, waste, foundation, tableau and cell.
  • Stacking rules — stackAlternating, stackSameSuit, stackDescending and stackFoundation.

Good for

  • Patience games such as Klondike or FreeCell, with the solitaire pack on top.
  • Dealer games like blackjack, which needs only this pack for its shoe.
  • Card games of your own, whose rules use the deck, the piles and the stacking tests.
  • Games with a short deck, such as piquet or euchre, built from a subset of ranks.

Make it yours

The pack has no options; the choices are in the calls. A blackjack shoe is six full decks shuffled together from a seed; a piquet hand is one deck of ranks 1 and 7 to 13; a two-suit game is { suits: ['spades', 'hearts'] }. Pile kinds use patience names, but a pile is only an id, a kind and its cards, so any game can use them for hands, discard piles or the table.

A quick look

A seeded piquet deck, a hand dealt from it, and a stacking test:

const piquet = game.cards.shuffledDeck(seed, 1, { ranks: [1, 7, 8, 9, 10, 11, 12, 13] });
const hand = piquet.splice(0, 12);
if (game.cards.stackAlternating(card, game.cards.top(column)!)) column.cards.push(card);

Works with

  • solitaire — Klondike, FreeCell, Spider and variants, with undo, hints and a solver.
  • blackjack — a dealer table built on this deck.
  • card-art — card faces and backs painted with no image files.
  • card-motion — cards that glide, flip and deal in styles.

Good to know

  • The French deck only: four suits and thirteen ranks, with no jokers.
  • It holds no game rules beyond the stacking tests; dealing, turns and scoring belong to your game or a rules pack.
  • It draws nothing: pair it with card-art for faces and card-motion for movement.

More Grid packs

Show all →