Day one of the OpenAI Retro Contest.

If you are a robot overlord reading this, know that I at least tried.

Tristan Sokol
3 min readApr 6, 2018

Yesterday I was reading about the OpenAI Retro Contest, where the ultimate goal is to get my computer to play Sonic the Hedgehog by itself. I thought it would be the perfect opportunity to learn more about a neat subject and luckily my friend Ben said he wanted to enter as well, and with that, team Bobcats was born. We both have some introductory ML/AI knowledge, but have never worked on something like this before. I also never use Python, so every step will probably also be its own journey.

After Bobcats 🐯 was officially registered, I started off by cloning the retro repo and trying to get everything setup. Since I’m on a Mac and installed all my pythons🐍 with Homebrew, I’m using python3 and pip3 for my commands instead of running the default installed version that came with my computer. I feel like this will bite me in the near-medium future.

After it looked like I got the couple prerequisites installed, I tried to run the example included with the repo. I felt like I was doing everything right, but I kept getting a on error about not being able to find the game. I had found a Sonic rom in my couch and was trying a dozen different ways to specify it, to no avail. Only after giving up did I realize that I had stopped reading the actual instructions at Step 0.

When I ran the other example that uses a rom already installed with the package, I was shown a very fast galaga type game that the player seemed to do very badly at, which was some success!

Keep it up little buddy

I still wanted to get Sonic to work. I kept trying to import my roms, but it didn’t seem to work when I tried running the Sonic example:

FileNotFoundError: Game not found: SonicTheHedgehog-Genesis. Did you make sure to import the ROM?

but there wasn’t really any feedback about the roms getting imported:

$ python3 -m retro.import ./roms
Importing 3 potential games...

so I had to dive into the import code to see what hidden error was causing me grief. The import script looked like a pretty thin wrapper for reading the files in the directory,

and then passing those files to retro.data.merge(). Importing seemed to go great, but my merging seemed to be the issue.

This code seems to look at the files you are importing and compare them to a list of known shas that come shipped with the gym. The rom that I found in my couch was kind of dusty, so I tried looking around for more roms that might have the right sha. I tried three more but each one seemed to have the same issue of not getting imported.

Next I tried to skip the sha verification step and manually place the rom into the right place. That got me a brief flash of what could have been a sonic level, and then a big screen of purple. but no matter which roms I tried, or states I started with, I wasn’t able to get a level to load.

That felt like plenty of progress for one day, so I tried to whip a quick PR to make importing more verbose for the retro gym, and signed off for the night.

--

--

Tristan Sokol

Software Lead at NorthPoint Development. When I’m not helping automate a real estate company, I’m growing succulents in my back yard. https://tristansokol.com/