Wild Fool — a wildly modified Durak with an AI Rules Coach
Inspiration
Wild Fool started as a house-rules version of the Russian card game Durak that my friends and I actually play: 4 decks shuffled together (216 cards), 8 jokers that become any card you declare, and a trump suit that changes mid-game through blind cards hidden in the deck. It's chaotic, mean, and fun — but every new player needs twenty minutes of explanations before their first move. Two inspirations collided: Balatro (proof that a card game on a flat table can feel expensive through pure polish) and the wish that the game could just teach itself. Build Week made the second one real.
What it does
Wild Fool is a multiplayer browser card game — create a room, share a 5-letter code, play with friends or bots. During Build Week it gained an AI Rules Coach powered by GPT-5.6:
- Hint on your turn — what's legal right now, and what's actually smart.
- "Why not?" — try an illegal move and the coach explains the rule you hit, in one breath.
- Post-game roast — a short, cheeky review of how you played.
The design principle we never broke: the deterministic rules engine is the only source of truth. GPT never decides legality. The server sends it the table state, your hand, the engine's legal-move list and refusal reasons — GPT only explains, via the Responses API with strict structured outputs, on a Cloudflare Worker. If the API is down, the coach quietly hides and the game plays on.
How we built it
The workflow itself was the experiment: Codex acted as the engineering agent, and every feature went through staged prompts with explicit review gates — owner-approved specs, pixel-level visual contracts, stop-on-review checkpoints. During Build Week this pipeline shipped three things on top of the existing engine and multiplayer base:
- 55 individually baked card sprites (52 cards + joker + 2 backs, one shared palette) replacing the old family-sprite renderer — integrated as a five-stage gated migration: asset gate → renderer → e2e semantics → recaptured visual baselines → merge, with rollback boundaries at every stage.
- Procedural table felt — a deterministic, seeded canvas surface with vignette; the idle slot grid is gone, and pixel perimeter gates in CI now guard every edge of the felt.
- The AI Rules Coach, end to end in a dedicated Codex session: engine refusal reasons, redacted server context, rate-limited Worker endpoint, three UI entry points styled as a pixel speech bubble, mocked e2e plus a live production smoke test.
Stack: TypeScript monorepo — pure rules engine (zero network/UI deps, fuzz-tested over thousands of simulated games), Cloudflare Durable Objects for authoritative rooms with hidden hands, React client, Playwright visual/e2e pipeline. 190 tests, all green.
Challenges we ran into
- AI image generation fails quietly. Our first card-generation pilots cropped card bodies by 2.5–4% — invisible per card, fatal per deck. We built deterministic QA gates (palette hash, pip counting, similarity ≥ 0.80, binary alpha) and rejected entire batches until sources passed.
- Tiled textures lie at scale. Every attempt to tile a felt texture — 128px, macro-1024, stitched panels — eventually showed repeating squares on a full table. The fix was a mindset change: backgrounds don't need to be drawn at all. A seeded procedural canvas killed the problem permanently.
- Visual tests that pass are not visual tests. A global 1.5% diff threshold let a complete card-art replacement pass on large viewports — the unchanged background diluted the diff. We recalibrated thresholds against measured noise and added locator crops so the card area itself is the denominator.
- Human review is the bottleneck. Hour-long fix loops collapsed to ~20 minutes once we switched to "iterate autonomously against a pixel gate, stop only at the final result" — automated gates for correctness, human review for taste.
What we learned
Agent-driven development works when the agent iterates against machine-checkable contracts and humans keep the taste decisions. And an LLM belongs in a game as an explainer on top of a deterministic engine — never as a referee.
What's next
Active slot highlighting driven by legal moves (in review), a full UX normalization pass (poker-room table composition, size tokens), PixiJS juice — particles, shader CRT — and the provocative table-grab animations this game's tone deserves.
Built With
- canvas
- cloudflare-pages
- cloudflare-workers
- codex
- durable-objects
- eslint
- gpt-5.6
- node.js
- openai
- pixel-art
- pixellab
- playwright
- pnpm
- react
- responses-api
- typescript
- vite
- vitest
- websockets
Log in or sign up for Devpost to join the conversation.