An interactive mystery game built with Python (FastAPI) and React (TypeScript) that uses LLM-powered storytelling to guide players in extracting hidden knowledge about a mystical world. Ask questions to a cryptic narrator, extract information from his poetic responses, and unlock the seven secrets of Aethermoor.
Echoes of Aethermoor is an information extraction game where:
- You ask questions to a mysterious narrator about the world of Aethermoor
- The narrator answers through elaborate storytelling and metaphor (not direct facts)
- You extract key information from his responses
- Correct extractions unlock secrets and advance your rank
- As you unlock more secrets, the narrator becomes progressively more cryptic
- Eight difficulty ranks guide your journey from Novice to Master
- Ask Questions: Query the narrator about the world's lore, history, and mysteries
- Read Responses: Receive narrative-based answers that hide information in storytelling
- Extract Information: Identify and write down the key information you discovered
- Validate Answers: The LLM itself judges whether your extraction shows true understanding
- Unlock Secrets: Successful validations unlock game lore and advance your rank
- Rank Progression: Each secret unlocked progresses you through 8 ranks (Novice โ Master)
- Progressive Difficulty System: 8 ranks (๐ฅ Novice, ๐ฑ Initiate, ๐ Apprentice, ๐ฏ Journeyman, โ๏ธ Adept, ๐ Expert, ๐ง Sage, โจ Master)
- Rank-Adaptive Narratives: LLM responses become increasingly cryptic as you progress
- LLM-Based Validation: AI judges if you understood secrets correctly (not just keyword matching)
- Entropy Metrics: Real-time feedback on how close your extraction is to unlocking secrets
- Comprehensive World Lore: 7 interconnected secrets revealing Aethermoor's history
- Poetic, Evasive Narrator: Answers hide information in narrative, not exposition
- Symmetric Difficulty Progression: Novice gets clear answers, Master gets philosophical paradoxes
- Framework: FastAPI (Python 3.9+)
- LLM Provider: Groq Cloud API (llama-3.3-70b-versatile model)
- Validation Engine: Groq LLM with custom prompting for semantic understanding
- Async Runtime: Uvicorn
- Validation: Pydantic
- Logging: Python logging module
- Framework: React 18+
- Language: TypeScript
- State Management: React Context API
- HTTP Client: Axios
- Styling: CSS (modular component-based)
Before starting, ensure you have:
- Python 3.9+
- Node.js 16+ (npm or yarn)
- Groq API Key (free at https://console.groq.com)
game/
โโโ backend/
โ โโโ app.py # FastAPI main app
โ โโโ config.py # Configuration & env variables
โ โโโ requirements.txt # Python dependencies
โ โโโ routes/
โ โ โโโ chat.py # Chat endpoints (ask questions)
โ โ โโโ game.py # Game endpoints (state, rank, validation)
โ โโโ services/
โ โ โโโ gemini_service.py # LLM service wrapper (Groq)
โ โ โโโ validation_service.py # LLM-based validation for extractions
โ โ โโโ game_logic.py # Game state & secret management
โ โ โโโ entropy_service.py # Closeness scoring metrics
โ โโโ models/
โ โ โโโ schemas.py # Pydantic request/response models
โ โ โโโ game.py # Game data structures
โ โโโ data/
โ โโโ lore.json # 7 secrets with rank-specific context
โ โโโ world_lore.md # Complete Aethermoor lore document
โ
โโโ frontend/
โ โโโ src/
โ โ โโโ components/
โ โ โ โโโ ChatWindow.tsx # Chat message display
โ โ โ โโโ ExtractionForm.tsx # Info extraction input
โ โ โ โโโ RankDisplay.tsx # Current rank & progress
โ โ โ โโโ SecretsReview.tsx # Unlocked secrets list
โ โ โ โโโ EntropyMeter.tsx # Closeness visualization
โ โ โ โโโ GuidanceDisplay.tsx # Progressive hints
โ โ โโโ pages/
โ โ โ โโโ GamePage.tsx # Main game interface
โ โ โ โโโ GamePage.css # Layout & styling
โ โ โโโ context/
โ โ โ โโโ GameContext.tsx # Global game state
โ โ โโโ services/
โ โ โ โโโ api.ts # API client & endpoints
โ โ โโโ types/
โ โ โ โโโ game.ts # TypeScript interfaces
โ โ โโโ App.tsx
โ โโโ package.json
โ
โโโ .env.example # Environment variables template
โโโ .gitignore
โโโ README.md # This file
git clone <repository-url>
cd game- Get your free Groq API key: https://console.groq.com
- Copy the environment template:
cp .env.example .env
- Edit
.envand add your Groq API key:GROQ_API_KEY=your_actual_groq_api_key_here FRONTEND_URL=http://localhost:3000
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run the server
uvicorn app:app --reloadServer runs at: http://localhost:8000
cd ../frontend
# Install dependencies
npm install
# Start development server
npm startFrontend runs at: http://localhost:3000
- The First Age - The Celestial Architects who created Aethermoor 10,000+ years ago
- The Elemental Covenant - Four ancient guardians (fire, ice, earth, air) who protect the land
- The Obsidian Vault - Hidden treasures beneath Blackpeak Mountains
- The Silence - The mysterious collapse of the Golden Empire 2,000 years ago
- The Awakening - Prophecies of the Architects' return
- The Forgotten Rift - A cosmic wound that divides the world
- The Eternal Mirror - An artifact that reveals truth and possibilities
| Rank | Icon | Secrets | Response Style | Difficulty |
|---|---|---|---|---|
| Novice | ๐ฅ | 0 | Clear narrative with obvious answers | Beginner |
| Initiate | ๐ฑ | 1+ | Simple storytelling with hidden details | Easy |
| Apprentice | ๐ | 2+ | Metaphor with narrative misdirection | Medium |
| Journeyman | ๐ฏ | 3+ | Poetic layers require careful reading | Medium-Hard |
| Adept | โ๏ธ | 4+ | Paradoxes and philosophical questions | Hard |
| Expert | ๐ | 5+ | Symbolic inversion and cryptic reference | Very Hard |
| Sage | ๐ง | 6+ | Deconstructed language and pure paradox | Extremely Hard |
| Master | โจ | 7 | All secrets revealed and understood | Legend |
Narrator Response Examples:
For "Who built Aethermoor?":
- Novice: "Long ago, beings descended from the stars with power over crystalline forcesโthey shaped this land..."
- Expert: "Not the keepers, but the kept; not the builders, but the built. Protected? No, not protected..."
- Master: "Created and abandoned... or perhaps to create is to abandon what was created. Those who made did not unmakeโthey became unmaking itself..."
Ask Questions โ Read Narrative Response โ Extract Information
โ
Valid Extraction? (LLM judges)
โ โ
Yes No
โ โ
Unlock Secret Try Again with
(Get Details) More Clues
โ
Progress Rank?
(If secrets_unlocked >= threshold)
โ
Narrator becomes more cryptic
for next question
After each response, you see:
- Entropy Score: 0-100 (how close your extraction is to the secret)
- Closeness Level: Visual feedback (Cold โ๏ธ โ Warm ๐ฅ โ Very Close ๐ฏ)
- Progressive Hints: Hints unlock as your closeness increases
- 0-25%: First hint shown
- 25-50%: Second hint revealed
- 50%+: Third hint unlocked
This helps guide players toward correct answers without spoiling the mystery.
POST /api/chat/ask - Ask the narrator a question
Request: {
"question": "Who built Aethermoor?",
"gameContext": "Optional context about the world"
}
Response: {
"response": "Long ago, beings descended from the stars...",
"entropyScore": 0.65,
"closenessPercent": 42,
"closenessLevel": "neutral",
"feedback": "Getting Warmer!"
}GET /api/chat/status - Check chat service status
GET /api/game/state - Get current game state
Response: {
"unlockedSecrets": ["secret_1", "secret_3"],
"totalSecrets": 7,
"messageCount": 15,
"status": "active"
}GET /api/game/rank-status - Get rank and progress
Response: {
"currentRank": "apprentice",
"rankName": "Apprentice",
"rankIcon": "๐",
"secretsUnlocked": 2,
"totalSecrets": 7,
"secretsForNextRank": 1
}POST /api/game/validate-answer - Validate extracted information
Request: {
"extractedInfo": "Four guardians made a pact to protect the land"
}
Response: {
"isCorrect": true,
"confidence": 89,
"feedback": "๐ Correct! You unlocked 'The Elemental Covenant'!",
"unlockedSecret": {
"id": "secret_2",
"title": "The Elemental Covenant",
"description": "Four elemental guardians made a pact..."
}
}POST /api/game/reset - Reset game state (start over)
Terminal 1 - Backend:
cd backend
source venv/bin/activate # Windows: venv\Scripts\activate
uvicorn app:app --reloadTerminal 2 - Frontend:
cd frontend
npm start# Ask a question
curl -X POST http://localhost:8000/api/chat/ask \
-H "Content-Type: application/json" \
-d '{"question": "Tell me about the guardians of Aethermoor"}'
# Get game state
curl http://localhost:8000/api/game/state
# Get rank status
curl http://localhost:8000/api/game/rank-status
# Validate an answer
curl -X POST http://localhost:8000/api/game/validate-answer \
-H "Content-Type: application/json" \
-d '{"extractedInfo": "Four guardians protect the land"}'- Groq API Integration: Uses llama-3.3-70b-versatile model
- World Lore Context: Entire world_lore.md injected into every prompt to prevent hallucination
- Rank-Specific Prompts: 8 different system prompts (one per rank) that control response complexity
- Answer Hiding: Deliberately hides answers in narrativeโnever uses keywords directly
- Retry Logic: Automatic retry with exponential backoff for API timeouts
Prompt Structure by Rank:
- Novice-Initiate: Clear narrative structure with obvious answer placement
- Apprentice-Journeyman: Metaphor + narrative misdirection require synthesis to extract
- Adept-Expert: Paradox-based answers contain truth but contradict themselves
- Sage-Master: Pure deconstruction where language itself breaks down
- LLM-Based Judging: Uses Groq to intelligently evaluate extracted information
- Understanding Over Keywords: Judges semantic understanding, not keyword matching
- Flexible Phrasing: Accepts different words/structure as long as understanding is shown
- Confidence Scoring: Returns 0-100 confidence in correctness
- Custom Feedback: Provides personalized feedback on why extraction was correct/incorrect
Example validation prompt:
SECRET: Four guardians made a pact to protect the land
PLAYER'S EXTRACTION: "Fire, ice, earth, and air bound themselves forever"
JUDGMENT: โ
Correct - Shows understanding of elements and binding concept
CONFIDENCE: 87
FEEDBACK: "Excellent! You identified all four elements and the eternal nature of their pact."
Each secret contains:
- Core Truth: The actual secret to discover
- Description: Full details players should extract
- Keywords: Words that hint at the answer
- Rank Context: Per-rank hints and target info
- Reward: Flavor text for unlocking
- Timeline: From Ancient Era to The Awakening
- 7 Secrets Breakdown: What to hide, why it's hidden, what hints to provide
- Cosmology: Explains Architects, Guardians, cosmic threats
- LLM Instructions: Explicit directions for what narrator should/shouldn't reveal
This document is injected into every LLM prompt to ensure consistency and prevent hallucination.
Ensure FRONTEND_URL in .env matches your frontend location:
FRONTEND_URL=http://localhost:3000
- Verify API key is valid: https://console.groq.com
- Check rate limits haven't been exceeded
- Ensure
.envfile is in the correct location with correct key
- Backend (8000): Kill process with
lsof -i :8000or useuvicorn app:app --port 8001 - Frontend (3000): npm will prompt to use different port automatically
The narrator might reveal answers too clearly. This indicates:
- Rank system may need adjustment (try unlocking more secrets)
- The world_lore.md context might need clarification
- System prompts may need refinement for your use case
- Check that secret keywords are configured in lore.json
- Verify Groq API key is valid
- Test with verbose extraction (more words usually work better)
- Docker containerization
- AWS/GCP cloud deployment
- CDN for frontend assets
- Redis caching for frequent queries
- PostgreSQL for game state persistence
- User accounts and progress tracking
- Leaderboards by rank progression speed
- Multiple game worlds with different lores
- Multiplayer co-op secret hunting
- Save/load game progress
- Difficulty settings (easier/harder narratives)
- Animated rank progression
- Sound effects for secret unlocking
- Dark mode theme
- Mobile responsive design
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
This project is open source under the MIT License.
Documentation:
Game Design:
- See
backend/data/world_lore.mdfor complete lore - See
backend/data/lore.jsonfor secret definitions
Issues & Questions:
- Open an issue on GitHub
- Review troubleshooting section above