Ivan Habor

How I Built a Game That Writes Itself — My Mistral Hackathon Story

8 min read

A Famble boss fight built from the hackathon landing page: a hooded coder faces The Master Hacker under a “Hackathon Showdown” banner, holding cards like Code Injection.

A generated boss fight from the run generated based on the hackathon main page.

When Mistral announced their worldwide hackathon, I signed up the same day. I wasn’t interested in building yet another AI wrapper — a chatbot, a summarizer, a “smarter search.” I wanted to build something that would be genuinely impossible without AI. Not “faster with AI.” Not “cheaper with AI.” Impossible without it. Something that gives users an experience they’ve never had before.

I didn’t expect that the development itself would give me an experience I’d never had before — full of challenges and decisions that simply don’t exist in traditional software development.

The result is Famble — a roguelike card game that generates itself from anything you give it. A Wikipedia page. A PDF from your university course. A news article. Drop it in, and you get a fully playable game — with custom cards, enemies, music, and art. All created by AI in real time.

Here’s why I think this project is special, and what I learned building it in two days.

The Idea: What If a Game Could Read?

I chose a roguelike deckbuilder as the genre because it’s a perfect fit for AI generation. The format is modular: individual cards, enemies, and encounters, each with clear parameters. Every run is already meant to be different. But even in the best roguelikes, the content is hand-crafted. Somebody designed every card, every enemy, every encounter.

What if the game could design itself?

Not randomly — but meaningfully. You give it a topic, and it builds a world around it. Feed it an article about space exploration, and you fight cosmic enemies with rocket-themed cards. Feed it a cooking blog, and your deck is full of knife strikes and boiling attacks.

This isn’t just “AI helped me code faster.” It’s an idea that could not exist without AI. The core mechanic — transforming any text into playable game content — is only possible because large language models can understand context, extract themes, and generate structured data from unstructured input.

For example, a page about Paris gave me a deck with “Warm Croissant” as a healing card, enemies like the Silent Mime, and a final boss fight against Sun King Louis XIV.

A run generated from a page about Paris: a musketeer faces Sun King Louis XIV outside a walled town, holding Liberté and Defend cards.

A hackathon guide turned the whole thing meta — I was fighting Bug Swarms and Rival Teams, with cards like “VC Pitch” and “Final Commit,” and the boss was “Iterate,” a sentient AI judge.

A run set in “Arena Royale 3000”: a cyberpunk hacker faces a Sponsor Bot in a neon expo hall, holding Debug Rush and Strike cards.

The hackathon run’s boss: Iterate, an enraged AI judge, hovering over a skyline of C++ towers.

How It Works: Three AIs Walk Into a Hackathon

Famble uses three AI services, each doing what it does best:

Mistral is the brain. First, Mistral’s OCR model processes the raw input — URLs, PDFs, scanned documents — and converts it into clean text fast. This step alone makes a huge difference: the cleaner the extracted content, the better everything downstream works. Then Mistral’s language model takes that text, extracts the key topics, characters, conflicts, and mood. From there it generates all the game data as structured JSON — cards with damage values and energy costs, enemies with attack patterns, a boss with two combat phases, and a synergy system that rewards playing cards of the same theme. I have to say — I was pleasantly surprised by the quality of Mistral’s models and the whole ecosystem they’re building around them.

Google Gemini is the artist. It generates character portraits, enemy sprites, battle backgrounds, and even background music. Every visual and every track is unique to your run.

ElevenLabs is the voice. The boss speaks to you before the fight — with a generated voice that fits the character. Sound effects for card plays are also generated to match each card’s theme.

The Famble pipeline: your content passes through Mistral OCR and Mistral Large 3 into game JSON, which fans out to Gemini for images and ElevenLabs for sound and narration, then into a playable browser game.

The result feels like a real game, not a tech demo. Cards have satisfying animations. Enemies have breathing idle loops. Hits trigger particle bursts. It runs entirely in the browser — React, TypeScript, and Vite, no backend needed.

Why This Is Not “Just Another AI Project”

