Skip to content

Repository files navigation

AI Platformer Prodigy

A reinforcement learning framework for training AI agents to play Super Mario Bros

Python PyTorch Jupyter License: MIT


Overview

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.


Features

  • Advanced RL Algorithms — Implements PPO and DQN for optimal agent performance
  • Realistic Simulation — Full game environment via gym_super_mario_bros for 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

Tech Stack

Python PyTorch NumPy Pandas Jupyter TensorBoard


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

Project Structure

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

Getting Started

Prerequisites

  • Python 3.8+
  • CUDA-compatible GPU (recommended for training)
  • Jupyter Notebook

Installation

  1. Clone the repository

    git clone https://github.com/silentwraith03/ai-platformer-prodigy.git
    cd AI-Platformer-Prodigy
  2. Install core dependencies

    pip install -r requirements.txt
  3. Install the Mario environment

    pip install gym_super_mario_bros==7.3.0 nes_py
  4. 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
  5. Install Stable Baselines3

    pip install stable-baselines3[extra]
  6. Install Jupyter (skip if already installed)

    pip install jupyter

Usage

Running the Notebooks

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

Monitoring Training

Track rewards, loss, and other metrics in real time using TensorBoard:

cd logs/PPO
tensorboard --logdir=.

Then open http://localhost:6006 in your browser.


Screenshots


Demo


License

Distributed under the MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages