Open
Description
Might be too early for this, but I was bored and so I wrote this.
/******************************/
/*NETWORK PROTOCAL DESCRIPTION*/
/* (NPD) */
/******************************/
/*
INTRODUCTION:
I believe that the game should use a simple, but
concise way of communicating data. For this reason
I have decided to suggest a simple command type system,
that could be easily written, but is then "compiled" to
a more concise form.
TERMINOLOGY:
Throughout the rest of this description the following term will be used:
Client: The program sending the message.
Server: The program recieving the message. (Could be a main server or a peer)
(NOTE: Both playing applications will take the role of both the client and server
in every session)
Message Options are given as follows:
msg_code[(option_name:data;)+]
If there is no data the ':' and ';' characters will then be side by side.
All whitespace is ignored.
MESSAGES:
Communication Messages:
H377O Message sent by client to server to initiate converation.
(Note the 'O' is a capital 'o' and not a zero)
[Compiled to 0x405D (CPP base 36 in base 16, I think)]
H3Y Message sent by reciever of H377O message.
Sent only if reciever is willing and able to play.
[Compiled to 0x4ooo]
busy Sent by reciever in response to a H377O message.
Sent only if reciever is unwilling or unable to play.
[Compiled to 0x4ooo]
bye Sent by client to server indicating that the client has closed the
connection, and that the server must stop sending messages.
[Compiles to 0x4ooo]
error Message sent by client to server indicating that there has been an error.
-Options
n no message
m:s a string is attached with information of the error
[Compiled to 0x404D]
readyornot Sent by client to server indicating that they are ready for the game to commence.
[Compiled to 0x4ooo]
ready Sent in response to readyornotmessage, indicating that client is ready.
[Compiled to 0x4ooo]
wait Sent by client to server indicating that they are busy, and will send next message
when the client is free. (Recievers of this message are expected to wait until they
another message, however, recievers should end session if wait time exceads 5.0s)
[Compiles to 0x4ooo]
Out-Game Messages:
Handles info like score, game type, colour.
In-Game Messages:
Handles info solely related to the movement of pieces.
COMPILED CODE FORMAT:
All Communication messages are prefixed with 0x4, Out-Game messages 0xA and In-Game messages 0xE
All message codes are compiled to two bytes, followed two bytes indicating how many optional bytes
there are following. The optional bytes format is as follows:
(option_name ':' option_data '\0')*
*/
I have included the whole file here, because I do not know how to add a file to the repository.