A complete chess game implementation using PyGame, with both local and online multiplayer support.
- Complete chess rules implementation:
- Standard piece movements
- Castling (kingside and queenside)
- En passant captures
- Pawn promotion
- Check, checkmate, and stalemate detection
- Graphical user interface:
- Piece highlighting
- Move animations
- Valid move highlighting
- Last move indication
- Evaluation bar showing material advantage
- Game controls:
- 'z' key to undo moves
- 'r' key to reset the game
- 'q' key to quit
- Online multiplayer:
- Server-client architecture
- Create or join games
- Spectator mode
- Turn-based gameplay
- Run the game with:
python ChessMain.py - Click on a piece to select it
- Click on a valid destination square to move the piece
- For pawn promotion, select the desired promotion piece from the menu
- The game will automatically detect checkmate and stalemate
- Install the required dependencies:
pip install -r requirements.txt - Run the server:
python ChessServer.py - The server will start on the specified IP address and port (default: 5000)
- Run the client:
python ChessClient.py - Enter the server URL when prompted (e.g., http://136.47.134.71:5000)
- Choose to create a new game or join an existing game
- If creating a game, share the game ID with your opponent
- If joining a game, enter the game ID provided by the host
- Play the game following the same controls as the local version
The game is structured with:
ChessEngine.py: Game logic, board representation, move validationChessMain.py: UI handling with pygame for local playChessServer.py: Socket.IO server for online multiplayerChessClient.py: Socket.IO client for online multiplayerimages/: Piece images for visualization
- Python 3.x
- PyGame library
- Python-SocketIO
- Eventlet (for server)
Install all dependencies with: pip install -r requirements.txt