Skip to content

omardelarosa/nes-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nintendo AI

Generic Open AI Gym Agents, wrappers and tools for Nintendo/Famicom ROMs.

BYOR (Bring your own roms)

Installation Requirements

Both of these libraries must be installed.

OpenAI Gym

nes-py

It's recommended that they are cloned as repositories and installed from git repos using:

python -e .

This allows for extensibility.

Install script

mkdir nes-ai-root
cd nes-ai-root

git clone https://github.com/openai/gym.git
cd gym
pip3 install -e .
cd ..

git clone https://github.com/Kautenja/nes-py.git
cd nes-py
pip3 install -e 
cd ..

git clone https://github.com/omardelarosa/nes-ai.git
cd nes-ai
pip3 install -r requirements.txt

Usage

To run any with human keyboard control agent, run:

python . -a RandomAgent --mode human --rom roms/rom.nes

To use the random sample agent

python . -a RandomAgent--mode random --rom roms/rom.nes

Adding Agents

To add an agent:

  1. create a file in the agents directory using the naming convention AgentName.py.

  2. The file must implement and export a class matching this signature:

class AgentName():
    def __init__(self, args)
        # do stuff here
  1. Register your class in agents/__init__.py as follows:
from . import AgentName

__all__ = [
    'AgentName'
]

Fixing ROMs

Some ROMs require header corrections. Please see tools/ directory for instructions on fixing your ROM files.

Contribution

  1. Create a feature branch
  2. Complete changes
  3. Open a PR against master branch
  4. Merge PR.