Magi

Contact info
Studies
  Scientific publications
  Master's thesis
Work
Software
Hobbies
Other Articles
  Evolution
  Metsola
  Pseudoart
Photography
Historical

© Marko Grönroos, 1998



WarWorld - Session Initialization Protocol

as of 10/01/2000

Client-Server-Client Messages


NOTE: The '<','>' characters below are not parts of the message structure!

NOTE: All messages end with '\0' for easy processing via strcmp() etc.

NOTE: All numeric values are integers.


Initializing a connection


Server: "WWServer: version x.x\0"

Client: "WWClient: version x.x\0"

Server:

on success:

"READY\0"

on failure (too many players?):

"QUIT\0", connection is terminated.


Entering the lobby


Client: "JOIN <this_player's_nickname>\0"

* The player enters the 'lobby' and joins the other players already there.


Server: "PLAYER <player0_nickname>\0"

"PLAYER <player1_nickname>\0"

.

.

"PLAYER <this_player's_nickname>\0"

* The servers tells the client who are already in the lobby.


NOTE: A new PLAYER message is broadcast whenever a new player JOINs the lobby (before launch, that is).


Launching the game


Client: "LAUNCH\0"

Server: "DATA\0"

and the server starts pouring gamestate info into the pipes..

SEE BELOW!


Who is allowed to launch a game?

Only Player0 (the player that joined first) may launch the game as he is considered the host of the session. Others will have their launch buttons hidden on the client user interface.


World state initialization

Maps are randomized based on that 32-bit seed value below. The same seed is

guaranteed to produce identical maps for all the players (not yet though)

Map dimensions are given in metres. From the client's point of view 1024m x 1024m

looks nice.

Server: "MAP <map_width_in_m>,<map_height_in_m>,<random seed[32-bit int]>\0"

"UNIT <owner's_player_id>,<world_x>,<world_y>,<heading[0..255]>,<type_id>\0"

"UNIT <owner's_player_id>,<world_x>,<world_y>,<heading[0..255]>,<type_id>\0"

.

.

"UNIT <owner's_player_id>,<world_x>,<world_y>,<heading[0..255]>,<type_id>\0"



After sending the last bit of gamestate information

Server: "DONE\0"

* This tells the clients that no more initialization data is coming.


How do the clients react?


Client: "READY\0"


IMPORTANT! After every client has acknowledged, i.e. finished with data initialization, the server may broadcast the first "INIT\0" and off we go!



So, what's that TYPE_ID anyway?


A TYPE_ID is, again, a number ranging from 0 to the NUM_DIFFERENT_UNIT_TYPES-1. With this value we associate a unit with a type data structure that contains information about the physical (and other) characteristics for that type.

Additionally, by assessing the TYPE_ID of a unit the client knows which image to draw to represent this unit on screen.


TYPE_IDs in WarWorld


0 == CELESTIAL_BEING (reserved by client:)

1 == BUILDER

2 == TANK