How I Built an AI-Generated Narrative Game Without a Team
· Product Development
I never planned to make a narrative game. I just hated writing dialogue.
But I’ve always loved making games. It started back in university. Just me, an old PC my dad brought home from work, and some weird little experiments in Flash and ActionScript. That tech is long gone, replaced by JavaScript and WebGL. But I never stopped building.
Even as a full-time engineer and later an engineering leader, I kept coming back to side projects. They’re fun, and they keep me sharp. I even wrote about that in “8 Hacks for Staying Technical as an Engineering Leader” — how staying hands-on helps you stay grounded and connected to the real work.
I’ve always gravitated toward building systems: mechanics, UI flows, pipelines. But storytelling? That was the one thing I avoided. I struggled with dialogue, second-guessed every character motivation, and my emotional scenes read like tax reports :) So I stuck to arcade prototypes and physics puzzle toys — fun stuff, but light on narrative.
Then I saw what large language models could do. Suddenly, the part I’d always struggled with wasn’t a blocker anymore. AI could generate believable dialogue, tone shifts, even multi-chapter arcs. I thought: What if I finally made a narrative game — but outsourced the part I suck at?
And I didn’t stop there.
Instead of just using AI for a few story beats, I wanted to push the idea to the limit. Could I build a game where almost every line, portrait, and decision tree was AI-generated, but still felt coherent, personal, even emotional? Could I scale narrative design the way I’d scale a backend service?
That’s how Bar 101 started. Not from a grand plan but from just one question: Can I finally make a story-driven game, even if I’m not a storyteller?
Turns out, with the right tools and a bit of structure — you can.
🎮 Play Bar 101 Game
🧰 View the code on GitHub
Designing Bar 101: Gameplay, Setting, and Themes Before Bar 101, most of my game projects followed a pretty different vibe.
I’ve built a number of games over the years mostly focused on fun mechanics over narrative. Two I’m especially proud of are Cargo Bridge and Sigma 18. Cargo Bridge was a physics-based puzzle game where players designed wobbly contraptions to help workers haul cargo across ridiculous gaps. It ended up being played nearly 50 million times worldwide. Sigma 18 was a deep-space hacking sim where you supported a squad of marines during a station infiltration. It focused on logic and systems, and it won first prize in Gynvael’s GameDev Challenge.
But Bar 101 is something else entirely.
It takes place in Stenograd, a dense, paranoid city governed by an algorithm called the BCI — Behavioural Compliance Index. This system scores every citizen based on data pulled from across their life: purchases, movement, biometrics, medical records, and who they talk to. High score? You get access, stability, a quiet life. Low score? You lose access. Slowly. Systematically. Sometimes, permanently.
Tucked away beneath an old tram station, there’s a hidden bar. No scanners, no surveillance — just people who don’t quite fit. And you? You’re Alex Radan, an ex-systems technician with a past that’s not fully yours anymore. You run the bar, but more importantly, you listen.
The entire gameplay loop revolves around conversations. Each night, different patrons arrives— carrying a personal stories, a political leanings, and a decisions to make. Your goal isn’t to win. It’s to understand, to nudge, to maybe change their mind. The world of Bar 101 reveals itself through these quiet exchanges. The more trust you build, the deeper you get. The wrong move can close doors — sometimes for good.
Funny thing is, the whole idea came together through LLM-assisted brainstorming. I threw ideas at the model, it threw back possibilities. We riffed, iterated, and the world of Stenograd started to take shape. It was oddly productive — and kind of fun.
The result? A city built on whispers, shaped by what you say or don’t.
Scaling Story with AI: The 128-Ending Engine So, I had this crazy idea: what if a single player could step into a bar and leave with one of 128 possible futures? Not just a “good ending” or “bad ending,” but totally different timelines shaped by tiny choices — like serving the wrong drink or pushing one question too far. At first, it sounded cool. Then I realised how ridiculous it would be to write all that by hand.
That’s when AI became more than a sidekick. It became the co-writer.
The foundation was a story tree with seven layers. Two branches at each layer. Which gives… yeah, 2 ⁷ = 128 storylines. That meant the game couldn’t just have a few scripted beats — it needed full-on branching narratives that stay coherent across hours of play. But branching like this easily turns into chaos if you don’t plan it right. I knew I needed structure.
So here’s how it worked.
Each playthrough starts with a shared “epilogue” — the same first scene, same setup. That helped anchor the world before chaos kicks in. From there, every new chapter had to reflect the player’s previous choices, the current political climate and even trust levels of NPCs.
To make that manageable, I wrote a Python script that handles the full story generation. At each chapter, the script prompts GPT-4 with a recap of what’s already happened, a set of branching goals (like “introduce a moral dilemma” or “reveal hidden faction agenda”), and a meta-description that defines what that chapter should feel like — rising tension, major twist, resolution, etc.
But just generating two options wasn’t enough. GPT tends to ramble or go generic unless you steer it hard. So I built a small system for “chain-of-thought prompting”: the model first brainstorms several possible next steps, ranks them internally based on uniqueness and emotional weight, and then expands the top 2 into full story branches. Sounds fancy, but really it’s just prompt engineering and a bit of glue code.
Then comes formatting. I used function calling to force GPT to return JSON instead of free text. Each chapter output includes:
A summary of what happened The key player choice Two consequences for each possible decision Flags for story continuity (like trust score, faction influence, etc.) Why JSON? Because it made everything easier to plug into the game engine. No need to parse messy text or chase weird formatting bugs. If something failed validation, the script just regenerated that part and moved on.
Over time, this approach made the generation process surprisingly stable. I could spin up hundreds of storylines, and while not all were gold, many felt surprisingly tight — sometimes even better than what I could’ve written myself. And I didn’t have to babysit every line.
The real power of this setup? Scale. Once the pipeline was working, I could generate entire trees in one go. That freed me to think more like a director than a screenwriter. Instead of crafting every scene, I designed the rules of the world and let the AI explore them.
Sure, it wasn’t perfect. Sometimes things still went off-rail. But I had versioning, caching, and enough control to fix what broke.
In the end, it felt like giving players a box of 128 different fates — all stitched from the same thread but pulling in wildly different directions. That’s not something I could’ve built without help. But with the right system and a bit of prompt alchemy, AI made it real.
If you’re interested in the implementation details, you can find all the code here: https://github.com/jamro/bar101/tree/main/bar101-storyline-gen
Characters Who Talk Back: Dialogue and Voice Let’s start with a truth: no player likes reading walls of text.
Even story-driven players. Even the ones who say they love lore. Trust me — when a character monologues for five screens with no pacing, no tone, and no breaks, it kills the vibe. I knew early on that Bar 101 needed dialogue that felt alive. Reactive. Personal. Something you could hear, not just read.
That’s easier said than done.
I didn’t want to write hundreds of variations by hand. I also didn’t want the same generic tone slapped on every character. And because trust is a core mechanic in the game — people open up only if they trust you — I needed each line to adapt. One version if they barely tolerate you, another if they’re cautiously honest, and a third if they’re ready to spill everything, maybe after one drink too many.
So I started with character profiles. Each patron in Bar 101 got their own mini bio: name, job, favorite drink, tone of voice, political stance, hobby, etc... Nothing too fancy, but enough to anchor their personality. I generated these with GPT and tweaked them until they felt distinct. These profiles were the base for generating consistent dialogue across different trust levels.
Then came the dialogue itself. I wrote a Python script that handled generation. It pulled from the character’s profile, trust score, and the current story path. Then it asked GPT to write five tone variants of each conversation snippet — from defensive, through neutral, to open. Some were short, like one-liners. Others became full scenes, depending on the player’s choices.
But text alone wasn’t enough. I wanted voice.
That’s when I found Coqui TTS, using the VITS model with VCTK voices. It’s open-source and surprisingly good, especially for a free tool. I matched each character with a voice that fit their vibe — gravelly for an old rebel, sharp and polished for a Harmonist bureaucrat. The results weren’t studio-level perfect, but they worked well enough to carry emotion and rhythm.
Now, to be honest: there are better voices out there. Paid models like sound more natural and expressive. But when you’re generating close to 100,000 voice lines for a hobby project? That’s just not realistic. Even a few cents per line adds up fast. Coqui was free, reliable, and scalable — good enough for me.
To manage all those lines, I used a simple trick. Each line of dialogue was hashed using MD5, and the result became the filename for the MP3. That way, if the same line appeared in two different places, it reused the same file. No need to manage text-to-file mappings manually. All audio was compressed and hosted on a AWS S3, and the game only loads what it needs in the moment.
In the end, it worked better than I expected. Characters didn’t just talk — they spoke. Some players said they forgot it was AI. Not because the voices were flawless, but because the dialogue fit. The tone, the pacing, the little shifts based on trust — it felt like a real back-and-forth.
And that’s the goal. Not to impress people with fancy tech, but to make them care. Even if it’s just a short chat over a gin fizz in a secret basement bar.
News, Propaganda, and Parallel Truths One thing I really wanted in Bar 101 was a feeling that the city was alive — and watching. Not just through dialogue, but through something bigger. That’s where the idea of news broadcasts came in. But not just one version but two.
After every major event in the story, the game shows a TV segment. One from the official state media. One from Rebel TV. Same facts, completely different tone. And here’s the cool part: both versions are generated by AI.
The prompt takes the same event and asks GPT to spin it two ways. The state version is polished, calm, full of confidence — “Stenograd remains stable under the BCI’s careful guidance.” The rebel one? Urgent, emotional, sometimes downright conspiratorial — “Tonight, a power outage at a data hub. Coincidence? We think not.”
It’s all tone control. Same inputs, different lens. That contrast makes the world feel polarized, like you’re hearing the same event through two cracked radios.
As for the visuals, I didn’t go crazy generating thousands of unique images. Too expensive. Instead, I had GPT come up with 100 thematic prompts — stuff like “official shaking hands on TV” or “burnt-out surveillance drone in alley.” Then I used GPT 4o to render them in a consistent style. During gameplay, the AI picks the best match from a small set.
Simple system. Big payoff. Those little TV segments don’t just fill the space — they reinforce the idea that truth in Stenograd is a moving target. Depends on who’s holding the mic.
Bringing It All Together: Tech Stack in Motion I’ll be honest — I’m more comfortable with JS Stack. Give me Pixi.js and a browser or Node.js, and I’m happy. But Bar 101 needed more than that. It needed real-time visuals, a story system, voice streaming, AI orchestration, and a little bit of cloud infra. I’ve worked with each of them before, but my expertise is stronger in some than others.
That’s where AI really became my coding buddy.
For the frontend, I used React for the UI and Pixi.js for all the juicy drink-mixing action s, dragging bottles, pouring liquids, animating the bar. React handled state and logic. Pixi brought it to life. That part was fun, and familiar.
But the story generation? It relatively new territory for me. I had a basic understanding of Python, but building a full content generation pipeline and doing it well was a step up. The same goes for Terraform: I used it a few years ago for small projects, but it was never a core part of my skill set.
So I used AI, through Cursor IDE, as a helper. And it was surprisingly good. Not perfect, but good enough that I could move fast. I’d write some messy Python, and AI would suggest cleaner alternatives. Or I’d ask, “Hey, is this the best way to cache GPT responses?” and get a useful response in seconds. It even helped me structure my Terraform setup — DNS, S3, Lambda, all connected cleanly.
Sometimes it wrote chunks of code. Sometimes it just reviewed what I wrote and helped me debug. Sometimes I’d just brainstorm best practices, and AI would show me options I hadn’t considered. It was like having a quiet, always-available junior dev who knew a bit about everything.
That combo — my experience in UI, AI’s support in areas I was less confident — made it possible to ship the whole stack in two months. Not bad for a solo dev.
What AI Gave Me (and What It Couldn’t) Working on Bar 101 taught me a lot — about AI, about solo development, and honestly, about myself. This wasn’t just a tech experiment. It was a test of how far you can go when you build with tools that weren’t available even a year ago.
Let’s start with the obvious: AI helped me do things I could’ve never pulled off alone. Writing 128 story paths? No way. Generating all that voice content? Definitely not. Even things like batch-creating dialogue variations, testing character tone, matching visual palettes — it would’ve taken a small team months. With the right prompts and systems, AI made it possible in weeks.
It also made coding less scary in areas I didn’t know well. Python and Terraform weren’t my strengths, but with AI helping inside Cursor, I never felt stuck for long. I could review code, clean it up, or just ask for better ways to do something. Sometimes I still wrote bad code, of course. But I learned fast — and shipped faster.
But here’s the catch: AI didn’t magically solve everything. It’s not a replacement for thinking. When I didn’t guide it properly, results came out flat or weird. If I skipped structure, I’d get branching stories that fell apart. So the real trick wasn’t “let the AI do it” — it was building good systems and knowing when to step in. Sometimes I had to redraw images, rewrite lines, rethink pacing. The AI helped, but I still had to care.
And that’s maybe the biggest thing I learned: AI can do a lot, but it doesn’t care. You do.
In the end, Bar 101 became more than I expected. It’s a game, yeah — but it’s also a kind of playable thought experiment. A place where trust, influence, and data all swirl together under low light and soft jazz. A place where your choices ripple out in ways you don’t always see coming.
Maybe you expose the BCI. Maybe you help it evolve. Maybe you just run the bar and listen. But whatever ending you land on, it’s your version of Stenograd. One of 128. No two players get the same one.
And for me, that’s the real win. I didn’t just build a game — I built a world where stories can breathe on their own. One drink, one dialogue, one decision at a time.
Key points
- AI can be used to generate vast amounts of narrative content, including dialogue, storylines, and world details.
- Structuring the AI generation process is crucial for maintaining coherence and quality.
- Character profiles and context-aware prompts can improve the believability of AI-generated dialogue.
- Open-source tools can provide cost-effective solutions for voice acting and other content creation tasks.
- AI can assist with coding and infrastructure tasks, even in areas where the developer lacks expertise.
- Human oversight and iteration are still necessary to refine and improve AI-generated content.
- AI can enable solo developers to create complex and ambitious games that would otherwise be impossible.
- The ultimate goal is to create a compelling player experience, not just to showcase AI technology.