Reference implementation for the Phoenix Architecture. Work in progress.
aicoding.leaflet.pub/
ai
coding
crazy
1# WebSocket Game Server
2
3A real-time multiplayer pixel territory game. Players connect via WebSocket, pick a team color, and paint cells on a shared 20×20 grid. The team with the most cells wins.
4
5## Connection Handling
6
7- The server must accept WebSocket connections on a configurable port (default 3000)
8- The same HTTP server must serve the game UI as a single HTML page at GET /
9- Each connected player must be assigned a unique player_id (random 6-character hex string)
10- On connect, the server must send the full grid state, player list, and remaining game time
11- Disconnected players must be removed from the player list within 5 seconds
12- The server must broadcast updated player counts whenever someone joins or leaves
13
14## Rooms
15
16- The server must support a single global game room (no room selection needed)
17- Maximum 20 simultaneous players; additional connections must receive a "room_full" error and be closed
18- The server must track each player's team color and total cells painted