Some information on WinBolo's design is below. This is a work in progress.
WinBolo code is split in two sections, a back end and a front end.
The back end contains simulation and game logic. It is designed to be 100% ANSI C compliant and to work on multiple platforms. - Currently is it not 100% complaint due to the network.c file (has some front end functions that should be moved to callbacks) and to some C++ style (//) comments. The front end contains any platform specific code.
The diagram on the right shows an overview of the design. The front end provides the GUI to the users and runs the game. It accesses the backend.
The interface to the backend is via two files:
- backend.h - Provides access to starting, stopping and updating the simulation
- network.h - Provides access to the networking functions.
The backend calls back front end functions.
- frontend.h - Drawing the screen, playing sounds etc
- netclient.h - TCP/IP communication, sending and receiving packets.
One of the coding principles was to limit the amount of magic numbers present in the code. As such all string constants and numeric values are #define's located in relevant header files. This makes it easier to experiment in changing the values or moving them out to a separate mod file (possibly network downloadable!)
(From Brains needs more details.)
MAP coordinates are 8 bits each for X and Y, and the unit is one map square. 0,0 is the top left corner of the 'world', and coordinates increase downwards and to the right. 255,255 is the bottom right corner of the world. The position of pillboxes and refueling bases are given in MAP coordinates, since they are constrained to lie on map squares.
WORLD coordinates are 16 bits each for X and Y. They are a higher resolution version of MAP coordinates, used for objects such as tanks which can move on a finer grid than whole map squares. Like MAP coordinates, WORLD coordinates start with 0,0 in the top left, increasing downwards and to the right. 256 WORLD coordinate units make one MAP coordinate unit, so effectively the top byte of the WORLD coordinate gives the MAP square, and the low byte gives the location within the square.
The high nibble in a low byte gives the pixel location within the tile. The low nibble in the low byte is sub pixel.
For more information on each part of the code see the pages below. These map the folders in the winbolo/src directory.