Battle Field File Format

The battle field is described in a plain text file (field.bfld) on the server.

Only the server will parse the file; the data is sent pre-parsed to all clients.



Statements consist of a keyword followed by parameters and ended with a semicolon. Between the keywords and parameters must be whitespace (spaces, tabs, line breaks) and nothing else.


block x y w h;
Defines an impassible obstacle on the field.
x The obstacle's upper left x coordinate.
y The obstacle's upper left y coordinate.
w The width of the obstacle.
h The height of the obstacle.


flip type;
Configures simple coordinate transforms for this stack frame. The transforms are inherited. For the horizontal and vertical flip to work correctly, size should be specified. More than one transform can be used simultaneously, but only one can be specified with each use of flip.
type The type of transform. Valid options are:
  • none -- Disables any already set transform.
  • trans -- Transposes the vertical and horizontal components.
  • horiz -- Horizontal flip
  • vert -- Vertcal flip


goal team x y w h;
Defines the goal spot where a team's flag starts and where that team must bring the opposing team's flag to score. The initial flag position will be in the center of the goal. For games that are not capture the flag, this statement will be ignored.
team The color of the owning team. Valid options are:
  • Blue
  • Red
x The goal's upper left x coordinate.
y The goal's upper left y coordinate.
w The width of the goal.
h The height of the goal.


include fname;
Causes another file to be read almost as if its contents were inserted where the include statement is located. Size statements in any included files are ignored. Included files may include other files, but recursively including the same file is not allowed.

The path used to find the file is the program's working directory unless a path is given in the name. In the future this will be changed to search the following paths, in order:

  1. Somewhere in the user's home directory. On Windows, somewhere in the user's application data directory will be used.
  2. The program's working directory.
  3. The directory where the program binary resides, or one under it.

fname The file name to include. Some file systems have case sensitive file names. This includes most file systems native to Unix-like systems. To ensure proper operation on all operating systems, assume names are case sensitive. Also, use the slash ('/') as the directory separator.
Do not use a backslash ('\') as the directory separator, even on Windows. It prevents cross platform compatibility. Win32 accepts slashes; slashes are supported by almost all modern operating systems.


offset x y;
Modifies the coordinates of all following statements by adding the given values to the x and y coordinates. This is intended to allow items in a file to be resued by specifiying a different location. Offsets do not accumulate in a file; specifying an offset of 0,0 will remove any previous offset in that file. An offset specified prior to including a file will modify all coordinates, including offsets, in that file.
x The offset for x coordinates.
y The offset for y coordinates.


size w h;
Defines the width and height of the battle field. The first size statement specifies the size of the entire field. Subsequent size statements are used to provide a localized size, maintained on the stack frame, that is used to support horizontal and vertical flipping.
w The width of the field. The value must not exceed 2047 and must be greater than 31.
h The height of the field. The value must not exceed 2047 and must be greater than 31.


spawn team x y w h;
Defines a spawn area. Each spawn area is owned by a team and only members of that team may spwan there. The areas are not visible in the game.
team The color of the owning team. Valid options are:
  • Blue
  • Red
x The spawn area's upper left x coordinate.
y The spawn area's upper left y coordinate.
w The width of the area.
h The height of the area.


# An example of the battlefield file format
size 512 512  # This is a 512x512 sized field. It is not in pixels.

# setup goal locations
goal blue 496 248 16 16; goal red 0 248 16 16;

# some spawn points
spawn red 0 216 16 16; spawn blue 496 216 16 16;
spawn red 0 280 16 16; spawn blue 496 280 16 16;

# some obstacles
block  48 216 8 80;
block 464 216 8 80;

# position stuff that will come later in this file
offset 192 192;

# load stuff from a file with 128x128 size and put it in the center
include cntblocks;

Generated on Mon May 28 04:41:40 2007 for Retro Tank Super Attack by  doxygen 1.5.2