Protocol

From Freeblox
Revision as of 16:56, 27 June 2023 by Evert (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Packet ID is delivered as uint8. Data types are little-endian, unless otherwise noted. Reference server implementation (Node.js) uses Buffers for handling binary data.

Data types referenced in the table below
Data type Maximum value Description / usage
uint8 255
bool 1 0 = false, 1 = true (uint8)
uint16 65535
uint32 4294967295
float 32-bit floating point number
stringNT null-byte-terminated string of variable length
vec3 (Vector3) 3 floats (x y z), for three-dimensional vectors
quat (Quaternion) 4 floats (x y z w), for three-dimensional rotation
Packet ID Packet name Fields Type Description
0 AUTH Player UUID UUID (StringNT) UUID of player
Session Token StringNT Session token for pre-created game session
Client Version uint8 Client protocol version
1 KEEPALIVE Used to measure latency and refresh socket
2 STREAM_START World Name StringNT Used to indicate that the server is uploading a new world to the player.
3 STREAM_ASSET Asset Path StringNT Asset Path / UUID
Asset Name StringNT Name of asset
Asset Type Enum (StringNT) Either Texture, CubeTexture or Mesh
Buffer Binary data Data of asset
4 STREAM_OBJECT Object UUID UUID (StringNT) Streaming a game object to the client.

UUID of object.

Parent UUID UUID (StringNT) UUID of object’s parent, this object must have been sent beforehand.
Object Type StringNT Type of game object.
Object Serialized Data JSON (StringNT) Serialized data of game object.
5 STREAM_DESTROY Object UUID UUID (StringNT) Object UUID to remove from the world.
6 STREAM_EVENT Object UUID UUID (StringNT) Event from an object with UUID.
Event Enum (StringNT) Event name
Event data JSON (StringNT) Event details
7 STREAM_FINISH World Name StringNT Server has finished uploading the world and is ready to be played.
8 STREAM_TRANSFORM Object UUID UUID (StringNT) Object by UUID transformation synchronization packet.
Position Vector3 (x y z floats) Position of object in world coordinates.
Rotation Quaternion (x y z w floats) Rotation of object in world coordinates.
Linear velocity Vector3 (x y z floats) Velocity.
Angular velocity Vector3 (x y z floats) Angular velocity.
9 STREAM_CHAT Player UUID UUID (StringNT) Chat event broadcast from player UUID.
Chat type Enum (StringNT) Chat type.
Chat message StringNT Chat message.
10 PLAYER_LIST Player count uint32 Player count.
Player ID:Player Name pairs x Player count StringNT Player UUID-Name pairs
11 PLAYER_JOIN Player UUID UUID (StringNT) Player UUID of new player, also sent for current player after world upload.
Player Name StringNT Player name.
12 PLAYER_QUIT Player UUID UUID (StringNT) Player UUID of new player, also sent for current player after world upload.
Player Name StringNT Player name.
Quit reason StringNT Reason for quitting.
13 PLAYER_CHARACTER Player UUID UUID (StringNT) Player UUID of new player, also sent for current player after world upload.
Player Name StringNT Player name.
Position Vector3 (x y z floats) Position of character in world coordinates.
Rotation Quaternion (x y z w floats) Rotation of character in world coordinates.
Character UUID UUID (StringNT) UUID of player character Group game object.
Data JSON (StringNT) Character customization serialized.
14 PLAYER_MOVEMENT Player UUID UUID (StringNT) Player by UUID velocity and look vector change packet.
Linear velocity Vector3 (x y z floats) Velocity.
Look At Vector3 (x y z floats) Normal vector of character’s looking direction.
Jump Boolean (uint8) Player is jumping.
15 PLAYER_CHAT Player UUID UUID (StringNT) Chat event from player UUID.
Chat type Enum (StringNT) Chat type.
Chat message StringNT Chat message.
16 PLAYER_EVENT Player UUID UUID (StringNT) Player by UUID triggered event to be sent to the server. Usually used for clicks etc.
Object UUID UUID (StringNT) Event from an object with UUID.
Event Enum (StringNT) Event name.
Event data JSON (StringNT) Event details.
17 ERROR Error type Enum (StringNT) Server sends client an error, usually fatal to the connection attempt.