Inspiration

Project Trustfall initially started as a Prisoner's dilemma game, where a human plays against AI and the game based on how the human collective treats it builds a personality. After days of development the stories in the game didn't resonate with the few people I asked to test. while researching how to make the stories impactful, I came upon Steve Jobs principle of building technology around emotional investment rather than abstract capability so Instead of building a generic "AI storytelling engine," we anchored TrustFall Live in stories people already care about and let Gemini explore the roads not taken. TrustFall became the answer to the question every fan asks: "What if they'd made a different choice?"

What it does

TrustFall is an interactive "What If" storytelling experience where players step into the shoes of iconic characters at their most pivotal moments. Make a choice. Watch the alternate timeline unfold in real-time through AI-generated narrative, cinematic imagery, and dramatic voice narration. See how far your story diverges from canon. Each story runs 4 rounds. Round 1 presents the canonical pivotal moment. Rounds 2-4 are entirely AI-generated based on the cumulative weight of your choices, consequences compound, and the story diverges further with every decision. A final screen compares your ending to the original, highlighting exactly where your timeline diverged from canon.

How we built it

The stack is built around Gemini's multimodal capabilities as the core creative engine:

AI Layer

Model Role
gemini-2.5-flash Streams narrative text in real-time via SSE, maintaining full conversation history across rounds so consequences feel earned and connected
gemini-3.1-flash-image-preview Generates 4 cinematic concept art images per round
gemini-2.5-flash-preview-tts Narrates every scene with the dramatic "Kore" voice

Architecture

The app is a Nuxt 3 full-stack application hosted on Cloud Run. When a player submits a choice, the API immediately streams the narrative text back via SSE. Simultaneously, a Firestore write triggers a Cloud Functions v2 job that generates images and audio asynchronously — uploading results to Cloud Storage and updating the game document. The frontend listens via real-time Firestore listeners and surfaces media as it arrives, creating a progressive reveal experience.

Google Cloud Infrastructure

  • Cloud Run — Application hosting
  • Cloud Functions v2 — Async media generation pipeline
  • Cloud Firestore — Game sessions and story configurations
  • Cloud Storage — Media CDN with 1-year cache headers
  • Firebase Authentication — Anonymous, email, and Google Sign-In
  • Secret Manager — API key security

Challenges we ran into

Latency

Generating narrative text, 4 images, and a combined audio file sequentially could take over 2 minutes. I solved this by decoupling the pipeline, text streams immediately, media generates in the background. Players can read the story as it's written while images and audio arrive progressively. The wait became part of the experience rather than dead time.

Narrative Quality

Early versions of the AI Game Master punished players for valid strategic choices, making the experience feel like a quiz with wrong answers rather than a meaningful story. I rewrote the GM system prompt with explicit rules: consequences must feel like authentic tradeoffs, not punishments; every response must reference the cumulative weight of all previous choices; and the narrative arc must always escalate toward a satisfying climax.

Story Continuity Across Rounds

Maintaining continuity required wiring the full conversation history into every Gemini call. Without this, the AI generated disconnected, generic scenes. With it, the story remembers that Daenerys spared the city in Round 1 when writing Round 3's consequences and the difference is night and day.

Accomplishments that we're proud of

A fully working multimodal pipeline; streaming text, AI-generated images, and TTS voice narration all working together in a single cohesive game experience Prompt engineering that makes Gemini's GM narration feel like a genuine writer who respects the source material, not a generic AI response An architecture that turns a hard latency problem into a feature -> the progressive reveal of text -> images -> audio creates genuine dramatic tension Three complete story bibles with handcrafted Round 1 scenarios and AI-generated Rounds 2–4 that feel authentically connected to the source stories

What we learned

The best AI experiences aren't built around what the model can do, they're built around what the user already cares about. Anchoring Gemini's capabilities in stories people love made every generated sentence feel meaningful in a way that a blank-canvas storytelling tool never could.

What's next for TrustFall

Story-wide simulation engine; the long-term vision for TrustFall is a full story simulator where every character is powered by an AI micro-agent whose personality evolves based on its cumulative interactions with human players. Imagine a living Game of Thrones world where Cersei, Jon, and Tyrion each have independently evolving motivations shaped by thousands of player decisions. Beyond entertainment, this becomes a genuine research tool, a way to model how populations respond to moral dilemmas, predict collective human behavior, and understand decision-making patterns through the lens of stories people already understand intuitively.

For now

More stories: expanding beyond the launch trio to cover more fan-debated endings across film and TV

Community stats: an aggregate layer showing "X% of players burned King's Landing" turning TrustFall into a social experiment about moral decision-making at scale

Interactive audiobook export: completed games compiled into a shareable artifact with images, narration text, and audio per round, so players can relive and share their alternate timelines.

True interleaved output: migrating to Gemini's native interleaved generation so text and images stream together in a single unified response rather than sequentially

Player-submitted stories: a pipeline for fans to contribute their own "What If" scenarios from any story they love.

Built With

Share this project:

Updates

Submission history