Skip to content

a0w3b/MARIO_NEW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Super Mario Bros Reinforcement Learning Agent

This project implements a reinforcement learning agent that learns to play Super Mario Bros using Deep Q-Learning (DQN). The agent uses a Convolutional Neural Network (CNN) to process game states and make decisions.

Features

  • Deep Q-Learning implementation for game control
  • CNN-based state processing
  • Custom reward system for optimal gameplay
  • Automatic model saving and loading
  • GPU acceleration support with CUDA 12.4
  • Anti-freezing mechanism to prevent agent from getting stuck

Requirements

  • Python 3.8+
  • PyTorch with CUDA 12.4 support
  • Gym Super Mario Bros
  • NES-Py
  • NumPy
  • Pillow
  • NVIDIA GPU with CUDA 12.4 support

Installation

  1. Clone this repository
  2. Create environment
conda create -n mario-rl python=3.8
conda activate mario-rl
  1. Install PyTorch with CUDA 12.4 support:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
  1. Install the remaining required packages:
pip install -r requirements.txt

Usage

Run the training script:

python mario_main.py

The agent will:

  • Train for 100 episodes
  • Save the model after training
  • Display training statistics
  • Render the game during training

Model Architecture

The CNN model consists of:

  • 3 convolutional layers
  • 2 fully connected layers
  • ReLU activation functions
  • Output layer for action selection

Training Parameters

  • Learning rate: 0.0001
  • Batch size: 128
  • Gamma (discount factor): 0.99
  • Epsilon (exploration rate): 1.0 with decay
  • Freeze time limit: 60 frames

Hardware Requirements

  • NVIDIA GPU with CUDA 12.4 support
  • Minimum 8GB RAM
  • CUDA Toolkit 12.4 installed

License

This project is open source and available under the MIT License.

Author

AnssiO

About

This project implements a reinforcement learning agent that learns to play Super Mario Bros using Deep Q-Learning (DQN). The agent uses a Convolutional Neural Network (CNN) to process game states and make decisions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages