A real-time multiplayer card game that explores human connection in the age of AI. Players discuss and vote on various scenarios involving AI and human interaction. Hosted on https://humanaiconnectiongame.onrender.com
- Concurrent User Handling: Improved to handle many users and rooms simultaneously
- Memory Management: Added automatic cleanup of inactive rooms (30-minute timeout)
- Connection Pooling: Enhanced Socket.IO configuration with better connection management
- Error Recovery: Robust error handling and automatic reconnection logic
- Fixed "Waiting for host" issue: Late joiners now properly sync with game state
- Fixed host disconnection: Automatic host transfer when host leaves
- Fixed race conditions: Proper state synchronization between server and clients
- Fixed memory leaks: Proper cleanup of socket event listeners
- Late Joiner Support: Players can now join games in progress seamlessly
- State Recovery: Automatic game state recovery for disconnected players
- Real-time Updates: Improved real-time synchronization of game state
- Better Error Messages: Clear, user-friendly error messages and recovery options
- Welcome Messages: Late joiners receive a welcome message and immediate access to current card
-
Server-Side Enhancements:
- Replaced object-based room storage with Map for better performance
- Added comprehensive input validation
- Implemented proper error handling for all socket events
- Added health check and statistics endpoints
- Automatic room cleanup to prevent memory leaks
-
Client-Side Enhancements:
- Improved socket connection management with reconnection logic
- Better state management and synchronization
- Loading states and error recovery UI
- Responsive design improvements
- Proper cleanup of event listeners
- Real-time multiplayer: Play with friends in real-time
- Card-based discussions: Vote on AI-related scenarios
- Three voting options: Support, Erode, or Depends
- Host controls: Host can manage game flow
- Late joiner support: Join games already in progress
- WebSocket communication: Real-time updates via Socket.IO
- Automatic reconnection: Handles network interruptions gracefully
- Cross-platform: Works on desktop and mobile browsers
- Responsive design: Optimized for all screen sizes
- Admin panel: Monitor game statistics and results
- Node.js (v14 or higher)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd humanaiconnection
-
Install dependencies
# Install server dependencies cd server npm install # Install client dependencies cd ../client npm install
-
Start the development servers
# Start server (from server directory) npm start # Start client (from client directory, in new terminal) npm start
-
Access the application
- Client: http://localhost:3000
- Server: http://localhost:3001
- Admin panel: http://localhost:3001/admin
- Health check: http://localhost:3001/health
GET /health- Server health checkGET /stats- Server statisticsPOST /cleanup- Manual cleanup of inactive roomsGET /admin- Admin panelGET /saved-games- List saved game results
create_room- Create a new game roomjoin_room- Join an existing roomstart_game- Start the game (host only)submit_choice- Submit card choicereveal_choices- Reveal all choices (host only)next_card- Move to next card (host only)update_choice- Update choice after discussionget_room_data- Request current room data
room_created- Room creation confirmationroom_joined- Room join confirmationupdate_room- Room state updategame_started- Game start notificationgame_state_sync- Game state synchronizationchoices_revealed- Choices revealed notificationnew_card- New card notificationgame_over- Game completionplayer_joined- Player joined notificationplayer_left- Player left notificationnew_host- Host transfer notificationerror- Error notification
NODE_ENV- Set to 'production' for production deploymentPORT- Server port (default: 3001)REACT_APP_BACKEND_URL- Backend URL for client (default: https://humanaiconnection.onrender.com)
# Build client
cd client
npm run build
# Start server
cd ../server
npm startThe game is deployed on:
- Frontend: Available at your frontend domain
- Backend: https://humanaiconnection.onrender.com
- Admin Panel: https://humanaiconnection.onrender.com/admin
- Health Check: https://humanaiconnection.onrender.com/health
- Health check endpoint:
/health - Server statistics:
/stats - Admin panel:
/admin
- Inactive rooms are automatically cleaned up after 30 minutes
- Manual cleanup available via
/cleanupendpoint
- Active rooms count
- Active connections count
- Total players count
- Active games count
- Server uptime
- Memory usage
-
"Waiting for host to start the game"
- This has been fixed in v2.0
- Late joiners now properly sync with game state
-
Connection issues
- App now has automatic reconnection
- Clear error messages and recovery options
-
Players stuck in loading
- Improved loading states and error handling
- Automatic retry mechanisms
-
Memory leaks
- Automatic cleanup of inactive rooms
- Proper event listener cleanup
Enable debug logging by setting NODE_ENV=development in server environment.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the troubleshooting section
- Review the admin panel for server status
- Check browser console for client-side errors
- Check server logs for server-side errors