Protocol: Difference between revisions

Jump to navigation Jump to search
1,361 bytes added ,  27 June 2023
no edit summary
mNo edit summary
No edit summary
 
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"
|+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
|}
{| class="wikitable"
{| class="wikitable"
!'''Packet ID'''
!'''Packet ID'''
Line 9: Line 48:
| 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.
|}
|}

Navigation menu