A simple yet popular dice game that can be played locally or online with friends!
- โ Local Multiplayer - Play with friends on the same device
- โ Online Multiplayer - Play with friends online via Socket.io
- โ Cross-Platform - Works on desktop browsers (mobile support coming)
- โ Real-Time Gameplay - Instant updates across all players
- โ Multiple Game Modes - Different configurations and difficulty levels
- Node.js v18 or higher
- npm or yarn
# Clone the repository
git clone https://github.com/yourusername/FivesDiceGame.git
cd FivesDiceGame
# Run setup script (Windows)
setup.bat
# OR Run setup script (Mac/Linux)
bash setup.sh
# Start development server
npm run dev
# Open browser
http://localhost:8080- DEVELOPMENT.md - Local development guide, architecture, debugging tips
- DEPLOYMENT.md - Production deployment guide for your domains
- SOCKET_IO_GUIDE.md - Socket.io optimization and troubleshooting
- RULES.md - Complete game rules (if exists)
FivesDiceGame/
โโโ client/ # Phaser game client
โ โโโ scenes/ # Game scenes
โ โโโ utils/ # Utilities (Socket.io, Audio, Animation)
โ โโโ assets/ # Game assets
โ โโโ main.js # Game entry point
โโโ server/ # Node.js server
โ โโโ index.js # Express + Socket.io server
โ โโโ lobbyManager.js # Game lobby logic
โ โโโ auth.js # Authentication
โ โโโ utils/ # Server utilities
โโโ web/ # Marketing website
โโโ README.md # This file
To deploy with your domains (fivesdicegame.com):
- Server โ
api.fivesdicegame.com - Game Client โ
play.fivesdicegame.com - Website โ
fivesdicegame.com
See DEPLOYMENT.md for detailed instructions.
- Framework: Express.js
- Real-Time: Socket.io v4.7+
- Authentication: Passport.js (Discord, Google OAuth)
- Session: Express-session with Redis support
- Database: Local JSON (with Supabase migration option)
- Engine: Phaser 3
- Language: JavaScript (ES6+)
- Real-Time: Socket.io Client
- Audio: Web Audio API
The game uses Socket.io for real-time multiplayer:
- โ Battle-tested and production-ready
- โ Automatic fallback to polling if WebSocket unavailable
- โ Excellent for turn-based games
- โ Handles 5000+ concurrent connections
Why not Colyseus? Socket.io is simpler and more than sufficient for this turn-based dice game. Colyseus adds complexity without benefits for our use case.
- Open
http://localhost:8080in two browser windows - Create lobby in window 1
- Join lobby in window 2
- Start game and play!
Connect from different devices on same network:
# Find your machine's IP
ipconfig # Windows
ifconfig # Mac/Linux
# Connect from remote device
http://<your-ip>:8080Monitor server status:
curl http://localhost:8080/healthExpected response:
{
"status": "healthy",
"timestamp": "2026-01-16T...",
"redis": "not connected",
"uptime": 12345
}Create server/.env file:
NODE_ENV=production
PORT=8080
CLIENT_ORIGINS=https://play.fivesdicegame.com
SESSION_SECRET=your-secret-key
DISCORD_CLIENT_ID=your-id
DISCORD_CLIENT_SECRET=your-secretSee server/.env.example for all options.
- Push to GitHub
- Import project to Vercel
- Set environment variables
- Configure custom domains
- Done! Auto-deploys on each push
- Connect GitHub
- Create App
- Configure environment
- Assign custom domain
- Deploy to VPS/Dedicated Server
- Use PM2 or systemd for process management
- Set up Nginx/Apache reverse proxy
- Configure SSL with Let's Encrypt
See DEPLOYMENT.md for detailed steps.
- Verify server is running
- Check port 8080 is accessible
- See DEVELOPMENT.md for debugging tips
- Ensure CLIENT_ORIGINS includes your domain
- Restart server after changing .env
- See SOCKET_IO_GUIDE.md for more details
- Server may be down
- Check browser console for errors
- Verify firewall allows connections
For more help, see SOCKET_IO_GUIDE.md.
- Server capacity: 5000+ concurrent players
- Message latency: < 100ms typical
- Network bandwidth: < 5KB/min per player
- Current game load: ~1-2 messages/second per player
See SOCKET_IO_GUIDE.md for optimization details.
This project is open source. See LICENSE for details.
Contributions welcome! Please feel free to submit Pull Requests.
- Mobile app version
- Tournament system
- Player profiles and statistics
- Spectator mode
- Voice chat integration
- Custom skins/themes
- ๐ Read DEVELOPMENT.md for local setup
- ๐ Read DEPLOYMENT.md for production
- ๐ง Read SOCKET_IO_GUIDE.md for troubleshooting
Made with โค๏ธ for dice game lovers everywhere!