Myth & Mimics
AI-driven tabletop RPG with Powered by the Apocalypse ruleset

A full-stack web application combining classic tabletop role-playing with modern AI. An AI Dungeon Master powered by Google Gemini narrates the story, rolls dice by PbtA rules, generates character portraits, and delivers voice narration via ElevenLabs TTS.
- —Multi-agent AI pipeline: narration, image generation and TTS via a provider-agnostic Laravel AI SDK
- —Optional AI second player — a second agent plays its own character with a distinct personality
- —Conversation memory with automatic summarisation at ~8,000 tokens
- —Interactive AI character creation as a multi-step dialogue instead of a classic form
- —Two settings: Dungeon World (sword & sorcery) and Mythos World (Lovecraftian horror)
- —Filament v3 admin panel: story builder, token tracking, API key management with live test
- —Voice input via Browser Speech Recognition API and TTS autoplay after every DM response
Myth & Mimics is a full-stack web application that combines classic tabletop role-playing with modern AI technology. The platform implements the Powered by the Apocalypse (PbtA) ruleset across two settings: Dungeon World for classic sword-and-sorcery adventures and Mythos World for Lovecraftian horror stories. An AI-driven Dungeon Master — powered by Google Gemini — narrates the story, responds dynamically to player actions, rolls dice according to PbtA mechanics, generates character portraits, and delivers full voice narration via ElevenLabs TTS.
The project is the second stage of Dungeon Duo — taking the core concept of an AI-driven Dungeon Master and rebuilding it from a React-only prototype into a production-ready full-stack architecture with persistent state, a proper backend, and a rules-driven game engine.
Technical Stack
The backend is built on Laravel 12 with PHP 8.4, running in a Docker environment via Laravel Sail. AI integration uses the Laravel AI SDK — a provider-agnostic abstraction layer that talks to Gemini (narration, image generation) and ElevenLabs (TTS) through a unified interface, and can be switched to other providers like Anthropic without changing the core. The admin panel is built entirely with Filament v3. Real-time communication between server and frontend runs over Laravel Reverb (WebSocket). The frontend is a React 19 + TypeScript SPA with Tailwind CSS 4 and a custom fantasy-* colour theme, built with Vite and navigated via React Router DOM.
Architecture Highlights
Multi-agent AI pipeline: Every player action passes through a structured pipeline. The DungeonMaster agent receives a dynamically assembled system prompt composed of rulebook, story context, NPC list, threats, locations, and full character status. The AI response contains narrative prose alongside a machine-readable ||DATA|{...}|| block carrying game state changes (HP, inventory, spells). Laravel parses this block server-side, updates the database, and sends only clean JSON to the frontend — an approach that prevents prompt injection and guarantees data integrity.
AI-controlled second player: Optionally, a second AI agent takes on the role of a co-player with its own character and personality. The AiPlayer agent reacts to every Dungeon Master narration, and the DM in turn describes that character's action — a fully automated narrative loop that gives solo players a cooperative feel.
Conversation memory with summarisation: All game messages are stored in the database. When the context token count approaches a threshold (~8,000 estimated tokens), a separate Summarizer agent cumulatively summarises older messages. The most recent 10 messages are always kept in full, ensuring the DM always responds with context.
Interactive AI character creation: Instead of a classic form, an AI agent guides the player through character creation in a multi-step dialogue — name, gender, playbook, attributes, backstory. At the end, a ||DATA|{...}|| block is parsed and the character is created directly in the database.
Dynamic ruleset: World settings define their own attribute names, value ranges, and portrait style prompts. Playbooks (classes) are linked to setting-specific attributes via a many-to-many relation, making the system extensible to further PbtA variants without touching the core code.
Feature Overview
- Full character CRUD with AI-generated portrait (Gemini Imagen) and backstory
- Real-time game interface: chat log, dice rolling (server-side 2d6), sidebar with adventure log, inventory, and spell list
- TTS autoplay after every DM response with interruptible playback; voice input via Browser Speech Recognition API
- Filament admin: story builder (NPCs, threats, locations), playbook editor, token usage tracking, API key management with live test
- GitLab CI/CD pipeline: PHPUnit + Vitest, frontend build, rsync deployment to Ubuntu server
Status
Six of eight planned development phases are complete. Currently in progress: rate limiting, extended error handling, and a REST API extension as the foundation for future iOS/Android apps.