-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommunicationProtocol.txt
65 lines (50 loc) · 1.38 KB
/
CommunicationProtocol.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
53
54
55
56
57
58
59
60
61
62
63
64
65
---Stick arrange---
* Row 0: 1 Element
*** Row 1: 3 Elements
***** Row 2: 5 Elements
******* Row 3: 7 Elements
---Protocol---
<char><arguments><separator>
"s" ... stick
"e" ... enabled
"d" ... disabled
"m" ... message
":" ... setter
";" ... separator
Separator ';' is put after every element
---Sticks---
('s')(byte y)(byte x)(':')('e'or'd')(char ';')
Examples:
"s00:d;" = [0,0], disabled {top}
"s10:e;" = [1,0], enabled
"s11:e;" = [1,1], enabled
...
"s36:d;" = [3,6], disabled
server and client both update all elements every time
---Messages---
(char 'm')(String message)
Examples:
"mmymessage;" => "mymessage"
"mthis is a message!;" => "this is a message!"
---Sequences---
Hello:
Client sends to server/connected client (as slave) "mhello;"
Host respons with "mack;"
Providing the name:
Client: "mcname:<cname>;"
Server: "msname:<sname>;"
Determination of the first move:
Client: "mfirst:<c,s,r>;"
Server: if (c, s) "mack;", else "mfirst:<c,s>;"
Running Game:
Server makes a move:
Server: "mstartupdate;" <all sticks update> "mendupdate;"
Client: "mack;"
Client makes a move:
Client: "mstartupdate;" <all sticks update> "mendupdate;"
Server: "mack;"
Close Connection:
Server: "mclose;"
Server breaks connection!
Timeout:
If Server or Client become unresponsive (no acknowledge) for more than <fixedTimeout>, Server/Client break connection automatically.