Server

From WinBolo

(Difference between revisions)
Jump to: navigation, search
(servernet.c)
Line 55: Line 55:
=== servernet.c ===
=== servernet.c ===
-
Equivilient to network.c for a game client. Handles processing of incoming packets etc. todo: more details. See also [[Networking]].
+
Equivilient to network.c for a game client. Handles processing of incoming packets etc. todo: more details.
 +
 
 +
See also [[Networking]].
=== servermain.c ===
=== servermain.c ===

Revision as of 16:58, 1 December 2008

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

servernet.c

Equivilient to network.c for a game client. Handles processing of incoming packets etc. todo: more details.

See also Networking.

servermain.c

Main application.

  • Sets up game - In the main function.
  • Runs game - In (serverGameTimer();)
  • Shuts game down - In the main() function
  • 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