botZilla : A Programming Challenge.

by Steve Baker

INTRODUCTION | SCREENSHOTS | ABOUT | RULES | FAQ | INTERNALS | DOWNLOADS | INSTALLING | KNOWN BUGS | PROJECT PAGE | MAILING LIST

The Internals of the City Simulator.

Grab the source tarball from the DOWNLOADS area:

    http://botzilla.sf.net/download.html

DEPENDANCIES

You'll need to download and install PLIB and have a working OpenGL on your machine - but those are the only dependancies.

The latest PLIB is at http://plib.sf.net - it should be at least v1.8.4.

INSTALLING FROM SOURCES:

Under Linux/UNIX, you can say:

      tar xzf zilla.tgz
      cd zilla
      ./reconf
      make

RUNNING:

You can run the program from the top level of the file tree:

    ./src/zilla

...or you can 'cd' into the 'src' directory and run it there:

    cd src
    ./zilla

...or you can run it from anywhere and set the ZILLA_DATADIR shell variable to point to where the top level of the zilla tree is.

     export ZILLA_DATADIR /home/zilla
     /home/zilla/src/zilla

...or you can do a 'make install' and then it'll run from wherever you installed it to.

DIRECTORY STRUCTURE:

There is a 'src' directory with all of the 'simulator' parts and a 'sample_robots' directory with all of my robot sources. The 'include' directory contains the 'zilla_interface.h' file that connects the bots and the simulator together.

Additionally:

HOW IT WORKS.

When you start the program, it looks in data/robots.dat to get the pathname and human-readable name for each robot. As currently set up, it reads three robots from the 'sample_robots' directory. One of them is written in C, another in C++ (both of them are VERY simple!) - the third one reads the joystick (if you have one) and lets you drive the robot interactively!

The joystick bot steers like a radio controlled car. Holding down any joystick button causes debug to spew from stdout. It should work with both analog and USB joysticks.

The automatic camera motion is working really quite well for such a horrible hack - but if you want, you can give keyboard focus to the graphic window and type a 'C' to give yourself control of the camera using a MICE-like numeric pad interface. Hit 'C' again to go back into automatic mode.

Hit 'P' to pause and un-pause the action. Note that you can take control of the camera with the game paused - which is handy for snapping screen shots.

Hit 'H' to hide and un-hide the status information...also useful for making screen shots.

Hit 'S' to toggle 'stereo' mode. Grab a pair of Red/Cyan glasses and enjoy the action in fully 3 dimensions!

Finally, there is no way to end the game right now - so use ^C to exit.

CODE STRUCTURE:

Hopefully, you shouldn't have to get into this - but just in case...

There is a 'main.cxx' that kicks everything off.

Everything else (pretty much) is written in a consistant style where there is a '.cxx' file with a matching '.h' for each major function in the code - typically with a public 'class' interface for each. Aside from that, there is a standard way everything tiest into the main program with an interface that is always an 'initXXX()' and an 'updateXXX()' with an optional 'drawXXX()' for each module. The initXXX and updateXXX calls are made from inside 'main' and the 'drawXXX' calls come from 'gfx.cxx' (which is where all the graphics are coordinated from).