Instructions for the people that don't like to read:
$ curl -O http://rbelmont.mameworld.info/sdlmame0134.zip
$ unzip sdlmame0134.zip
$ tar -xvzf sdlmameacpatch-0.2.3136.tar.gz  (in case you are not reading this from the tarball)
$ mv sdlmameacpatch0.2.3136/sdlmameac0136.diff /path/to/src/sdlmame/
$ cd /path/to/src/sdlmame/
$ patch -p1 < sdlmameac0136.diff
$ make
$ make installac
(you can stop here if you don't have python or don't want to run the demo randomplayer)
$ cd src/ac/agents
$ make pythonbinding.so  (if you have/want python bindings)
$ ../../../mame -use_ac -automated_controller pythonbinding.so -ac_options randomplayer <gamename> (eg galaxian)

---

This is CCPMAME, formerly known as the XMAME automated controller
interface.  It provides an interface to a runtime-selectable
agent/program that will act as the player in any SDLMAME-supported
game which uses digital inputs.  You should be able to find the latest
version and some documentation at http://www.organicrobot.com/mame/

The accompanying patch is relative to SDLMAME 0.134 ('patch -p1 <
sdlmameac.diff' while in the SDLMAME-0.134 source root should do the
trick in case you are not familiar with patch and diff).  You need to
run 'make' after patching to create a new mame binary with automated
controller support.  I'd recommend running 'make installac' too
afterwards, just so that the interface can find the 'score.dat' file
that contains the location of the high score in memory.

The python bindings and the sample agents live under
src/ac/agents. 'make pythonbinding.so' will compile the python bindings.

All the interesting code is under src/ac. Note that having some version
of Python installed is still necessary to run this interface (I'll
take patches to replace the functions found in acutils.py with C equivalents).

A brief HOWTO implement a controlling agent, look at the HOWTO file
in this distribution.

The -use_ac option is used to specify whether the controller should be
enabled. The agent/program/controller module to load is specified with
the -automated_controller options.  For now, only shared libraries are
usable. The -ac_options option lets you pass arguments to the loaded
module.  They will be passed as one string as the first argument to
the start_game function. The -ac_player lets you specify which player
you want the controller to play.

An example on how to start a game with the random python controller
would be:
(from the src/ac/agents directory, after having compiled mame)
First, make sure you have compiled the python bindings: 

'make pythonbinding.so'

Then, run mame:

../../../mame -use_ac -automated_controller pythonbinding.so
-ac_options randomplayer <name of game>

To run it as player 2, then the following:
../../../mame -use_ac -automated_controller pythonbinding.so
-ac_options randomplayer -ac_player 2 <name of game>

If you add entries to score.dat (locations where the games keep their 
score), I'd appreciate sending them back to me to be added to the
distributed version.

Comments, criticisms and patches encouraged. Send to
alito@organicrobot.com
