]> git.localhorst.tv Git - blank.git/blob - doc/protocol
432a3e9413d6604e75808424ab35bb29fd7bdf96
[blank.git] / doc / protocol
1 Structure
2 =========
3
4 Offset  Size   Type  Description
5  0      4      data  protocol tag, must be 0xFB1AB1AF
6  4      2      uint  sequence number
7  6      2      uint  sequence ack
8  8      4      data  bitfield with previous acks
9 12      1      uint  type code for the payload
10 13      3      none  padding, reserved for future use
11 16      0-484  data  payload, contents and length vary,
12                      mostly depending on the type code
13
14 all multibyte values are in LE
15 the current code does no conversion, so only works on machines
16 with native LE (or BE if the server and all clients are on that,
17 but that's by accident and will break if conversion code is ever
18 added)
19
20
21 Packets
22 =======
23
24 Ping
25 ----
26
27 To tell the other side we're still alive.
28 Both server and client will send this if they haven't sent something in
29 a while.
30
31 Code: 0
32 Payload: none
33 Length: 0
34
35
36 Login
37 -----
38
39 Sent from client to serveri as a request to join. The server may
40 respond negatively if the player name is already taken or some cap has
41 been reached.
42
43 Code: 1
44 Payload:
45         0 player name, max 32 byte UTF-8 string,
46           shorter names should be zero terminated
47 Length: 0-32
48
49
50 Join
51 ----
52
53 Sent by the server either as a response to a successful login or when
54 it's changing worlds.
55
56 Code: 2
57 Payload:
58          0 entity ID of the player, 32bit unsigned int
59          4 chunk coords of the player, 3x 32bit signed int
60         16 pos/vel/rot/ang of the player, 13x 32bit float
61         68 name of the world the server's currently running
62            max 32 byte UTF-8 string
63 Length: 68-100
64
65
66 Part
67 ----
68
69 Sent by the server either as a respons to a failed login or when the
70 client was kicked.
71 Optionally sent by the client on disconnect.
72
73 Code: 3
74 Payload: none
75 Length: 0
76
77
78 Player Update
79 -------------
80
81 Sent by clients to notify the server of their changes to the player.
82
83 Code: 4
84 Payload:
85          0 chunk coords of the player, 3x 32bit signed int
86         12 pos/vel/rot/ang of the player, 13x 32bit float
87 Length: 64
88
89
90 Spawn Entity
91 ------------
92
93 Sent by the server to notify the client of an entity entering spawn range.
94
95 Code: 5
96 Payload:
97           0 entity ID, 32bit unsigned int
98           4 entity's skeleton ID, 32bit unsigned int
99           8 chunk coords of the entity, 3x 32bit signed int
100          20 pos/vel/rot/ang of the entity, 13x 32bit float
101          72 bounding box of the entity, 6x 32bit float
102          96 flags, 32bit bitfield with boolean values
103             1: world collision
104         100 entity name, max 32 byte UTF-8 string
105 Length: 132
106
107
108 Despawn Entity
109 --------------
110
111 Sent by the server to notify the client of an entity leaving spawn range.
112
113 Code: 6
114 Payload:
115         0 entity ID, 32bit unsigned int
116 Length: 4
117
118
119 Entity Update
120 -------------
121
122 Sent by the server to notify the client of updated entity properties.
123 Contained entities must be ordered by ascending entity ID.
124
125 Code: 7
126 Payload:
127          0 number of entities, 32bit int, 1-7
128          4 chunk coords of the entity, 3x 32bit signed int
129         16 pos/vel/rot/ang of the entity, 13x 32bit float
130         68 next entity...
131 Length: 4 + multiple of 64, max 452