/NES.jl

A NES emulator and collection of environments in Julia for RL

Primary LanguageJuliaMIT LicenseMIT

NES.jl

Build Status

This is a simple NES emulator for the Julia programming language, based on the nes-py emulator. The emulator has been augmented to serve as a training environment for reinforcement learning experimentation and projects.

Installation

NOTE- NES.jl currently requires SCons and clang for building on Linux/macOS. So ensure that these dependencies are properly installed before you proceed with the actual install.

Once you have installed the SCons and clang, open Julia REPL and enter the following commands

julia> using Pkg

julia> Pkg.add("https://github.com/kraftpunk97/NES.jl")

Demo

NES.jl can currently render only in the plot pane of Juno IDE. Other methods will be added later.

using NES

environment_type = "smb"
action_type = :RIGHT_ONLY
env = SMBEnv(environment_type, action_type)
current_state = reset!(env)
done = false
actions = [env.action_map |> keys |> rand for _=1:400]

for action  actions
	global done, current_state
	current_state, reward, done, info = step!(env, action)
	render(env) |> display
	sleep(0.001)
	done && break
end

Environments

Environment Screenshot
smb
smbdownsample
smbpixel
smbrectangle
smb2
smb2downsample

Action Spaces

  • :RIGHT_ONLY (5 distinct actions)
    • NOOP
    • Right
    • Right, A
    • Right, B
    • Right, A, B
  • :SIMPLE_MOVEMENT (7 distinct actions)
    • NOOP
    • Right
    • Right, A
    • Right, B
    • Right, A, B
    • A
    • Left
  • :COMPLEX_MOVEMENT (12 distinct actions)
    • NOOP
    • Right
    • Right, A
    • Right, B
    • Right, A, B
    • A
    • Left
    • Left, A
    • Left, B
    • Left, A, B
    • Down
    • Up

RoadMap

  • NES Emulator
  • Super Mario Bros and Super Mario Bros 2 environments
  • Tetris environment
  • Integrate with Gym.jl