Zbot Wars


Zbotwars started as a series of self-study projects. With a background in embedded software/hardware I wanted more experience with the tools of desktop development and to see if Windows XP was a more stable development platform than Win98. It was not intended to be published and was originally called Robowars. (That name was already used on SourceForge so I came up with Zbotwars. However, the robo prefix shows up in the source.) The project just kind of grew rather than springing from any rigorous design. The current state of this project is 'alpha level'. A proof of concept set of software pieces that serve as a study from which to begin a rigorous, integrated design. Things compile and run without crashing or leaking memory. The emphasis is on theWindows XP version first as that is what my newest machine is running.

ZBotwars is a computer game, or toy,  in which teams of robots battle for survival in an arena. The Robots are governed by a simple assembly language. Robot programs can be written by humans or generated by the computer and 'evolved'. Various arenas running on different hosts can be connected over the internet, so that robots blundering into transporters can be sent from machine to machine. The robots can reproduce, with mutations and two parents providing the source code for the new robot.

The map/GUI display is optional, and can be run on a seperate machine from the robot instruction processing logic to make development of the game software easier. If the map display is not used the entire CPU will be running robot updates so tournaments and evolution happen quicker.

This can work as a tool for studying "software evolution" or genetic algorithms. This is the part I have become most interested in. The robot program files can be mutated and merged in various ways during the reproduction phase. There are two areas of investigation to look into: How to select the other parent, and how should the program code blending take place. Questions such as: What is the best mutation rate? What sort of crossover algorithm for selecting chunks of code from the parents? Will fixed or relative instructions predominate? Do NOP (No operation) instructions play an important role? What algorithm for selecting the parents produces the fastest improvement?

In the testing of the various evolution parameters data would be collected from participants in some central repository, via email for now but eventually through cgi scripts and a mySQL database on SourceForge.

The project can be run on Linux or Windows XP/NT (developed on Visual studio .NET) if the MS 7.0 version of the c run time dlls are present. MSVCR.DLL and MSCVP.DLL are included in the 1.1 release but I don't know if I should keep including them. With a slow modem uplinking every byte I can cut out of the process is a help so future versions may omit this.  The current release (1.1) is not identical on both platforms.

The linux version is behind in some areas since I have spent more and more time experimenting with the evolution aspects of the project. In particular, the OpenGL map font code has not been ported to Linux. So the status fields and button labels are blank (these can be seen on linux if python map is used.). Also a bug in the maya model reader shows up on two of three maya models. So right now all robot models have the same shape in the game view.

The core robot war code is written in C++ with utility/support programs written in Python. The project uses OpenGL, GLUT, Tkinter and Python Megawidgets for graphics and uses the Xerces xml processor. In some modes the program needs only simple terminal/console support. 


Installing: zbotwars is done by following the links for 'Download' on the zbot wars website, which lead to the sourceforge download site. There are two choices for download of the latest release (currently vers 1_1).

For windows there is a binary release, in the form of a zipped msi file. To use this, click the zbot_bin_1_1 file on the sourceforge download page. Next, unzip it on the machine it was downloaded to. Then click the Setup.exe program located in the unzipped directory set. This assumes the windows machine already has OPENGL installed (OPENGL32.DLL is needed)

For Linux there is a source release in the form a zipped up directory of source code files with a simple makefile. On the sourceforge download page select zbot_src_1_1. After downloading unzip the file and go to the zbot base directory. Run the make file found there. You may need to install the xerces xml libraries and header files (vers 2.1) and the open gl files. I used the mesa 3.1 download to get the gl and glut headers. 

The make process as downloaded looks for the xerces headerrs here:   /usr/include/xerces1_6
The make process as downloaded looks for the xerces shared library like this:  -lxerces

When make finishes there will be an executable file called zbotwar in the same directory the master makefile was in. Expect the make file to generate message about missing opengl features in the current version.


Zbotwars can be launched three different ways.

It can be run as a batch process (using BatchProcess.py), with results collected and emailed to a central repository.

ex1 . d:\mySoftware\zbotwars\pythonfiles python BatchProcess.py -l20 -fMutationRateCheck.xml

It can be run as a single round tournament from a GUI based configuration tool (RoboTourney.py)

It can be run as a single round by lauunching the exe file (zbotcore.exe) and passing in a configuration file name. If no file name is provided it will use the default configuration file- roboconfig.xml.

Note for Linux users- None of the python files have a 'bang' line at the top so they must be explicitly fed to python, as in example 1

Major Issues and Tasks:

fix MayaAscii reader weakspots

ScreenCapture for OpenGL map (maybe Python too)

Select robots by clicking on them in openGL as can be done with python arena.

It runs correctly as long as the inputs are correct, and there are no memory leaks. But, as a first release (alpha) there is little in the way of error detection/handling in the code and the system is fairly fragile.

I would like to replace the results format with an XML file. I would then like to have a cgi script running on sourceforge update a mysql database with results instead of the email to my account, then stick in an excel spreadsheet process currently in place.

Allow the evolution process to run and run, and have results taken periodically, a sample of a continously running population.

Dev Tools and Libraries:

Python 2.1, IDLE, windows and linux
PythonWin windows only
PMW(v1.0) both windows and linux
C++  - Visual Studio 7.0 Beta 2, gnu C++ (2.95),
Access97 (for Robot Assy tracing debugging) Excel97 for logging tournament results. Windows only
Xerces2-1 for C++ xml processing on Windows
OpenGL and GLUT for 3D graphics. On my system this was the mesa3.1 library.

To Download:

Download files page at sourceforge:

Additional elements needed are mentioned and links provided in DevTools and Libraries section of this page

Project Participants

Edward Zdankiewicz (aka Buddy), everything so far

Wally Gruczka, Beta tester and RPM developer.