diabolic6045/chess-vibe
0
3D Chess Game
A multiplayer 3D chess game built with Three.js, Socket.IO, and Express.js. Play chess with friends in a beautiful 3D environment.
Features
- Real-time multiplayer chess with 3D graphics
- Create or join games with unique game codes
- Full chess rule implementation including special moves (castling, en passant, promotion)
- Chat functionality for in-game communication
- Draw offers and resignation options
- Responsive design that works on desktop and mobile
- Secure communication with XSS protection and CSRF prevention
- Fallback 2D board for browsers without WebGL support
Technologies Used
- Frontend:
- Three.js for 3D rendering
- Socket.IO client for real-time communication
- Vanilla JavaScript for game logic
- CSS3 for styling
- Backend:
- Node.js with Express.js
- Socket.IO for WebSocket communication
- In-memory game state management
Getting Started
Prerequisites
- Node.js (v14 or higher)
- npm (v6 or higher)
Installation
- Clone the repository:
git clone https://github.com/yourusername/3d-chess-game.git
cd 3d-chess-game- Install dependencies:
npm install- Start the server:
npm startOr use the debug mode for more detailed logs:
start-debug.bat- Open your browser and navigate to:
http://localhost:3000How to Play
- Create a Game:
- Enter your name
- Click "Create New Game"
- Share the generated game code with your opponent
- Join a Game:
- Enter your name
- Click "Join Game"
- Enter the game code provided by the game creator
- Click "Join"
- Playing the Game:
- White moves first
- Click on a piece to select it
- Valid moves will be highlighted
- Click on a highlighted square to move
- Use the chat to communicate with your opponent
- Offer a draw or resign if needed
Troubleshooting
If you encounter any issues:
- Connection Problems:
- Make sure the server is running
- Check your browser console for error messages
- Try using the debug mode:
start-debug.bat
- 3D Rendering Issues:
- The game will automatically fall back to a 2D board if your browser doesn't support WebGL
- Make sure your browser is up to date
- Check if WebGL is enabled in your browser settings
- Game Not Progressing:
- Check the server console for any error messages
- Make sure both players have joined the game
- Try refreshing the page and rejoining the game
Game Rules
The game follows standard chess rules:
- Each piece moves according to its traditional movement pattern
- Special moves like castling, en passant, and pawn promotion are supported
- Check, checkmate, and stalemate are detected automatically
- The game ends when a player is checkmated, resigns, or when a draw occurs
Security Features
- XSS protection for chat messages
- CSRF protection for API requests
- Clickjacking prevention
- WebGL support detection
- Secure game code generation
- Input validation and sanitization
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Three.js for the 3D rendering library
- Socket.IO for real-time communication
- Express.js for the web server framework
