BZRC: BZFlag Remote Control

Overview

BZRC is a framework for incorporating BZFlag in an Introduction to Artificial Intelligence course. Students use a simple programming interface to write an agent that can compete in a game of capture the flag against a variety of opponents. The agent controls a team of bots that deals with real-life challenges including obstacles, opponents, and noisy observations. Through the course of the semester, students implement AI techniques such as potential fields, PD controllers, searching, Kalman filters, and planning. At the end of the term, students can show off their code and participate in healthy competition with a class tournament. They can even try to show their own intelligence in a human vs. bot match.

The BYU CS Department began using BZFlag for CS 470 (Intro to AI) in 2003. The API was effective, but several problems eventually arose. The most serious was that it was difficult to merge in changes from the main BZFlag project, and the CS 470 codebase eventually became a maintenance headache. In Summer 2006, the system was redesigned with the following goals:

Maintainability
To the degree possible, changes should be submitted upstream to the BZFlag project. Collaboration is good for the BYU CS Department because of bug fixes in BZFlag code, and it is good for the BZFlag team because it widens the scope of the project. (Tim Riker, the BZFlag maintainer, is excited about CS 470.) Patches should be well-designed so that BZFlag developers will feel comfortable accepting them. BZRC features that are obviously undesirable in BZFlag should be redisigned to be unobjectionable or should be kept in agent code, away from BZFlag.
Simplicity
The interface should be simple and well-documented. Students should be able to jump right in without reading BZFlag code. Error messages should be straightforward to ease debugging. Student bugs should not be able to cause problems in the rest of the game.
Flexibility
Teachers should be able to customize behavior. For example, one professor prefers to use hovertank-style motion and freeze tag instead of shooting. This should be easily configurable. Students should not be constrained to use any particular language or platform. Agents written in Python, C++, Java, Ruby, Scheme, or Prolog should be easy to write. There's a blue ribbon waiting for the first person to write an agent in Intercal.

To clarify the basic design of the BZRC environment, consider a typical match between two teams. The following programs will be run:

BZFS
The BZFlag server is started up with a world map and set of game rules. This is an unmodified BZFlag program to which any BZFlag client can connect.
Observer (BZFlag Client)
One or more BZFlag clients connect in observer mode. An observer can watch game play from anywhere in the world, including from the view of any of the tanks. This is an unmodified BZFlag program.
BZRobots (BZFlag Client)
A modified BZFlag client program, called bzrobots, is started. This is identical to a normal BZFlag client except 1) it runs in command-line mode, and 2) it listens on a port for a connection from the remote agent. The bzrobots client connects to the server and registers a team of tanks. It controls these tanks as directed by the agent. Students do not modify anything in bzrobots--they only write the agent that tells it what to do.
Remote Agent
A remote agent connects to bzrobots using a TCP connection and a simple text protocol. If so desired, a human can start a telnet session and control the robots. The protocol allows an agent to make observations about the world and to give commands like turn and shoot. A remote agent can be written in any language with a TCP library or a low-level I/O library.

Further Information

Students and those interested in writing agents in the BZRC environment should peruse the Student Resources. TAs, BZFlag developers, and others interested in the BZRC implementation should visit the BZRC Internals and Development page.

This site is under construction. Thank you for your patience. If you have any comments or suggestions please email Andrew McNabb <amcnabb _a_t_ cs.byu.edu>.