Turn D&D rule lookups from immersion-breaking pauses into instant, source-cited answers — powered by a hybrid RAG system with a 3D fantasy interface.
Try the PrototypeDungeons & Dragons transforms gameplay into epic storytelling — until the rules break immersion. A climactic battle grinds to a halt while the DM flips through 500 pages trying to remember how grappling works.
The Dungeon Archivist fixes this. Ask "What happens when you're blinded?" and get accurate, source-cited responses in under 3 seconds — through a 3D dungeon room interface with a fantasy book that absorbs your queries and returns grounded answers with confidence scores.
D&D 5th Edition: 500+ pages of unstructured rules, context-dependent mechanics, and zero tolerance for errors.
| Approach | Strengths | Critical Failures |
|---|---|---|
| Keyword Search | Fast, precise for known terms | Can't understand intent ("How does grappling work?") |
| Generic LLMs | Natural language understanding | Hallucinate plausible-sounding but wrong rules |
| Pure Vector Search | Good semantic similarity | Returns lore instead of stats for structured queries |
| Hybrid RAG | Intent + precision combined | Grounded, cited, confidence-gated |
Queries route through two parallel retrieval pathways, combining semantic understanding with structured precision.
ChromaDB embedding-based similarity search for narrative rules. Captures user intent and semantic meaning — "How does grappling work?" or "Explain advantage."
Direct entity lookups in structured metadata for 100% factual accuracy on stats — "What's a Goblin's HP?" or "Fireball damage."
Threshold-based filtering (score < 1.1) validates relevance. Out-of-domain queries rejected with "No relevant D&D content found."
Every answer includes source file references. Users trace any ruling back to official SRD content for full transparency.
The frontend is a fully 3D React/Three.js experience. Users interact with a dungeon room environment featuring a fantasy book that absorbs chat queries, a crystal ball, dice, and atmospheric lighting — making the rules lookup feel like part of the game itself.
Two independent controls shape every response. The AI Creativity slider adjusts how inventive the generation is, while the DM Personality selector chooses from three distinct Dungeon Master voices — each with its own tone, flavor text, and playful language patterns.
The entire experience was redesigned mobile-first. The 3D scene fills the screen, the DM toolkit moves into a swipeable bottom drawer, and every interaction is touch-optimized — because D&D happens at tables, not desks.
Automated ingestion pipeline transforms dense SRD prose into retrievable, cited chunks.
Load D&D SRD text files and Basic Rules PDF from local storage. Background ingestion validates PDFs and supports additional sources via env/data/.
RecursiveCharacterTextSplitter: 1000-char chunks, 100-char overlap. Splits on paragraph → sentence → word boundaries to keep mechanics and examples together.
768-dimensional vectors via text-embedding-004. Batch processing with exponential backoff. Normalized embeddings for more consistent retrieval scores.
Persist vectors + metadata (source file, chunk ID, character positions) in ChromaDB. Background ingestion runs at startup; avoids bundling chroma_db in Docker.
Systematic testing across 50+ queries established retrieval thresholds and validated system behavior.
"What happens if I can't see?" — Similarity score 0.9839 (below 1.1 threshold). Successfully retrieved 'blinded' condition rules with accurate generation.
"How do I bake a chocolate cake?" — Score 1.2975 (above threshold). Correctly rejected with "No relevant D&D content found."
50+ queries established 1.1 as optimal separation. Valid D&D queries consistently below 1.0; out-of-domain above 1.2.
"How does grappling work?" — 3 relevant chunks retrieved covering rules, escapes, and edge cases. Total retrieval time: 87ms.
From question to cited answer — seven steps through the archive.
User asks a D&D question through the 3D fantasy book interface.
Dual sliders shape creativity and DM voice before generation.
Parallel vector + structured search with normalized embeddings.
Threshold filtering rejects out-of-domain queries.
Gemini generates a response grounded in retrieved SRD chunks with citations.
Answer renders inside the fantasy book within the dungeon room.
Full 3D on mobile; DM toolkit in a swipeable bottom drawer.
Hybrid RAG design, semantic search, empirical threshold calibration (50+ queries), confidence gating, hallucination risk reduction.
ETL pipeline, recursive text chunking, vector embedding optimization, background ingestion, PDF validation, API cost optimization.
React + Three.js 3D scene, mobile-first responsive design, bottom drawer navigation, touch optimization, DM personality UI.
Modular architecture, FastAPI backend, Docker deployment, error handling, graceful degradation, multi-interface design.
The Dungeon Archivist demonstrates end-to-end AI engineering: from hybrid RAG architecture to a 3D fantasy interface, built across 5 phases and continuously improved with mobile-first redesigns, dual creativity controls, and deployment reliability updates. The system transforms 2–5 minute rule disruptions into sub-3-second experiences with source-cited, confidence-gated responses.
From security-first development to user-centered 3D design, the project showcases advanced competencies in AI/ML engineering, data engineering, 3D frontend development, and software architecture — representing what modern, full-stack AI engineering looks like.