Protocol: Difference between revisions

From Freeblox
Jump to navigation Jump to search
(Created page with "{| class="wikitable" |'''Packet ID''' |'''Packet name''' |'''Fields''' |'''Type''' |'''Description''' |- | rowspan="3" |0 | rowspan="3" |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 worl...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Packet ID is delivered as <code>uint8</code>. Data types are [[wikipedia:Endianness|little-endian]], unless otherwise noted. Reference server implementation (Node.js) uses [https://nodejs.org/api/buffer.html Buffers] for handling binary data.
{| class="wikitable"
{| class="wikitable"
|'''Packet ID'''
|+Data types referenced in the table below
|'''Packet name'''
!Data type
|'''Fields'''
!Maximum value
|'''Type'''
!Description / usage
|'''Description'''
|-
|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
|}
{| class="wikitable"
!'''Packet ID'''
!'''Packet name'''
!'''Fields'''
!'''Type'''
!'''Description'''
|-
|-
| rowspan="3" |0
| rowspan="3" |0
| rowspan="3" |AUTH
| rowspan="3" |AUTH
|Player UUID
|Player UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|UUID of player
|UUID of player
|-
|-
|Session Token
|Session Token
|StringNT
|<code>StringNT</code>
|Session token for pre-created game session
|Session token for pre-created game session
|-
|-
|Client Version
|Client Version
|uint8
|<code>uint8</code>
|Client protocol version
|Client protocol version
|-
|-
Line 29: Line 68:
|STREAM_START
|STREAM_START
|World Name
|World Name
|StringNT
|<code>StringNT</code>
|Used to indicate that the server is uploading a new world to the player.
|Used to indicate that the server is uploading a new world to the player.
|-
|-
Line 35: Line 74:
| rowspan="4" |STREAM_ASSET
| rowspan="4" |STREAM_ASSET
|Asset Path
|Asset Path
|StringNT
|<code>StringNT</code>
|Asset Path / UUID
|Asset Path / UUID
|-
|-
|Asset Name
|Asset Name
|StringNT
|<code>StringNT</code>
|Name of asset
|Name of asset
|-
|-
|Asset Type
|Asset Type
|Enum (StringNT)
|<code>Enum (StringNT)</code>
|Either Texture, CubeTexture or Mesh
|Either Texture, CubeTexture or Mesh
|-
|-
|Buffer
|Buffer
|Binary data
|<code>Binary data</code>
|Data of asset
|Data of asset
|-
|-
Line 53: Line 92:
| rowspan="4" |STREAM_OBJECT
| rowspan="4" |STREAM_OBJECT
|Object UUID
|Object UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Streaming a game object to the client.
|Streaming a game object to the client.


Line 59: Line 98:
|-
|-
|Parent UUID
|Parent UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|UUID of object’s parent, this object must have been sent beforehand.
|UUID of object’s parent, this object must have been sent beforehand.
|-
|-
|Object Type
|Object Type
|StringNT
|<code>StringNT</code>
|Type of game object.
|Type of game object.
|-
|-
|Object Serialized Data
|Object Serialized Data
|JSON (StringNT)
|<code>JSON (StringNT)</code>
|Serialized data of game object.
|Serialized data of game object.
|-
|-
Line 73: Line 112:
|STREAM_DESTROY
|STREAM_DESTROY
|Object UUID
|Object UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Object UUID to remove from the world.
|Object UUID to remove from the world.
|-
|-
Line 79: Line 118:
| rowspan="3" |STREAM_EVENT
| rowspan="3" |STREAM_EVENT
|Object UUID
|Object UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Event from an object with UUID.
|Event from an object with UUID.
|-
|-
|Event
|Event
|Enum (StringNT)
|<code>Enum (StringNT)</code>
|Event name
|Event name
|-
|-
|Event data
|Event data
|JSON (StringNT)
|<code>JSON (StringNT)</code>
|Event details
|Event details
|-
|-
Line 93: Line 132:
|STREAM_FINISH
|STREAM_FINISH
|World Name
|World Name
|StringNT
|<code>StringNT</code>
|Server has finished uploading the world and is ready to be played.
|Server has finished uploading the world and is ready to be played.
|-
|-
Line 99: Line 138:
| rowspan="5" |STREAM_TRANSFORM
| rowspan="5" |STREAM_TRANSFORM
|Object UUID
|Object UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Object by UUID transformation synchronization packet.
|Object by UUID transformation synchronization packet.
|-
|-
|Position
|Position
|Vector3 (x y z floats)
|<code>Vector3 (x y z floats)</code>
|Position of object in world coordinates.
|Position of object in world coordinates.
|-
|-
|Rotation
|Rotation
|Quaternion (x y z w floats)
|<code>Quaternion (x y z w floats)</code>
|Rotation of object in world coordinates.
|Rotation of object in world coordinates.
|-
|-
|Linear velocity
|Linear velocity
|Vector3 (x y z floats)
|<code>Vector3 (x y z floats)</code>
|Velocity.
|Velocity.
|-
|-
|Angular velocity
|Angular velocity
|Vector3 (x y z floats)
|<code>Vector3 (x y z floats)</code>
|Angular velocity.
|Angular velocity.
|-
|-
Line 121: Line 160:
| rowspan="3" |STREAM_CHAT
| rowspan="3" |STREAM_CHAT
|Player UUID
|Player UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Chat event broadcast from player UUID.
|Chat event broadcast from player UUID.
|-
|-
|Chat type
|Chat type
|Enum (StringNT)
|<code>Enum (StringNT)</code>
|Chat type.
|Chat type.
|-
|-
|Chat message
|Chat message
|StringNT
|<code>StringNT</code>
|Chat message.
|Chat message.
|-
|-
Line 135: Line 174:
| rowspan="2" |PLAYER_LIST
| rowspan="2" |PLAYER_LIST
|Player count
|Player count
|uint32
|<code>uint32</code>
|Player count.
|Player count.
|-
|-
|Player ID:Player Name pairs x Player count
|Player ID:Player Name pairs x Player count
|StringNT
|<code>StringNT</code>
|Player UUID-Name pairs
|Player UUID-Name pairs
|-
|-
Line 145: Line 184:
| rowspan="2" |PLAYER_JOIN
| rowspan="2" |PLAYER_JOIN
|Player UUID
|Player UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Player UUID of new player, also sent for current player after world upload.
|Player UUID of new player, also sent for current player after world upload.
|-
|-
|Player Name
|Player Name
|StringNT
|<code>StringNT</code>
|Player name.
|Player name.
|-
|-
Line 155: Line 194:
| rowspan="3" |PLAYER_QUIT
| rowspan="3" |PLAYER_QUIT
|Player UUID
|Player UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Player UUID of new player, also sent for current player after world upload.
|Player UUID of new player, also sent for current player after world upload.
|-
|-
|Player Name
|Player Name
|StringNT
|<code>StringNT</code>
|Player name.
|Player name.
|-
|-
|Quit reason
|Quit reason
|StringNT
|<code>StringNT</code>
|Reason for quitting.
|Reason for quitting.
|-
|-
Line 169: Line 208:
| rowspan="6" |PLAYER_CHARACTER
| rowspan="6" |PLAYER_CHARACTER
|Player UUID
|Player UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Player UUID of new player, also sent for current player after world upload.
|Player UUID of new player, also sent for current player after world upload.
|-
|-
|Player Name
|Player Name
|StringNT
|<code>StringNT</code>
|Player name.
|Player name.
|-
|-
|Position
|Position
|Vector3 (x y z floats)
|<code>Vector3 (x y z floats)</code>
|Position of character in world coordinates.
|Position of character in world coordinates.
|-
|-
|Rotation
|Rotation
|Quaternion (x y z w floats)
|<code>Quaternion (x y z w floats)</code>
|Rotation of character in world coordinates.
|Rotation of character in world coordinates.
|-
|-
|Character UUID
|Character UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|UUID of player character Group game object.
|UUID of player character Group game object.
|-
|-
|Data
|Data
|JSON (StringNT)
|<code>JSON (StringNT)</code>
|Character customization serialized.
|Character customization serialized.
|-
|-
Line 195: Line 234:
| rowspan="4" |PLAYER_MOVEMENT
| rowspan="4" |PLAYER_MOVEMENT
|Player UUID
|Player UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Player by UUID velocity and look vector change packet.
|Player by UUID velocity and look vector change packet.
|-
|-
|Linear velocity
|Linear velocity
|Vector3 (x y z floats)
|<code>Vector3 (x y z floats)</code>
|Velocity.
|Velocity.
|-
|-
|Look At
|Look At
|Vector3 (x y z floats)
|<code>Vector3 (x y z floats)</code>
|Normal vector of character’s looking direction.
|Normal vector of character’s looking direction.
|-
|-
|Jump
|Jump
|Boolean (uint8)
|<code>Boolean (uint8)</code>
|Player is jumping.
|Player is jumping.
|-
|-
Line 213: Line 252:
| rowspan="3" |PLAYER_CHAT
| rowspan="3" |PLAYER_CHAT
|Player UUID
|Player UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Chat event from player UUID.
|Chat event from player UUID.
|-
|-
|Chat type
|Chat type
|Enum (StringNT)
|<code>Enum (StringNT)</code>
|Chat type.
|Chat type.
|-
|-
|Chat message
|Chat message
|StringNT
|<code>StringNT</code>
|Chat message.
|Chat message.
|-
|-
Line 227: Line 266:
| rowspan="4" |PLAYER_EVENT
| rowspan="4" |PLAYER_EVENT
|Player UUID
|Player UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Player by UUID triggered event to be sent to the server. Usually used for clicks etc.
|Player by UUID triggered event to be sent to the server. Usually used for clicks etc.
|-
|-
|Object UUID
|Object UUID
|UUID (StringNT)
|<code>UUID (StringNT)</code>
|Event from an object with UUID.
|Event from an object with UUID.
|-
|-
|Event
|Event
|Enum (StringNT)
|<code>Enum (StringNT)</code>
|Event name.
|Event name.
|-
|-
|Event data
|Event data
|JSON (StringNT)
|<code>JSON (StringNT)</code>
|Event details.
|Event details.
|-
|-
Line 245: Line 284:
|ERROR
|ERROR
|Error type
|Error type
|Enum (StringNT)
|<code>Enum (StringNT)</code>
|Server sends client an error, usually fatal to the connection attempt.
|Server sends client an error, usually fatal to the connection attempt.
|}
|}

Latest revision as of 16:56, 27 June 2023

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.