External Publication
Visit Post

Building a real-time AI RPG with evolving narratives using LLMs

OpenAI Developer Community April 17, 2026
Source

I’ve been working on an AI-powered RPG where the story evolves in real-time based on player choices. The goal was to combine traditional RPG mechanics (HP, XP, inventory, progression) with dynamic LLM-generated narratives.

Some of the interesting challenges we ran into:

  • Maintaining story consistency across long sessions

  • Preventing narrative drift when users take unexpected actions

  • Managing structured game state alongside free-form text

  • Handling token limits for multi-turn storytelling

Approach:

  • Using layered prompts (system + state injection)

  • Summarizing past events to maintain continuity

  • Separating narrative generation from game logic

  • Tracking player state externally instead of relying on the model

Still experimenting with improving coherence over long sessions and reducing repetition.

Would be interested to hear how others are handling:

  • Long-term memory in interactive apps

  • Narrative consistency in branching flows

  • Cost vs quality trade-offs for real-time generation

We also opened a small beta if anyone wants to test the experience:

Questsmith

Questsmith — AI Text RPG & Interactive Fiction Game | Play Free

Play Questsmith — the AI-powered text RPG with infinite storylines, full RPG mechanics, persistent memory, and real-time visual effects. Create characters, explore worlds, and forge epic adventures. Start free today.

Discussion in the ATmosphere

Loading comments...