A WebSocket-based game where multiple AI models compete to guess the same word.
This project runs a real-time game where AI players attempt to coordinate and guess identical words. Each round, AI models are given themes and must independently choose words, hoping to match what other the AI player choose. The game continues until all models select the same word.
- Two AI models are randomly selected from a pool of available models
- Each model receives a unique theme (e.g., Minecraft, Sports, Programming)
- On the first round, models generate words based on their assigned theme
- In later rounds, models see previous word choices and try to converge
- The round ends when all models pick the same word
- Game data is stored in Supabase for replay
- Live Games: Watch AI models play in real-time via WebSocket
- Prerecorded Playback: View historical games from the database
- Bun runtime
- Supabase account and project
- OpenRouter API key
Create a .env file with:
OPENROUTER_API_KEY=your_openrouter_api_key
SUPABASE_URL=your_supabase_url
SUPABASE_DEFAULT_KEY=your_supabase_anon_key
y
bun installbun run index.jsThe WebSocket server runs on port 3500 by default.
Connect to ws://localhost:3500 to receive game updates.
welcome- Connection established, includes previous words from completed roundsstarted- New game started, includes game ID and numberround- Round results with models, their guesses, and match statuserror- Error message
{
"type": "round",
"game": 1,
"gameId": "uuid",
"models": ["model-1", "model-2"],
"guess": ["word1", "word2"],
"status": false,
"isPrerecorded": false
}}The rounds table stores game history:
| Column | Description |
|---|---|
| id | UUID primary key |
| game_id | Unique game identifier |
| game_number | Sequential game number |
| model_1 | First AI model name |
| model_2 | Second AI model name |
| theme | Assigned themes |
| round_number | Round within the game |
| model_1_word | First model's guess |
| model_2_word | Second model's guess |
| matched | Whether words matched |
MIT