A reinforcement learning environment implementing the classic Pong game using Pygame and Gymnasium. The environment includes both a playable version and training capabilities using Stable Baselines 3.
- Custom Gymnasium environment for Pong
- Human playable mode with keyboard controls
- AI training using PPO (Proximal Policy Optimization)
- Real-time visualization of training progress
- Configurable game parameters (speed, size, colors)
- Visual effects (shadows, smooth animations)
Run the play script to play against the hardcoded AI:
python scripts/play.py
Controls:
- Up Arrow: Move paddle up
- Down Arrow: Move paddle down
- ESC: Quit game
To train a new agent:
python scripts/train.py
The training script will:
- Create a new run directory in
logs/
- Save the best model during training
- Log metrics to TensorBoard
- Display periodic evaluation episodes
To evaluate a trained model:
python scripts/eval.py
For development, install additional dependencies:
pip install -r requirements-dev.txt
- Built with Pygame
- RL implementation using Stable Baselines3
- Environment interface with Gymnasium