]> git.localhorst.tv Git - blank.git/blob - doc/protocol
get rid of angular velocity
[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 Common Types
21 ------------
22
23 Name          Size  Type
24 vec3          12    3x 32bit float
25 vec3i         12    3x 32bit signed int
26 vec3b          3    3x 8bit signed int
27 packn          2    16bit signed int representing a float value normalized to [-1,1]
28                         it can be unpacked by dividing by 32767
29 packu          2    16bit unsigned  int representing a float value normalized to [0,1]
30                         it can be unpacked by dividing by 65535
31 vec3n          6    3x packn
32 vec3u          6    3x packu
33 quat           8    4x packn float
34 entity state  50    [ 0] vec3i chunk pos (there's a variation where this is a vec3b)
35                     [12] vec3u block pos by 16,
36                     [18] vec3 velocity,
37                     [30] quat orientation,
38                     [38] 12 reserved bytes (used to be angular velocity)
39
40
41 Packets
42 =======
43
44 Ping
45 ----
46
47 To tell the other side we're still alive.
48 Both server and client will send this if they haven't sent something in
49 a while.
50
51 Code: 0
52 Payload: none
53 Length: 0
54
55
56 Login
57 -----
58
59 Sent from client to server as a request to join. The server may
60 respond negatively if the player name is already taken or some cap has
61 been reached.
62
63 Code: 1
64 Payload:
65         0 player name, max 32 byte UTF-8 string,
66           shorter names should be zero terminated
67 Length: 0-32
68
69
70 Join
71 ----
72
73 Sent by the server either as a response to a successful login or when
74 it's changing worlds.
75
76 Code: 2
77 Payload:
78          0 entity ID of the player, 32bit unsigned int
79          4 entity state of the player
80         54 name of the world the server's currently running
81            max 32 byte UTF-8 string
82 Length: 54-86
83
84
85 Part
86 ----
87
88 Sent by the server either as a respons to a failed login or when the
89 client was kicked.
90 Optionally sent by the client on disconnect.
91
92 Code: 3
93 Payload: none
94 Length: 0
95
96
97 Player Update
98 -------------
99
100 Sent by clients to notify the server of their changes to the player.
101
102 Code: 4
103 Payload:
104          0 player's entity state as predicted by the client
105         50 movement input, vec3n
106         56 pitch input by PI/2, packn
107         58 yaw input by PI, packn
108         60 active actions, 8bit bit field, first three bits are primary, secondary, and tertiary
109         61 selected inventory slot, 8bit unsigned int
110 Length: 62
111
112
113 Spawn Entity
114 ------------
115
116 Sent by the server to notify the client of an entity entering spawn range.
117
118 Code: 5
119 Payload:
120          0 entity ID, 32bit unsigned int
121          4 entity's model ID, 32bit unsigned int
122          8 entity state
123         58 bounding box of the entity, 6x 32bit float
124         82 flags, 32bit bitfield with boolean values
125            1: world collision
126         86 entity name, max 32 byte UTF-8 string
127 Length: 87 - 118
128
129
130 Despawn Entity
131 --------------
132
133 Sent by the server to notify the client of an entity leaving spawn range.
134
135 Code: 6
136 Payload:
137         0 entity ID, 32bit unsigned int
138 Length: 4
139
140
141 Entity Update
142 -------------
143
144 Sent by the server to notify the client of updated entity properties.
145 Contained entities must be ordered by ascending entity ID.
146
147 Code: 7
148 Payload:
149          0 number of entities, 32bit int, 1-10
150          4 base for chunk coordinates, vec3i
151         16 entity ID, 32bit unsigned int
152         20 entity state with vec3b as chunk position (rather than vec3i)
153         62 next entity...
154 Length: 16 + multiple of 45, max 466
155
156
157 Player Correction
158 -----------------
159
160 Sent by the server to tell a client that its prediction is way off.
161
162 Code: 8
163 Payload:
164          0 sequence number of the offending packet, 16bit unsigned int
165          2 entity state of the player's entity on the server
166 Length: 52
167
168
169 Chunk Begin
170 -----------
171
172 Sent by the server to inform the client of an upcoming chunk transmission.
173
174 Code: 9
175 Payload:
176          0 transmission ID, used for reference with Chunk Data packets, 32bit unsigned int
177          4 flags, 32bit bitfield with boolean values
178            1: compressed
179          8 chunk coordinates, vec3i
180         20 data size, 32bit unsigned int
181 Length: 24
182
183
184 Chunk Data
185 ----------
186
187 Raw chunk data sent by the server, optionally compressed with zlib.
188
189 Code: 10
190 Payload:
191          0 transmission ID, references the Chunk Begin packet this data belongs to, 32bit unsigned int
192          4 block offset, offset of this block inside the whole data, 32bit unsigned int
193          8 block size, size of the data block, 32bit unsigned int
194         12 data, raw data
195 Length: 12-484
196
197
198 Block Update
199 ------------
200
201 Sent by the server whenever one or more block in a chunk have changed.
202
203 Code: 11
204 Payload:
205          0 chunk coordinates, vec3i
206         12 number of blocks, 32bit unsigned int, 1-78
207         16 first block index, 16bit unsigned int
208         18 first block data, 32bit
209         22 second block index...
210 Length: 16 + multiple of 6, max 484
211
212
213 Message
214 -------
215
216 Sent by the client when the user submits a line on the chat input.
217 Sent by the server on various events like player chat, server status, command output, etc.
218
219 Code: 12
220 Payload:
221          0 message type, 8bit unsigned int: 0 = notification, 1 = chat
222          1 referral, 32bit unsigned int, entity ID if type = 1
223          5 message, max 450 byte UTF-8 string, should be zero terminated if shorter
224 Length: 6-455