AI Learns to Beat Levels in Super Mario Bros
Chris Wilkerson
Unknown
- 0 Collaborators
Using a genetic algorithm and neural network, an AI is able to learn to beat different levels in Super Mario Bros. ...learn more
Project status: Published/In Market
Overview / Usage
Can an AI learn to play different levels in Super Mario Bros?
Methodology / Approach
First it's important to think of what tools you want to use. For this I wanted to use a neural network that took in information of Mario's surroundings and determine which button(s) to press. I didn't want to use raw pixel values so I decided to use memory editing techniques to determine which 16x16 pixel block was represented. Because this is an 8-bit game, there are 256 blocks that could be represented. I chose to categorize them as either: safe, unsafe, or empty. I didn't want to use a one-hot encoding to determine the weights so I instead used values of -1, 0, or 1 to represent the type of block.
From here I created a population of Mario's using a genetic algorithm to support crossover, selection, and mutation. Early generations can perform quite bad as there is no knowledge of the environment. As the AI's learn, faster and faster progress can be made. Because some of the information can generalize across levels, these AI's can be used as a starting population for different levels. This decreases the number of generations needed to solve future levels.
Technologies Used
Python3.6+, OpenAI gym (for NES emulation), numpy, and PyQt