https://github.com/mrtbk/shadow-code
๐ฎ A feature-rich chess game with Deep Reinforcement Learning (DRL) AI and real-time online multiplayer โ built with Python and Pygame.
https://github.com/mrtbk/shadow-code
ai chess deep-learning dqn game-development multiplayer pygame python reinforcement-learning socket-programming
Last synced: 5 months ago
JSON representation
๐ฎ A feature-rich chess game with Deep Reinforcement Learning (DRL) AI and real-time online multiplayer โ built with Python and Pygame.
- Host: GitHub
- URL: https://github.com/mrtbk/shadow-code
- Owner: MrTBK
- Created: 2025-04-29T18:31:55.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-30T22:27:17.000Z (about 1 year ago)
- Last Synced: 2025-06-04T17:51:23.062Z (about 1 year ago)
- Topics: ai, chess, deep-learning, dqn, game-development, multiplayer, pygame, python, reinforcement-learning, socket-programming
- Language: Python
- Homepage:
- Size: 12.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# โ๏ธ Shadow-Code
**Shadow-Code** is a feature-rich chess game that supports both local AI battles and online multiplayer. Play against a Deep Reinforcement Learning (DRL) agent trained from scratch or connect with friends over a real-time socket-based networkโall with an elegant Pygame-based interface and animated visuals.
---
## ๐ Features
- โ
**Local Play vs AI**
Play against a trained Deep Q-Network (DQN)-based DRL agent.
- ๐ **Online Multiplayer**
Host or join real-time matches using TCP sockets.
- ๐๏ธ **Smooth Animations**
Enjoy sliding piece animations for a polished experience.
- ๐ **Promotion Interface**
Promote pawns with a clean graphical selection.
- ๐ **Sound Effects**
Custom sounds for moves, captures, and promotions.
- ๐ **Move History Sidebar**
Track your game progress with a live move list.
---
## ๐ Installation
### 1. Clone the repository
```bash
git clone https://github.com/MrTBK/Shadow-Code.git
cd Shadow-Code
```
### 2. Install dependencies
Install the required packages via pip:
```bash
pip install -r requirements.txt
```
> **Note**: Requires Python 3.8+ and PyTorch.
---
## ๐ง Running the Game
To start the game:
```bash
python main.py
```
---
## ๐ฎ Modes of Play
### ๐งโ๐ป Local Play (vs DRL)
- Select **Local** from the menu.
- Play against a Deep Q-Learning agent trained on legal chess states.
### ๐ Online Multiplayer
#### Host a Game
- Select **Online** โ **Host**.
- Wait for an opponent to connect.
- Game starts automatically after connection.
#### Join a Game
- Select **Online** โ **Join**.
- Enter the IP address of the host machine.
- Connect and start playing.
---
## ๐ Project Structure
```
Shadow-Code/
โโโ assets/ # Piece images & sound files
โโโ dqn.py # DQN agent definition and utilities
โโโ game.py # Game logic and rendering
โโโ interface.py # UI handling (board, promotion UI, sounds)
โโโ server.py # Socket-based networking
โโโ main.py # Entry point
โโโ README.md
โโโ requirements.txt
```
---
## ๐ง DRL Agent Training
Our AI uses a Deep Q-Network with a flat board tensor input. Training code and logs are included in the project for reproducibility. If no `dqn_checkpoint.pt` exists, training can be resumed automatically.
---