There are many projects that use AI to generate text, images, or code. Famble is different because AI isn’t the tool — AI is the product.

A traditional game needs artists, sound designers, writers, and game designers to create content. Famble replaces that entire pipeline with AI orchestration. The game has infinite content — every URL is a new game, every PDF is a new adventure. The replay value isn’t in randomization, it’s in the endless variety of human knowledge.

And the experience is personal. You play a game about something you care about. Your university thesis becomes a boss fight. Your favorite blog becomes a card deck.

A run generated from a sprint planning screenshot: “Debugging the Backlog”, where The Sprint Overlord is a figure built entirely out of ticket cards.

Run generated based on the sprint screenshot

Under the Hood

Structured generation with retry logic. Mistral generates game data as JSON. But LLMs sometimes produce invalid JSON or miss required fields. I built a validation layer with a JSON schema and a retry system — up to 3 attempts. The prompts also use tricks like forbidding raw double quotes to prevent JSON parsing errors.

Audio request queue. Three AI services generating assets simultaneously can hit rate limits fast. The audio service has a custom queue that limits concurrent requests to 3, prioritizing essential sounds over nice-to-have ambience.

Gemini can’t generate transparent backgrounds. I needed clean character sprites to layer over battle scenes. But Gemini doesn’t support transparency in generated images. The workaround: I ask Gemini to render characters on a bright green (#00FF00) background — basically a digital green screen — and then remove it client-side with a background removal library. It works, but it’s a hack, and it took a while to figure out.

ElevenLabs music was too aggressive. I originally used ElevenLabs for background music. The problem — the generated tracks were too intense, too intrusive. They fought with the sound effects instead of supporting the atmosphere. Switching to Gemini for music generation solved this with much more fitting, ambient results.

A single run can weigh over 300 MB. Generated images, music tracks, voice lines, sound effects — it all adds up fast. The real challenge wasn’t just generating the content, it was orchestrating everything so the player can start playing within 2-3 minutes, not 15. The solution: only generate what the player needs right now. The game generates assets for the first few rooms upfront — just enough to start playing — while kicking off parallel requests for the rest in the background. As the player fights through early encounters, the later rooms are quietly being built behind the scenes.

What I Learned

Context engineering is game design. When your game content comes from AI, the quality of the context you provide to the model directly determines the quality of the player experience. A poorly worded prompt gives you boring cards. A great prompt gives you cards that feel thematic, balanced, and fun.

Multi-model orchestration is hard. Each AI has its own quirks, rate limits, response formats, and failure modes. Making Mistral, Gemini, and ElevenLabs work together smoothly was the biggest engineering challenge.

Constraints breed creativity. 48 hours isn’t a lot. But the time pressure forced me to make sharp decisions about what matters and what doesn’t.

Try It Yourself

Famble is live with 10 pre-generated runs you can play right away. Want to generate your own? Clone the repo, add your API keys, and feed it anything — a Wikipedia article, a blog post, your company’s landing page. The source code is fully open.

The Paris run again, this time against The Silent Mime outside the town walls.

A run generated from a Mario page: Mario faces a Goomba over a green field, holding brick-block Defend cards and mushroom Strike cards.

A wizarding-school run: a student duels a Dark Wizard in a torch-lit stone corridor, holding an Expelliarmus card.

A high-fantasy run: a cloaked archer faces a Goblin Scout in a misty, rune-marked forest, holding a “Bilbo’s Courage” card.

A talking-animal run: a red panda fighter squares up to a Weasel Thug in a neon back alley past Cheese Pit and Rodent Ramen signs.

Most people think of AI in software development as a way to help developers work faster — generating boilerplate, writing tests, speeding up routine tasks. Famble is about something different. The interesting part isn’t AI as a development tool. It’s AI as a runtime engine — something that creates for the end user, not just for the developer, and does it every single time they press “play.”

A solo developer, 48 hours, three API keys — and the output is an app with generated art, music, voice acting, and game design, unique every time. A few years ago, this stack simply didn’t exist.

Watch the demo on YouTube


Built at the Mistral AI Worldwide Hackathon 2026, February 28–March 1.

GitHub