]> git.localhorst.tv Git - blank.git/blob - doc/protocol
sync entities with clients
[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 chunk coords of the entity, 3x 32bit signed int
99         16 pos/vel/rot/ang of the entity, 13x 32bit float
100         68 bounding box of the entity, 6x 32bit float
101         92 flags, 32bit bitfield with boolean values
102            1: world collision
103         96 entity name, max 32 byte UTF-8 string
104 Length: 128
105
106
107 Despawn Entity
108 --------------
109
110 Sent by the server to notify the client of an entity leaving spawn range.
111
112 Code: 6
113 Payload:
114         0 entity ID, 32bit unsigned int
115 Length: 4
116
117
118 Entity Update
119 -------------
120
121 Sent by the server to notify the client of updated entity properties.
122 Contained entities must be ordered by ascending entity ID.
123
124 Code: 7
125 Payload:
126          0 number of entities, 32bit int, 1-7
127          4 chunk coords of the entity, 3x 32bit signed int
128         16 pos/vel/rot/ang of the entity, 13x 32bit float
129         68 next entity...
130 Length: 4 + multiple of 64, max 452