This is the backend server component for Categories.LIVE, a real-time multiplayer word game inspired by Scattergories. The server handles game logic, room management, and real-time communication between players.
- Game Engine: Manages game state, rounds, scoring, and letter selection
- Room Management: Handles creation and management of game rooms, including public/private rooms
- Socket.IO Integration: Enables real-time bidirectional communication
- GPT-4 Integration: Provides AI-powered answer validation
- Real-time multiplayer support with Socket.IO
- Dynamic room creation and management
- Public and private game rooms
- Single-player mode
- AI-powered answer validation using GPT-4
- Live chat functionality in rooms
- Automatic game state management
- Configurable game settings
- Random room joining capability
- Players can create or join rooms
- Each game consists of 3 rounds
- Rounds follow this sequence:
- 3-second lobby countdown
- 90-second answer period
- Answer collection and GPT-4 validation
- Score calculation and display
- Results shown for 60 seconds
- Return to lobby for next round
The server is built with:
- Node.js for the runtime environment
- Express for the web server
- Socket.IO for real-time communication
- OpenAI's GPT-4 API for answer validation
Key files and their responsibilities:
app.js
: Main server entry point and Socket.IO setupgame.js
: Core game logic and state managementroom.js
: Room creation and managementclient.js
: Client connection handlinggpt.js
: OpenAI integration for answer validationprompts.txt
: Database of game categories