The Tag Game Commentator was a project for two classes taken during Fall 2008, with a submission to the undergraduate Game AI class (CMPS 145) and the graduate class in generative programming (CMPS 2890G). For my class project, I implemented a commentator in Python, which has a
proposal you can read.
Introduction
The commentator is based on
Tag Game and makes relevant comments on the game action, implemented using aspect-oriented programming.
What it does
The commentator comments on tags, and evaluates each character's speed in order to decide whether to choose a saying randomly a list of lines where:
- Both characters are moving quickly
- Both characters are moving slowly
- The tagger is moving significantly faster than the newly tagged
- The tagger is moving significantly slower than the newly tagged
It then chooses a line of
color commentary, which can be about whether one of the characters is moving significantly faster or slower than their average speed, or how many tags have occurred between the two competitors. In order to make these comments, the commentator stores information in a database so that the statistics can be drawn from several play sessions.
The commentator keeps up with the gameplay by using a two-slot first-in-first-out buffer, with new lines pushing out old ones that were queued to be spoken. This creates the illusion of relevance, without any decision-making or prioritizing needing to be made.
Aspect-Oriented Programming
This project is also a novel application of aspect-oriented programming to video games. To my knowledge, there is no prior work implementing a commentator using AOP. If you arrived here via Google, then the quick answer is "yes, this does work." I would recommend trying it out, commentary is a code tangling issue which AOP is well-suited to solving. You can
read the paper in PDF format.
Download
The code can be
downloaded from GitHub. There is also a nasty bug preventing the program from exiting cleanly; I can't seem to stop the speech thread executing, despite trying lots of different code snippets. You'll need to use Ctrl+C to exit (yes, I know how bad this is).