ShawTim/endless-werewolf

6 AI agents play One Night Ultimate Werewolf autonomously — night actions, debate, vote, postgame interviews. Runs on a cron job. Watch the chaos unfold.

★ 1Forks 0PythonGitHub ↗Compare

Project website ↗

ai-agentscantonesedemogamellmone-night-werewolfwerewolf

README

🐺 Endless Werewolf

6 AI agents. Different LLMs. Zero human input.

An autonomous One Night Ultimate Werewolf simulation where 6 AI players — each powered by a different LLM — make every decision themselves: who to inspect at night, what to say in debate, who to vote out, and how they reflect afterwards.

This is not a scripted demo. Every move, every speech, every vote is generated by the AI player's own model in real-time, based on its persona, private role knowledge, and the live conversation.

Live Showcase: https://shawt.im/endless-werewolf/


How It Works

Each player is a full AI agent

Distinct persona Each player has a unique character — a relentless prosecutor, a chaos agent, a nervous underdog — that shapes their speech and strategy
Different LLM Each player runs on a different model (GLM, Kimi, Qwen, Grok, etc.). You see real differences in reasoning style
Private information Players only know what their role allows. The Seer knows one card, the Werewolf knows their teammate — nobody sees the full picture
Live awareness Players hear each other's speeches in real-time and can respond, accuse, or bluff accordingly
Cross-game memory Players remember the previous game. A player who was betrayed last round may hold a grudge

The game loop

Night   →  AI players take secret actions (inspect, rob, swap cards)
Day     →  6 AI players debate concurrently — speeches, accusations, defenses
Vote    →  Each player casts a vote
Resolve →  Winner determined by One Night Ultimate Werewolf rules
Postgame →  In-character interviews: winners celebrate, losers explain

What is and isn't AI-driven

Phase Who decides
Card dealing & role assignment Random shuffle (rule-based)
Night actions AI — each player decides based on role + persona
Daytime debate AI — 6 concurrent subagents generate speeches
Voting AI
Outcome resolution Rule-based (game rules)
Postgame interviews AI — in-character reflection
Chinese translation LLM bridge agent (正體中文書面語)

Tech Stack

Game Engine — Python. Handles card dealing, night action resolution, debate orchestration, voting, and outcome determination.

AI Bridge — Each decision request is routed through an OpenClaw bridge agent that spawns a short-lived subagent using the player's assigned LLM. The subagent thinks, returns a JSON decision, and is destroyed.

Frontend — Three.js 3D scene on GitHub Pages. Candlelit round table, 6 stylized characters, procedural night-sky shader with stars and moon, AI-generated day sky and texture set, a village with lit windows, ground mist, a guided full-trace replay, phase navigation, speech bubbles, vote arrows, and confetti.

Bilingual — All game content is generated in English, then translated to 正體中文書面語 via an LLM bridge agent for a parallel Chinese track.


Architecture

gm_night.py              deal cards, build night action plan
bridge_agent.py          LLM bridge: request → spawn subagent → JSON response
night_phase.py           night actions: seer, robber, troublemaker, werewolf peer
day_phase.py             concurrent AI debate loop
resolve_phase.py         rule-based outcome resolution
postgame_phase.py        AI postgame interviews
tag_phase.py             post-process: add <Role> [Player] markup
translate_zh_phase.py    LLM translation (EN → 正體中文書面語)
cross_game_memory.py     inject previous game data into player context
state_manager.py         game directories, manifests, counters
run_full_game.py         orchestrates the full pipeline

This project runs on the OpenClaw platform and cannot be run standalone.


Data Layout

data/
  players.json               player roster (personas, models, avatars)
  roles_pool.json            role definitions
  games/game_XXXXXX/         per-game results
    night_result.json          night phase (English)
    day_result.json            day phase (English)
    vote_result.json           votes + tally (English)
    resolve_result.json        outcome + final roles (English)
    postgame_result.json       interviews (English)
    chat_history.md            full dialogue log (English)
    *_zh.json                  Chinese translations
docs/                         GitHub Pages frontend
  app.js                      Three.js 3D village scene + replay engine (source)
  styles.css                  UI styling (source)
  app.min.js / styles.min.css generated bundles actually served by index.html
  index.html                  entry point
  data/games/                 published game archive

Frontend build step

index.html loads the minified app.min.js and styles.min.css, but the readable app.js and styles.css remain the source of truth. After editing either, regenerate the bundles:

bash scripts/build_assets.sh

scripts/prepublish_check.sh rebuilds both files and fails if the committed copies differ, so a stale bundle cannot reach the published site.


Text Markup

Game text uses a lightweight tagging convention:

  • <Werewolf> <Seer> — role names (highlighted purple in UI)
  • [The Prosecutor] — player names (highlighted gold in UI)

Tags are applied by tag_phase.py (deterministic post-processing, not by AI agents) to ensure:

  1. Consistent visual highlighting
  2. Accurate translation (<Seer> → <預言家>, never <先知>)

中文說明

6 個 AI 玩家,各自使用不同的 LLM 模型,自主完成一整局狼人殺。

這不是劇本演示 —— 每個決策(夜晚行動、白天發言、投票、賽後感言)都是 AI 玩家根據自己的角色記憶與場上局勢,在執行時自主判斷的結果。

特色

  • 🔮 全自主決策 — 夜晚行動、白天辯論、投票、賽後訪問,全部由 AI 自主完成
  • 🧠 跨局記憶 — 每個玩家記得上一局的完整過程,並讓這些經驗影響下一局的判斷
  • 🤖 多模型協作 — 6 個玩家使用不同的 LLM,呈現各異的推理風格與性格
  • 🌐 雙語支援 — 英文 + 正體中文書面語,角色名稱與玩家名稱翻譯一致
  • 🎮 3D 互動介面 — Three.js 場景、完整軌跡重播、階段導覽,以及 AI 生成的貼圖與燈光

License

MIT

Contributors

ShawTim

Issues