Server

From WinBolo

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

The server design is very similar to the backend design.


Contents

Modules/Files =

servercore.c

Runs the game simulation. Similar to screen.c. The two big differences are:

  • Rather then one tank ADT contains a tank ADT per player.

Main functions:

/*********************************************************
*NAME:          serverCoreCreate
*AUTHOR:        John Morrison
*CREATION DATE: 10/8/99
*LAST MODIFIED:  5/5/00
*PURPOSE:
*  Creates a new server. Returns FALSE if an error occured
*  such as error loading map
*
*ARGUMENTS:
*  fileName - Points to the map file
*  game - The game type-Open/tournament/strict tournament
*  hiddenMines - Are hidden mines allowed
*  srtDelay    - Game start delay (50th second increments)
*  gmeLen      - Length of the game (in 50ths)
*                (-1 =unlimited)
*********************************************************/
bool serverCoreCreate(char *fileName, gameType game, bool hiddenMines, int srtDelay, long gmeLen);

Starts the simulation.

void serverCoreDestroy()

Shuts down the simulation.

void serverCoreGameTick();

Runs the game simulation. Called every 20ms. Front ends that get behind must call repeatedly till it is caught up.

Also contains a bunch of helper functions for the server front end. e.g.

long serverCoreGetTimeGameCreated(void);
void serverCoreGetMapName(char *value);
BYTE serverCoreGetNumNeutralBases(void);
...
etc.

It may be possible to one day combine screen.c and servercore.c

servermain.c

Main application.

  • Sets up game.
  • Runs game.
  • Shuts game down.
  • Listens for keyboard commands and signals. (on linux)

serverfrontend.c

A front end stub that null ops all frontend callback functions required by the backend.

servermessage.c

Displays messages to the console or writes to the console log file.

servertransport.c

Low level sock communication functions for sending data to/from the network.

threads.c

Provides server thread synchronization code (i.e. mutex) and threadsGetContext(). For more information see Bolo#Client vs Server

Personal tools