Skip to content

Reinforcement Learning to play Pokémon Red

License

Notifications You must be signed in to change notification settings

orge-dev/pokenail

 
 

Repository files navigation

A simple Q learning implementation learning how to play Pokémon Red.

Work in progress.

Setup Environment

pip install . && pip install '.[dev]'

Generate Training Data

Run

python main.py --processes 0 --headless

to run headless, with processes = num cpus, and saving replay data (see env.replay_buffer) to the replays folder.

See main.py for other CLI arguments.

Train (and run) a Q model

python main.py --train_from_replays

Trains from the replay of all replays in the replay folder, sampled randomly. See ai_agent.train_from_replays. It will then print out the filename containing the Q table of the model. Finally, it will run the agent with the Q table and an exploration rate of 20%

Running

Running train_from_replays will generate a pkl file for the resulting Q state. Load that file to have the AI agent play:

python main.py --agent <agent_state_file>

Manual mode

python main.py --manual

Visualizing results

viz_rewards.py will visualize the rewards on each tile integrated over all replays in the replays folder

utils.py can be used to quickly see summary stats, and can also visually debug individual episodes with the –viz option

About

Reinforcement Learning to play Pokémon Red

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%