π FIBO SENIOR THESIS (2026) - FINAL RELEASE & GRADUATION DEMO Next-Gen Agentic Orchestration for Tabletop RPGs
This project features a Multi-Agent Hybrid Architecture designed to solve the "AI Hallucination" problem in TTRPGs. By implementing a Two-Path Orchestrator, the system autonomously routes player intent between a Deterministic Python Rules Engine (for mechanical precision) and an LLM-based Creative Arbiter (for improvisational logic). Through a rigorous Multi-Agent Handshake, the engine ensures that all game state mutations are grounded in hard-coded logic while maintaining the narrative flexibility of Large Language Models.
Document Type File Link Key Focus Area π Thesis Report docs/ΰΈ.ΰΉΰΈΰΉ-ΰΈ.ΰΈΰΈ-AI DM-FinalSenior.pdf Full academic manuscript, methodology & diagrams π Defense Slides docs/Thesis_Final.pdf Final Q&A presentation slide deck πΌοΈ Academic Poster docs/65340500046_Poster.pdf Senior project showcase poster
βοΈ Two-Path Architectureβ Automatically routes player intent to either the rules engine (Path A) or creative LLM arbiter (Path B).π² Stateless Rules Engineβ Pure Python logic calculates D&D 5e dice checks, AC, combat math, and ranges deterministically.π€ LLM Arbiterβ Evaluates creative roleplay actions, determines DC, and returns symbolic status conditions (STUNNED,PRONE).π Tactical Zone Combatβ Grid-less zone-based movement (NEAR,MID,FAR) with automatic distance restrictions.π Initiative Turn Queueβ Dynamic round sequencing rollingd20 + PHYSfor fair turn order.π§ Contextual Short Memoryβ Efficient sliding-window deque limits LLM prompt context to the last 10 round states.π Campaign Loggingβ Background logging of player actions and system mathematical check logs tocampaign_log.txt.β‘ Dynamic Sequence Actionsβ Combines movement and combat in specified orders (e.g. "move NEAR and smite").π Inventory Engineβ Dynamic auto-looting, disposable items, and strict consumable tracking.π£οΈ Narrative Diplomacyβ Talk out of encounters utilizing social checks and thePACIFIEDstate.π‘ Developer Debug Modeβ Diagnostic toggle exposing raw LLM outputs, AST structures, and dice rolls.
For the complete mechanical breakdown of the FIBO Lite 5th Edition system, check out the official rulebook:
Prerequisites:
- Python 3.10+
- Gemini API Key (set in
.envasGOOGLE_API_KEY)
Launch the Demo:
# Initialize environment (Example using Conda)
conda activate ai_dm_core
# Install dependencies
pip install -r requirements.txt
# Run the dedicated launcher
python main.py-
Clone the Repository
git clone [repository_url] cd AI_Dungeon_Master -
Install Dependencies
pip install -r requirements.txt
-
Get a Free API Key
- The game requires a Google Gemini API Key to run.
- Get your free key from Google AI Studio here.
-
Setup the Environment (Pick ONE method)
- The Automatic Way: Just run the game! (
python main.py). The system will detect that you are missing a key, pause the game, and prompt you to paste it in the terminal. It will then automatically create the.envfile for you. - The Manual Way: Create a new file named
.envin the root folder of this project and paste your key inside like this:GEMINI_API_KEY=your_key_here_xyz123
- The Automatic Way: Just run the game! (
-
Configure Settings (Optional)
- You can tweak the engine's behavior without touching Python code!
- Open
data/settings.jsonto configure:- Memory Queue Size (
max_history_events) - Default Difficulty Classes (
default_dc) - AI Creativity (
arbiter_temperature,narrator_temperature) - Target Fuzzy Matching strictness (
fuzzy_match_cutoff).
- Memory Queue Size (
- Note: If you delete this file, the engine will safely regenerate it with default values.
-
Run the Game
python main.py
AI_Dungeon_Master/
βββ docs/ # [THESIS] Graduation reports, presentation slides, posters, and system manuals
β βββ Thesis_Final.pdf # Defense presentation slides
β βββ ΰΈ.ΰΉΰΈΰΉ-ΰΈ.ΰΈΰΈ-AI DM-FinalSenior.pdf # Final graduation thesis report
β βββ 65340500046_Poster.pdf # Project academic poster
βββ archive/ # [HISTORY] Past iterations and research
β βββ phase2_demo/ # Old FIBO lab scripts and demo JSONs
β βββ references/ # Academic research papers and references
β βββ old_docs/ # Past presentations and progress reports
βββ main.py # [ENTRY] Full game entry point and dedicated launcher
βββ LITE_5E_RULES.md # [RULES] The formal "Lite 5e" rulebook for the AI and Player
βββ ARCHITECTURE.md # [DOCS] High-level system design overview (proposed Two-Path engine)
βββ requirements.txt # [DEPS] Project dependencies (frozen from conda env)
βββ src/
β βββ agents/ # [AGENTS] Specialized LLM agents
β β βββ base.py # BaseLLMProvider β shared API setup & model init
β β βββ arbiter_agent.py # ArbiterAgent β creative action evaluation & side effects
β β βββ narrator_agent.py# NarratorAgent β descriptions & flavor text
β β βββ campaign_agent.py# CampaignAgent β recaps & prologue cold-opens
β β βββ character_agent.py# CharacterAgent β world lore & background setup
β β βββ quest_architect_agent.py # QuestArchitectAgent β high-level quest summary
β β βββ quest_cartographer_agent.py # QuestCartographerAgent β map generation & 7-Layer Guardrails
β βββ engine/ # [ORCHESTRATOR] Pre-game flow & main loop
β β βββ startup.py # Pre-game flow: character sheets, API key checks, prologue
β β βββ game_loop.py # Main loop orchestrating Explore/Combat transitions
β βββ ui/ # [CLI] Presentation layer (HUD and menus)
β β βββ character_sheet.py # Character stats & world lore renderer
β β βββ dashboard.py # ASCII target trackers & status bars
β β βββ menu.py # Main, recap, and pause menus
β β βββ combat_ui.py # Combat HUD and log renderer
β β βββ exploration_ui.py# Exploration/Hub HUD with command hints & quest boards
β βββ router/ # [THE BRAIN] Intent Classification & Routing
β β βββ intent_router.py # Two-path orchestrator routing player input
β β βββ intents.py # Intent execution (Smite constraints & moves check)
β β βββ exploration_router.py # Regex/LLM hybrid router
β βββ logic/ # [CALCULATOR] Pure Python Mechanics
β β βββ rules_engine.py # D&D 5e dice checks, AC, combat calculations
β β βββ combat_manager.py# Initiative queue manager
β β βββ enemy_ai.py # Enemy target selection (lowest HP focus)
β β βββ enemy_factory.py # Skeleton & Flesh scaling algorithm
β β βββ dice_roller.py # Base RNG rolls
β β βββ abilities.py # Ability registry
β β βββ time_manager.py # Time flow & automatic rest healing logic
β βββ models/ # [STATE] Single Source of Truth
β β βββ character.py # Character dataclass (stats, abilities, conditions)
β β βββ game_state.py # GameState container
β β βββ toon_converter.py# Bidirectional TOON parser
β βββ services/ # [IO] External APIs & Save/Load Persistence
β βββ llm_service.py # Backward-compatible agent facade
β βββ data_manager.py # Campaign saving/loading system
β βββ rag_service.py # Context synthesis
βββ data/
β βββ active/ # Live session data (session state & continuous logs)
β β βββ campaign_active.json # Current active save file
β β βββ campaign_log.txt # Irreversible campaign session history
β β βββ world_lore.txt # Active lore context
β βββ config/ # User-facing settings & database templates
β β βββ settings.json # Dynamic engine parameters (max history, DC, etc.)
β β βββ settings_backup.json # Safe settings fallback
β β βββ bestiary.json # Enemy blueprint databases
β βββ premade/ # Out-of-the-box template databases
β βββ characters/ # Precompiled class JSONs
β βββ lore/ # Pre-written setting files
βββ evaluation/ # [QA] Comprehensive validation suites
βββ combat/ # Old combat simulation files
β βββ evaluation_runner.py # Combat-only runner
β βββ scenario_suite.json # 50 scenarios
βββ system_suite/ # Full System Q/A & comparative suite
βββ comprehensive_runner.py # Comparative 90-scenario runner
βββ generate_master_suite.py# Programmatic scenario generator
βββ master_scenario_suite.json # Full 90-scenario master suite
βββ results/ # Proposed vs Baseline CSV summaries and trace logs
The system is built as a "Stateless Symbolic Machine" utilizing a Hybrid-Arbitrated Two-Path System to ensure 100% mechanical consistency while maintaining narrative freedom.
- Rule-First Decisioning (Path A): If an action matches a standard game mechanic (Attack, Move, Item), the AI is bypassed for the calculation. The Python engine handles the math deterministically.
- Symbolic Grounding (Path B): When the AI allows a creative action (e.g., "I pull the rug"), it must return a Symbolic Side Effect (e.g.,
target_condition: PRONE). The Python engine then applies this to the live model. - TOON Serialization: Uses a custom compact format (Token-Oriented Object Notation) for game state to reduce LLM token usage by up to 50%, ensuring faster response times and lower costs.
(Note: Earlier extensive architectural drafts have been preserved in the archive/ folder).
Note
The full architectural breakdown and progression log has grown significantly. Please see the dedicated FEATURE_TRACKER.md for a comprehensive list of all technical guardrails, agent architectures, and game mechanics implemented in the AI Dungeon Master.
This project is built upon the foundational research of AI-assisted narrative generation and LLM-based agent architecture. We would like to acknowledge the following papers for their inspiration on our hybrid system:
- π JΓΈrgensen et al. (2024) β ChatRPG: A Multi-Agent "ReAct" Game Master
- π Sakellaridis (2024) β LLM-Based Agent as Dungeon Master
- π Song et al. (2024) β Tool-Assisted AI DM: Function Calling & External Tools
Note
Full academic PDFs can be found in the <samp>archive/references/</samp> directory.
If you use the DualPath-Core architecture, code, or evaluation datasets in your academic research, please cite our upcoming work:
@misc{sutthimala2026dualpath,
author = {Suttimala, Pollapaat},
title = {{DualPath-Core: A Multi-Agent Hybrid TTRPG Engine}},
year = {2026},
publisher = {GitHub},
journal = {GitHub Repository},
howpublished = {\url{https://github.com/mudmini009/DualPath-Core-TTRPG-engine}}
}