A reinforcement learning framework for training AI agents to play Super Mario Bros
AI Platformer Prodigy is a sophisticated AI training framework built for Super Mario Bros, leveraging reinforcement learning techniques to create, train, and evaluate intelligent agents within a dynamic game environment. The project uses state-of-the-art algorithms like PPO and DQN, combined with preprocessing pipelines to significantly optimize training efficiency.
- Advanced RL Algorithms — Implements PPO and DQN for optimal agent performance
- Realistic Simulation — Full game environment via
gym_super_mario_brosfor comprehensive training - Optimized Preprocessing — Frame stacking and grayscaling to reduce training duration
- Performance Monitoring — Integrated TensorBoard logging for real-time training visualization
- Modular Notebooks — Separate notebooks for training from scratch and incremental training
| Layer | Tools |
|---|---|
| Simulation Environment | OpenAI Gym, gym_super_mario_bros, nes_py |
| Reinforcement Learning | stable-baselines3 (PPO, DQN) |
| Deep Learning | PyTorch, torchvision, torchaudio |
| Visualization | Matplotlib, Pygame, TensorBoard |
| Data Handling | NumPy, Pandas |
AI-Platformer-Prodigy/
├── images/
│ ├── sc1.png # Training screenshot 1
│ ├── sc2.png # Training screenshot 2
│ └── sc3.gif # Demo gameplay GIF
├── MarioTrainingFromScratch.ipynb # Train an agent from a clean slate
├── MarioAIIncrementalTraining.ipynb # Continue training from a checkpoint
├── logs/
│ └── PPO/ # TensorBoard training logs
├── .python-version
├── .gitignore
├── LICENSE
├── requirements.txt
└── Readme.md
- Python 3.8+
- CUDA-compatible GPU (recommended for training)
- Jupyter Notebook
-
Clone the repository
git clone https://github.com/silentwraith03/ai-platformer-prodigy.git cd AI-Platformer-Prodigy -
Install core dependencies
pip install -r requirements.txt
-
Install the Mario environment
pip install gym_super_mario_bros==7.3.0 nes_py
-
Install PyTorch with CUDA support
pip install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1+cu113 \ -f https://download.pytorch.org/whl/cu113/torch_stable.html
-
Install Stable Baselines3
pip install stable-baselines3[extra]
-
Install Jupyter (skip if already installed)
pip install jupyter
Launch Jupyter and open either notebook based on your use case:
jupyter notebook| Notebook | Purpose |
|---|---|
MarioTrainingFromScratch.ipynb |
Train an agent from a clean slate |
MarioAIIncrementalTraining.ipynb |
Continue training from a saved checkpoint |
Track rewards, loss, and other metrics in real time using TensorBoard:
cd logs/PPO
tensorboard --logdir=.Then open http://localhost:6006 in your browser.
Distributed under the MIT License. See LICENSE for details.


