Protocol used by xtris, xtserv and xtbot:

Each command is made of: 

. command length in bytes, as a 4-byte long in network order 
  (<256 , not including this field)
. originator's number (char, set to 0 when coming from the client)
. opcode (char)
. arguments, if any

opcodes:

OP_NICK = 1
OP_PLAY = 2
OP_FALL = 3
OP_DRAW = 4
OP_LOST = 5
OP_GONE = 6
OP_CLEAR = 7
OP_NEW = 8
OP_LINES = 9
OP_GROW = 10
OP_MODE = 11
OP_LEVEL = 12
OP_BOT = 13
OP_KILL = 14
OP_PAUSE = 15
OP_CONT = 16
OP_VERSION = 17
OP_BADVERS = 18
OP_MSG = 19
OP_YOUARE = 20
OP_LINESTO = 21


client -> server:

commands:
OP_PLAY					[ let's start a game now ]
OP_LINES n (char)			[ i just did n lines ]
OP_MODE n (char)			[ sets mode n; 0 = normal, 1 = fun ]
OP_LEVEL n (char)			[ sets level n; from 0 to 9 ]
OP_BOT					[ says we're a bot ]
OP_KILL n (char)			[ request to kill user n ]
OP_PAUSE (char)				[ request a pause ]
OP_CONT (char)				[ request to continue ]
OP_VERS a b c (chars)			[ client's protocol version ]

update codes:
OP_NICK nickname  (chars)		[ my nick is ]
OP_DRAW ( x, y, color ) ... (all chars) [ drawing pieces ]
OP_FALL ( lineno . . . ) (chars)	[ falling lines, from low to high
					  line numbers (hi to low on screen) ]
OP_GROW					[ appearing empty line on my screen ]
OP_CLEAR				[ clearing my screen (always done
					  when starting to play) ]
OP_LOST					[ i've lost ]


server -> client:

commands:
OP_NEW					[ introduces new player ]
OP_GONE					[ s/o's connection is gone ]
OP_PLAY					[ reset game & start playing ]
OP_LINES n (char)			[ s/o sends you n lines (up to the
					  client to translate this according
					  to the current mode ]
OP_MODE n (char)			[ sets mode n; 0 = normal, 1 = fun ]
OP_LEVEL n (char)			[ sets level n; from 0 to 9 ]
OP_PAUSE (char)				[ pause ]
OP_CONT (char)				[ continue ]
OP_BADVERS a b c (chars)		[ proto version mismatch ; a,b,c =
					  server's version ]
OP_YOUARE 				[ informs the client of its own
					  number ]

update codes:
OP_NICK nickname (chars)		[ user sets nick ]
OP_DRAW ( x, y, color ) ... (all chars) [ draw pieces on s/o's screen ]
OP_FALL ( lineno ... ) (char)		[ falling lines on s/o's screen,
					  from low to high line numbers ]
OP_GROW 				[ add empty bttm line on s/o's screen ]
OP_LOST					[ s/o has lost ]
OP_CLEAR				[ s/o clears his screen ]
OP_LINESTO n, who (chars)		[ s/o sends n lines to who (not you) ]


Each client sends an OP_VERSION and an OP_NICK just after connecting.

If the version matches (i.e the first 2 version numbers are the same),
then the client gets the list of OP_NEW/OP_NICKs in return;  at the next
OP_PLAY, the client becomes active and starts getting update codes as
well as playing.

If the version doesn't match, the client gets an OP_BADVERS and gets
dropped.


