How cktang88/dungeon-game works
Project type and purpose
• This is a full-stack, LLM-driven, real-time text-based dungeon crawler with a React/Vite/Tailwind frontend (“game-client”) and a Node.js/TypeScript backend (“game-server”).
• The backend hosts game logic, procedural generation modules, state management, and connectors to LLM services (OpenAI, Gemini). The frontend renders UI (map, chatbox, inventory, stats) and communicates with the server over WebSockets.
File structure
Top level:
• ARCHITECTURE.md, README.md, examples/ (prompt snippets), todos.md
• game-client/ : React + Vite + Tailwind project
• game-server/ : TypeScript Node.js project
game-client structure:
• src/components/… (UI layout, chatbox, map, inventory, stats)
• src/lib/api.ts (HTTP/REST), src/lib/socket.ts (WebSocket client helper)
• package.json, vite.config.ts, postcss.config.js, tailwind.config.js
game-server structure:
• src/index.ts (entrypoint)
• src/game/… (actions.ts, state.ts, generation modules)
• src/lib/openai.ts, src/lib/gemini.ts (LLM connectors)
• data/… JSON/text files for environments, items, monsters, weapons, potions
• .env.example for API keys
README insights
• Describes room-by-room gameplay, D&D-style stats, LLM involvement in combat, puzzles, narration
• Future TODOs: memory storage (Zep/Mem0), BAML integration
Detail without over-splitting
• Essential modules (generation, state, LLM integration)
• Avoid drawing every single React component; instead, group UI components under “UI Layer”
• Flow of data—from player input in the browser → LLM and domain logic on server → rendering—remains crystal clear