-
Notifications
You must be signed in to change notification settings - Fork 0
/
protocol.txt
53 lines (41 loc) · 1.99 KB
/
protocol.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Protocol
**** Misc ****
ERROR message(string) : server -> client; // Used for sending error messages. No response
PING : client -> server; // Please do not drop me.
// Should be sent at least once every 3 seconds when the server is waiting for a response
// Does not extend timeout time, just makes sure you haven't disconnected
BADPROT message(string) : server -> client; // Invalid protocol, you have been disconnected
**** Player connecting to server ****
NAME : server -> client; // Request they send a name, colour and any other information
NAME name(string) r(int) g(int) b(int) : client -> server; // Their name and colour
**** Game starting ****
NEWGAME numPlayers(int) boardSize(int) startingHealth(int) myID(int) randKey(int) : server -> client; // Send the nessacary information
READY randKey(int) : client -> server; // Respond to make sure they are there
**** Game cycle ****
** For each player **
** For each player **
PLAYER pID(int) health(int) dir(int) r(int) c(int) preMoves(string) : server -> client; // Tell them the information about the player
YOURMOVE : server -> client; // Request a move from them
ACTION moves(string) : client -> server; // Their moves
**** Game over ****
GAMEOVER message(string) : server -> client; // Game has finished, wait for next game
**** Constants ****
name.length() <= 16
preMoves.length() == startingHealth
moves.legnth() == startingHealth
0 <= r, g, b, < 256
0 <= pID, myID < numPlayers
0 <= r, c < boardSize
dir == 0 -> up
dir == 1 -> right
dir == 2 -> down
dir == 3 -> left
moves:
^ = up
> = right
v = down
< = left
S = shoot
- = nop
( = left
) = right