[OpenAI Retro Contest] Getting Started

Dean Kayton
2 min readApr 7, 2018

--

Waking up inspired after attending Deep Learning Indabaš¯•¸WesternCape, I decided it was time to shake off the symptoms of Imposter Syndrome and thrust myself into the depths of a new challenge. Luckily my timing was pretty good for OpenAIā€™s Retro Contest. So I got out of bed, prepared a cup of coffee and got to work!

The events that follow didnā€™t necessarily happen in the order I describe. I went round in circles a lot, misunderstood a bunch of things, re-evaluated my approach numerous times. But what follows is how I would do it if I started over. Hopefully it can save some time for anyone who might read this.

After reading for a couple of hours and 12 open tabs later[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] I decided it was time to fork the retro-contest repo and get started. I am not sure, but from what I understand code should only be shared once the competition is over. So I aim to only commit locally without pushing to remote until the time is right. Here is the location of my fork. Since it is not possible to make a fork of a public github repository private, this solution might not be ideal for a team. Potentially I might follow these instructions down the line if the team grows.

What follows is a summary of steps I performed to get started (which assume a Linux environment, and are mostly adapted from the contest details):

  • Navigate to your source directory (Substitute as appropriate): cd ~/src/personal
  • Clone the gym-retro repo: git clone --recursive https://github.com/openai/retro.git gym-retro
  • Clone your fork of retro-contest if you made one (or if you prefer, clone straight from the original retro-contest repo): git clone --recursive git@github.com:[openai|your-user]/retro-contest.git
  • Create a virtual environment:python3.6 -m venv retro-contest/venv
  • Activate the virtual environment: . retro-contest/venv/bin/activate
  • Make sure virtual environmentā€™s pip is up to date:pip install -U pip
  • Ensure you have CMake installed: sudo apt-get update && sudo apt-get install cmake (On Debian/Ubuntu)
  • Install the gym-retro package:pip install -e gym-retro
  • Install the environment wrappers to set things up in the official way: pip install -e "retro-contest/support[docker]" (TODO: work out what the [docker] part is doing here)
  • Move your version of Sonic the Hedge Hog to an appropriate folder and ensure that your Sonic the Hedge Hog rom has the correct hash: sha1sum retro-contest/roms/SonicTheHedgehog-Genesis.md It should have a hash equal to: 69e102855d4389c3fd1a8f3dc7d193f8eee5fe5b
  • Import the game into retro: python -m retro.import retro-contest/roms
  • Experiment with the code examples (open a python shell) starting from section, Use With Gym
  • Locate and run the example random agent script. I found it a bit complicated so wrote a more simple and readable version:
  • Read the rest of the documentation of retro git repo readme
  • You are ready to follow the contest details. You can skip the details about importing roms for now since you already have Sonic the Hedgehog imported, but follow the instructions if you are ready to import the other roms

--

--