Card games and deck builders (Slay the Spire-likes, solitaire, trading card games, roguelike deck builders, card battlers). Cards as data with effect lists, deck / hand / discard / exhaust piles, seeded shuffling, energy and costs, a resolution stack with targeting, status effects, enemy intents, rewards and deck growth between fights, card UI with drag and tap, animations, and keeping rules pu...
Download skill (.zip) Files on GitHubCard game development
Core: draw, decide, play. The fun is in combinations and choices.
Starter template
A playable starter for the game-scaffolding template is in assets/starter/. A deck builder: draw, discard and exhaust piles, a seeded shuffle, energy, cards as data run through one effect interpreter, block, strength and weak, enemy intents, three fights and a pick-1-of-3 reward.
python3 <game-scaffolding>/scripts/scaffold.py my-game --title "My Game" --starter <this skill>/assets/starter
Controls: Tap a card to play it, then End turn. Keys: 1-7 play, E ends the turn. Esc pauses. All numbers to tune are in src/config.js; the gameplay is in src/scenes/play.js.
A bot played through all three fights.
Architecture
- Cards are data:
{ id, name, cost, type, target: "enemy"|"self"|"all", effects: [{ do: "damage", n: 6 }, { do: "draw", n: 1 }] }. One effect interpreter handles every card. New cards = new data, rarely new code. - Pure rules:
play(state, cardId, target) → { state, events }; the UI animatesevents. Test rules in node. - Piles:
draw,hand,discard,exhaust. Shuffle discard into draw when empty, with a seeded shuffle (procedural-generationrng().shuffle) for replays and daily runs.
const EFFECTS = {
damage: (s, e, t) => dealDamage(s.player, t, { amount: e.n + s.player.strength }), // combat-system
block: (s, e) => (s.player.block += e.n),
draw: (s, e) => drawCards(s, e.n),
apply: (s, e, t) => t.effects.add(STATUS[e.status](e.n)),
};
Growing the starter (roguelike deck builder)
- One fight: player energy 3, hand of 5, 10-card starter deck (Strike ×5, Defend ×4, one special), one enemy with intents (shows what it will do next turn).
- Turn: draw 5 → play cards → end turn → enemy acts → discard hand.
- Rewards: pick 1 of 3 cards (loot-system weighted by rarity), gold, sometimes a relic (passive effect).
- Map of fights (procedural-generation) → boss.
Balance
Simulate fights with simple strategies (game-balance-testing): win rate per card in the deck, dominant cards, average turns per fight. Starter deck should beat the first enemy ~90%.
UI
Hand fanned at the bottom; hover/tap to enlarge; drag to a target or tap card then tap target (touch); unplayable cards dimmed with the reason; tooltips for keywords; pile counts clickable. Animations quick (150–300 ms), skippable.
Pitfalls
Effects hard-coded per card (unmaintainable), resolution order bugs (use one ordered queue), unclear keywords, slow animations, and no way to see the deck.