cd /news/artificial-intelligence/your-story-local-gemma-4-interactive… · home topics artificial-intelligence article
[ARTICLE · art-2047] src=dev.to pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Your Story: Local Gemma 4 Interactive Fiction That Remembers Your Choices

"Your Story," a Flutter mobile app that uses local Gemma 4 AI models to power interactive fiction. Unlike traditional choose-your-own-adventure games, the app allows players to type natural language actions, which the AI evaluates and responds to while a deterministic state engine records permanent consequences. The goal is to create a playable novel experience that combines creative AI storytelling with consistent, state-driven world logic, as demonstrated in a sample "Jack and the Beanstalk" story.

read2 min views6 publishedMay 20, 2026

This is a submission for the Gemma 4 Challenge: Build with Gemma 4 Your Story is a Flutter mobile app for interactive fiction powered by local Gemma 4 models. The app starts from structured story templates, then lets players act in natural language. Instead of branching only through fixed choices, the player can type actions like "I hide the beans and tell Mother the truth" or "I ask the giant's wife for help." The story engine evaluates what is possible, Gemma 4 writes the next passage, and deterministic state logic records permanent consequences. The goal is to make AI storytelling feel less like a loose chatbot and more like a playable novel: The first story is Jack and the Beanstalk, with 13 beats, 6 characters, 7 locations, and a state model for choices such as trading the cow, taking treasure, earning trust, or angering the giant. Video walkthrough: https://github.com/tuandinh0801/your-story/blob/main/docs/assets/your-story-mobile-demo.mp4 Planned walkthrough: Repository: https://github.com/tuandinh0801/your-story/tree/main Gemma 4 powers the core storytelling loop. It is not just used for a side feature. I use two local Gemma 4 LiteRT-LM models through flutter_gemma : The app also has a Firebase AI cloud route for fallback and enhanced tasks. Each agent request declares a routing policy: The router records which backend and model served each request. That makes the multi-agent system visible for debugging while keeping the reader experience simple. Interactive fiction needs low-latency language generation, but it also needs long-running coherence. A pure cloud chatbot can produce prose, but it can drift from prior choices. A fixed branching engine can preserve state, but it limits the player's imagination. Your Story splits the job: This lets Gemma 4 do the creative language work while the app keeps the world consistent. The app treats a story like a living state machine, not a chat transcript. The AI receives story rules and state context, then the engine validates what changed. Choices become durable facts that later turns can reference. For example, if Jack trades Daisy for beans, that inventory change and relationship impact are stored as state. Later narration can reflect Mother's disappointment or trust because those values are no longer just text in an earlier paragraph. flutter_gemma .

── more in #artificial-intelligence 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/your-story-local-gem…] indexed:0 read:2min 2026-05-20 ·