Martian Chess Protocol

(Back to the jmac Martian Chess page)


PROTOCOL

mchess uses a simple fixed-length protocol. Every communication between server and client begins with a four-byte keyword, followed by two bytes which represent, in network-order binary, the remaining number of bytes in that particularl communication, including any traling newlines and the like.


Server to client keywords

In this and the following section, each keyword is followed by a definition, and then a pseudocode prototype of the message that can be paired with each, where 'arbitrary' refers to any (or no) text (usually seen in server-to-client communication), and 'ignored' means the receiving program will accept but discard the message (usually seen in client-to-server stuff).

DUDE

Sent to a client upon a successful connection to the server.

 arbitrary
BARF

The generic error keyword.

 arbitrary
OKAY

The generic success keyword.

 abitrary
JOIN

Confirmation that the client has joined a game.

 game_number arbitrary
MESG

Generic server-to-client chatter.

 arbitrary
NEWG

Confirmation that the client has started a new game.

 new_game_number arbitrary
STRT

Notification that the game to which the client is attached has begun.

 arbitrary
GAME

A semicolon-deliniated list of all available games, with their players. The message string will be blank if no games are available.

 game_number player_name player_name ...;game_number player_name ...
TURN

An update that the turn has switched to another player.

 player_name
SQUR

Description of the contents of a square on the board. Board coordinates are given as positive integers with (0,0) being the square in the lower left corner.

 x_coordinate, y_coordinate piece_letter_or_'E'_for_empty
PLYR

An update on a player's score.

 player's_quadrant_number player's_score player's_name
PKUP

A piece has been picked up.

 x_coordinate y_coordinate
PTDN

A piece has been put down again, with no move made.

 x_coordinate y_coordinate
OVER

The game has ended. This way be from a win, or a player bailing. The message describes which. (This is not sufficient; premature-ending games deserve their own keyword)

 arbitrary


Client to server keywords

JOIN

Request to join a game.

 game_number player_name
STRT

Request to begin a game.

 ignored
EXIT

Request to remove self from a game, but stay connected to the server.

 ignored
QUIT

Request to disconnect from the server.

 ignored
NEWG

Request to create a new game on the server.

 player_name 
NEWC

Request to create a new 'bot' player within the current game.

 ignored
LOCK

Request to disallow other players from wandering into the current game.

 ignored
ULCK

Request to allow other players to join the game freely.

 ignored
MOVE

A piece selecion. Can be for selecting or dropping a piece. Board coordinates are given as positive integers with (0,0) being the square in the lower left corner.

 x_coordinate, y_coordinate
ABRT

Request to abort current move and start over.

 ignored
SHOU

A chat message intended for everyone connected to the server.

 arbitrary
TALK

A chat message intended for everyone in the same game as the player, or the 'waiting area' if the player is not within a game.

 arbitrary
NAME

A new name for this player.

 player_name

All content of this website is copyright © 1999-2016 by Jason McIntosh except where noted.

This particular page was last modified: Thu Nov 17 00:18:44 2005 (Dynamic content may be more recent than this.)

Return to jmac.org home.