From WinBolo

Revision as of 07:52, 31 December 2008 by John (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

The GUI directory contains platform front end specific code for running the game. There are win32 and linux subdirectories.

Here is an overview of the main files and their purpose.




Winbolo.c provides the following things:

  • WinMain(); - Program entry point and overall startup
    • Calls gameFrontStart(); to setup a game.
    • Starts multimedia timers used for running the game.
    • Calls gameFrontRun(); to run the game and the windows event loop.
    • Calls gameFrontEnd(); to clean everything up.
  • Main window call back and processing:
    • Function ExWindowProc(); is the callback function.
    • Handles each of the events.
  • Provides multimedia call backs. These run the game. There are two:
    • windowGameTimer(); - Called every 10ms
      • The game wold runs at 20ms. The function screenKeysTick(); is called every second 10ms to allow smoother aiming and finer control over tank movement.
      • The main simulation loop function is screenGameTick(); which is called the other 10ms.
      • NOTE: If the computer is running slow and is falling behind. The front end repeatedly calls these functions until it has caught up.
      • Runs the brains handler.
      • Sends data to the server. (netMakeDataPosPacket(); and netMakeDataPosPacket();)
      • Once a second calls netSecond(); to send ping data and update network counters.
      • Once every 5 minutes sends tracker update data (netSendTrackerUpdate();) Note: the current tracker ignores any client send tracker packets.
    • windowFrameRateTimer();
      • Called once every (1000/frame rate) ms to redraw the main screen. Calls screenUpdate(redraw);
  • Implemented frontend.h, the call backs used by the backend for drawing the screen, playing sound etc.


Gamefront provides the front end to the game. This includes initialising each component , drawing, sound, fonts, loading preferences etc. (gameFrontStart();)shutting everything down at the end (gameFrontEnd();)and handling the main windows loop (gameFrontRun();)

It contains a state machine of dialogs that the user goes through to start or join a game. (gameFrontSetDlgState();) If any of the starting dialogs need data it calls a gameFront function. (e.g. gameFrontGetTrackerOptions())

Lastly it contains the code that starts and controls the server if a player starts a new networked game. (gameFrontSetupServer();)


Dialog files all start with dialog<filename>.c The follow a similar pattern. For example on the Winbolonet Setup dialog:


Sets up the dialog and initialises each of the labels using the lang.c file.


The standard Windows call back function that calls other methods in the module to do the work.


Handles the OK action... etc


Provides the low level packet driver for setting up the UDP socket and sending/receiving data to/from the server. All sockets created are non blocking so if there is no new data for the client it does not lock up the game waiting.

Also handles getting a list of games from the tracker and processing responses by the front end.

Other files

  • clientMutex.c - As the backend is not thread safe provides routines to lock access to it.
  • draw.c - Functions related to drawing on the screen. Uses DirectX and some GDI.
  • sound.c - Functions to play sound files.
  • font.c - Font loading and drawing.
  • cursor.c - <ouse cursor setting.
  • input.c - Keyboard reading.
  • lang.c - Localisation file, accesses the WBL DLL files containing language resources. The WBL files work similar to the bolo sounds document.


The Linux code is no where near as readable and commented as the windows code. The port process occurred very quickly. Took about two weeks to complete. The challenge was to complete it in one. (Trivia: The server challenge was to port to linux in under 24 hours and was completed)

It was last changed for version 1.13. skin support the Log Viewer are not available.

gamefront.c and winbolo.c where merged into a giant 150K+ main.c file which is largely uncommented. The function names are mostly the same as winbolo.c

Most of the other code is laid out the same.

Glade was used to generate most of the dialog code.

Personal tools