In fall 2010, I took CS188, Berkeley's introductory AI class. One of the more fun projects was a class-wide contest where we wrote AI for a Pacman-themed 2v2 capture-the-flag tournament. Each team's bots played against each other in a nightly round-robin tournament, playing to the best out of 9 rounds. With so many matches being played every night, it was tedious to download each replay and feed it into the standard Python replay viewer.
To satisfy my need for bot-vs-bot action, I wrote a simple server that
retrieved the replay files (stored as Python
pickle
files) and translated the replays into JSON.
The server would also retrieve the offical replay index page and render a
new version with the links pointing to the viewer instead.
I could then click on any replay and view it in the browser, where javascript
would read the replay history and render it into a <canvas>
element,
frame by frame.
I eventually wrote my own pickle
implementation in javascript
to make a fully standalone viewer, like the demo embedded below.
The standalone viewer was eventually integrated into the official contest from spring 2011 onwards.