Monday, February 21, 2011

BZFlag Robots

It was a holiday today so I goofed off playing solo matches on BZFlag. I enjoy the game but I stink at it, so I need to practice regularly. It's embarrassing that I get my butt kicked by the crappy robots in the solo game.

Between games I poked around the web and stumbled upon a Python version of the bzfquery.pl tool, a command line utility that displays information about the server, teams, and players. bzfquery.py is included in the BZFlag source but the Debian package only includes the Perl version.

bzfquery.py has a couple of improvements. First, it prints the correct content type if it detects that it was called via CGI. Handy if you need a quick and dirty way to display the server status as a web page. Second, bzfquery.py cab be used as a module by other Python programs, enabling them to communicate with the server without dealing with the protocol directly. While the module is very useful for getting basic information such as the player scores, the module doesn't include code for more complex tasks like writing a robot tank in Python.

But wait! There's more! BZFlag 3.0 will have a proper robot API and Python will be one of the supported languages. I think I'll write a robot that plays worse than I do!

No comments:

Post a Comment