Skip to content
← Selected Work

03Case Study

Come Up Hoops

A text-based basketball career RPG — high school to retirement — with scenes written by your own LLM and every number owned by a deterministic engine.

Year
2026
Stack
React · TypeScript · Vite · Zustand · Zod · IndexedDB · Tailwind · Electron · llama.cpp · LLM APIs
Screenshot of the Come Up Hoops game

The problem

LLM-driven games drift — the model invents stats, forgets relationships, and quietly rewrites the rules. A career RPG only works if the numbers are trustworthy and the story still feels alive.

The approach

The engine owns the facts; the model only narrates and proposes. A seeded, possession-by-possession game sim produces box scores and pauses at key moments where the displayed odds are the real odds. The narrator returns Zod-validated JSON scenes with choices and proposed effects, which are clamped to per-scene caps before being applied — invalid output gets one repair attempt, then falls back to templates. Recaps are fact-checked against the real box score. A narrator memory keeps relationships and past decisions consistent, and choices carry lasting consequences — coach trust, badges, media and endorsements, game prep. Bring your own provider (Anthropic, local models, or an offline demo), with saves in IndexedDB — no backend. There's also a Windows desktop app that bundles its own local model (Gemma via llama.cpp) so it runs with no key, no account, and nothing leaving the machine.

The outcome

A fully playable four-stage career — high school, college, the draft, pro, retirement — where the story is generated but the stats can't lie, and saves replay identically from the stored RNG state. Live on the web and available as an offline desktop app.

Features

  • Engine owns the facts

    The model proposes effects like “+5 respect with Coach”; a validator clamps each to per-scene caps and drops anything invalid. Recaps are fact-checked against the real box score.

  • Key-moment game sim

    Seeded, possession-by-possession games with full box scores and play-by-play. Three key moments plus clutch time pause for your call — and the displayed odds are the real odds.

  • Full career arc

    High school, recruiting, college, the draft, pro contracts and free agency, retirement. Rivals and friends follow you up through the levels if they're good enough.

  • A life, not just games

    A weekly loop of training, a scene, a game, then advance — interrupted by about 50 unannounced life events you have to answer. A money tab handles pay, taxes, living costs, and services like a trainer, nutritionist or PR team; romance, family, team chemistry and captaincy follow you through the years.

  • A living league

    A weekly newspaper, league leaders, an MVP race, a transaction log, and a player card for anyone in the league. Transfer portal and recruiting board in school, trade requests and a ranked draft board later — plus rivalry series against the rival who follows you up.

  • Legacy and heirs

    Long-term goals, family background and temperament choices up front, and a Hall of Fame legacy score at the end — with an heir system to carry the name into the next career. Saves export and import as files.

  • Narrator memory

    Characters remember what you did, so relationships, rivalries and storylines stay consistent across seasons instead of resetting every scene.

  • Any model, or none

    Anthropic, Gemini, OpenAI-compatible providers (OpenAI, OpenRouter, Groq, Ollama, LM Studio…), or an offline demo with built-in templates. Retries with backoff, one repair attempt on bad JSON, then a template fallback.

  • Drawn entirely in code

    Portraits generated from a name with mood-driven expressions, illustrated scene banners in your team colors, shot arcs, a momentum bar, and reveal cards for draft night and championships — all inline SVG, no image files, with reduced-motion support.

  • Desktop app, local model

    An Electron build bundles Gemma via llama.cpp: no key, no account, nothing leaves the machine. It resumes and checksum-verifies the model download and picks a model size to fit your RAM. Disabling “thinking” cut scene generation from 6.2s to 1.9s.

  • Locked-down by design

    A strict Content-Security-Policy protects API keys stored in the browser; the desktop engine listens only on loopback and answers only the game's own page. No backend, no tracking of game data.