[ProtocolWrapper]
CubePump protocol runs via WebSocket.
There are two types of signals: LowLevelSignal (LL) and PackedSignal (PK).
[PackedSignal]
PKs mainly provide non-network-critical data related to the gameplay. They are sent in packages every 50ms.
[LowLevelSignal]
There are 5 classes of LL. Four of them are described in [HandShake], [LoginAccept], [Ping] and [Disconnect].
The fifth type of LL is the Package Signal, which sends a package of PKs in this format:
length uint32
deflated byte[length]
where deflated is the following data encoded in zlib deflation:
for i from 1 to size
0x80
signalId[i] uint16
signalPayload[i] dynamic
0x00
Each LL has a 1-byte ID as presented in ll-id.txt
signalId[i] is the 2-byte ID of the i-th PK as presented in pk-id.txt
[Legend]
CS = Client -> Server only
SC = Server -> Client only
MT = Signal may be sent from both sides
nop = add some bits to pad the payload to a full byte
[DataTypes]
; [u]int(8|16|32|64): big-endian encoded
struct string
length uint16
buffer byte[length]
struct string32
length uint32
buffer byte[length]
struct event_time
time uint64 ; number of microseconds since SPAWN happens
struct int_pos
x int32
y int32
z int32
struct float_pos
x float32
y float32
z float32
struct cube_pos
batch int_pos
local_x nibble
local_y nibble
local_z nibble
nop
struct cube_precise_pos
batch int_pos
local_x nibble
local_y nibble
local_z nibble
face nibble
precise_x float32
precise_y float32
struct cube_model
TODO
struct flex_pos
batch int_pos
local float_pos
yaw float32
pitch float32
[FSM]
digraph FSM
initial -> login_requested [HandShake]
login_requested -> loading [LoginAccept]
login_requested -> disconnected [Disconnect]
loading -> loading [Load]
loading -> loading [Ping]
loading -> spawned [Spawn]
loading -> disconnected [Disconnect]
spawned -> spawned [Load]
spawned -> spawned [GamePlay]
spawned -> spawned [Ping]
spawned -> disconnected [Disconnect]
spawned -> loading [WorldSwitch]
[HandShake]
CS LOGIN_REQUEST
majorProtocol uint32 ; client.major == server.major
minorProtocol uint32 ; client.minor >= server.minor
username string
userId byte[20]
language string
sysInfo string
[LoginAccept]
SC LOGIN_ACCEPT
minorProtocol uint32 ; to let client determine if server supports new features
[Disconnect]
SC DISCONNECT
reason string
rejoin bool
nop
CS DISCONNECT
[Ping]
MT PING
lastCycle uint64
MT PONG
[Load]
SC CUBE_DICT
size uint32
for i from 1 to size
cubeDefId[i] uint32
cubeDefName[i] string
if cubeDefName[i] does not start with "CubePump."
cubeDefModel[i] cube_model
SC CUBE_BATCH
pos int_pos
payload uint32[4096]
[Spawn]
SC SPAWN
pos flex_pos
; also resets eventTime to uint64(0)
[GamePlay]
SC CUBE_UPDATE
pos cube_pos
new uint16
CS CUBE_INTERACT
pos cube_precise_pos
method uint16
SC FLEX_MOTION
eventTime event_time
new flex_pos
velocity float_pos
CS USER_MOTION
yaw float32
dash bool
nop
CS USER_ROTATION
yaw float32
pitch float32
CS USER_FLAGS
flyUp bool
flyDown bool
freeFly bool
float bool
crouch bool
nop
SC FLEX_FLAGS
crouch bool