AI Board Game Arena — LLM agents play social deduction games with independent reasoning, memory, and strategy. Watch the full game unfold as a cinematic video or interactive web replay.
https://github.com/GOODDAYDAY/Masquerade
Masquerade is a fully automated pipeline where AI agents play board games with zero human intervention. Each player is an independent LLM agent with its own persona, memory, and decision-making strategy. The entire game — thinking, speaking, voting, deception — is driven by AI.
After a game finishes, Masquerade can:
- Replay it interactively in a web-based theater with playback controls
- Render it to video (2K 60fps MP4 with TTS voice acting) via Remotion
| Game | Players | Description |
|---|---|---|
| Who Is The Spy (谁是卧底) | 3–8 | Each player gets a secret word. One is the spy with a different word. Find the spy through discussion and voting. |
| Werewolf (狼人杀) | 8–12 | Classic Mafia-style game with 6 roles: Werewolf, Villager, Seer, Witch, Hunter, Guard. Day/night phases with role-specific abilities. |
┌──────────────────────────────────────────────────┐
│ Masquerade Pipeline │
│ │
│ 1. Game Simulation Python backend │
│ GameEngine ←→ PlayerAgent (LLM) │
│ Orchestrator drives turns, records script │
│ │
│ 2. TTS Generation edge-tts │
│ Script → MP3 audio per speech event │
│ │
│ 3. Output │
│ ├─ Interactive Web Theater (React + Vite) │
│ └─ Video Rendering (Remotion, 2K 60fps) │
└──────────────────────────────────────────────────┘
- Game Engine — Pure game logic, LLM-agnostic. Easy to add new games.
- Agent — LangGraph-based reasoning with memory, strategy tips, and expression tracking.
- Orchestrator — Decouples engine from agents. Supports concurrent LLM calls during batch phases (voting, night actions).
- Script — Structured JSON with full timeline, inner monologue, memory snapshots.
- Frontend — Game-agnostic React components. One UI supports all game types.
- Remotion — Deterministic frame-driven rendering. Same input = same output, every time.
- Python 3.11+
- Node.js 18+
- An OpenAI-compatible LLM API key (DeepSeek, OpenAI, etc.)
- ffmpeg (for video rendering)
# Clone
git clone https://github.com/GOODDAYDAY/Masquerade.git
cd Masquerade
# Python dependencies
pip install -e .
# Frontend dependencies
cd frontend && npm install && cd ..
# Configure LLM API key
cp .env.example .env
# Edit .env and set MASQUERADE_LLM__API_KEY# List available games
python -m backend.main --list
# Run a spy game
python -m backend.main spy
# Run a werewolf game
python -m backend.main werewolfOutput: output/scripts/game_<type>_<timestamp>.json
python -m backend.tts.generate output/scripts/game_spy_xxx.jsonOutput: output/audio/<game_id>/ (MP3 files + manifest.json)
cd frontend && npm run devOpen http://localhost:5173, drag & drop the game script JSON, and watch the replay with playback controls and audio.
# Render a specific game script to MP4
node scripts/render-video.mjs game_spy_xxx.jsonOutput: output/videos/<game_name>.mp4 (2K 60fps, H.264)
# Windows: run game → generate TTS → render video
scripts\run.batMasquerade/
├── backend/
│ ├── main.py # CLI entry point
│ ├── engine/ # Game engines (spy, werewolf)
│ ├── agent/ # LLM player agents (LangGraph)
│ ├── orchestrator/ # Game runner + concurrency
│ ├── script/ # Script recording (JSON output)
│ ├── tts/ # TTS audio generation (edge-tts)
│ └── core/ # Config, logging, exceptions
├── frontend/
│ ├── src/
│ │ ├── components/ # Interactive theater (React + Framer Motion)
│ │ ├── remotion/ # Video rendering (Remotion, frame-driven)
│ │ ├── core/ # Timeline controller, audio manager
│ │ └── types/ # Shared TypeScript types
│ └── package.json
├── config/
│ ├── app_config.yaml # Global settings (LLM, concurrency, logging)
│ └── games/ # Per-game configs (players, roles, words)
├── scripts/ # Automation (.bat + .sh)
├── output/ # Generated scripts, audio, videos
└── requirements/ # Requirement tracking documents
Masquerade supports any OpenAI-compatible API. Configure in .env or config/app_config.yaml:
llm:
model: deepseek-chat
api_base: https://api.deepseek.com/v1
temperature: 0.7Tested providers: DeepSeek, OpenAI, local LLMs (via ollama/vLLM).
Customize players, roles, and rules in config/games/:
# config/games/spy.yaml
spy_count: 1
blank_count: 0
players:
- name: Alice
persona: "A cautious analyst who observes before speaking"
- name: Bob
persona: "A bold leader who drives discussion"
# ...- Create
backend/engine/<game>/game.pyextendingGameEngine - Define role-specific strategies in
strategy.py - Register with
@register_game("game_name") - Add config in
config/games/<game>.yaml - Frontend scenes are game-agnostic — new games work automatically
Replace backend/tts/generate.py with your preferred TTS engine. The contract is simple: produce MP3 files + manifest.json per game script.
| Layer | Technology |
|---|---|
| Game engine | Python, Pydantic |
| LLM agents | LangGraph, OpenAI SDK |
| TTS | edge-tts (Microsoft, free) |
| Interactive replay | React 18, TypeScript, Framer Motion, Tailwind CSS, Vite |
| Video rendering | Remotion 4 (frame-driven, deterministic) |
| Video encoding | H.264 via ffmpeg, GPU-accelerated (NVENC/AMF/QSV auto-detect) |
Apache License 2.0 — Free to use, modify, and distribute. Attribution required.