Multi Arcade Emulator (MAME) Gym


Has anyone had a go at trying to get a MAME environment up and running? It would open up a LOT of games.

I for one want to play an AI in Street Fighter 2 which I wasted far too much of my childhood playing.

If the underlying driver in MAME supports it the current state can be saved and restored so skipping levels etc for training without having to try and train the AI to navigate menus etc.

I’m just getting started with OpenAI so not there yet but if I stick with it I’m sure I can get there eventually but any prior work would help a lot.


Yes, I have. I’ve been a bit busy for the last couple of months to tidy it all up properly and submit a pull request, and also PyPI doesn’t take packages over 60MB which makes the installation a bit more cumbersome (or maybe installing from GitHub will have to do).

I am planning to submit a pull request during the next week or two. I only have 5 games properly working for now, but getting more should be quite quick.

Here’s the relevant gym branch:

For now, you might have to pip install from here directly:



That’s great! I tried doing a git clone on mamele_pippable and then running:

pip install -e .

It ran very quickly and then I tried running the example but it’s obvious I haven’t installed your modified mame.

If I clone this repo:

Then run pip install -e .[mame] and also it’s very quick but I’m expecting it to start compiling the custom mame. Of course it doesn’t work when running your random example.

Any pointers? I’m clearly missing something but I can’t see the mame code anywhere so a bit confused.


For the git clone route, you need to do a

git clone --recursive

since mamele_pippable is an attempt at a pip-friendly version of mamele (ie ), and it just points to that as a submodule.

Doing a direct:

pip install -v git+

should also work and is easier.

Whichever way you go, use the -v option for pip because pip swallows all output otherwise, and there might be some important output (compilation errors, etc) and a note about where to put or link the roms (basically: ~/.le/roms)

I should really just get this nicely packaged up and well documented, sorry. Half of the issue is fighting with pip and PyPI to get them to do what one wants.


I’m not having much luck with compiling MAME but it seems to be a Mac thing. I’ll try on a Linux box when I get some spare time but I’m still quietly excited.

Thanks for sharing and I’ll post updates and feedback when I can.