317 lines
6.7 KiB
Plaintext
317 lines
6.7 KiB
Plaintext
|
|
Notes:
|
|
"FATAL ERROR" means "terminate the damn connection".
|
|
|
|
ENet variant:
|
|
Lua packets (0x40..0x7E, 0x7F) are sent on channel 0
|
|
WITHOUT ID or length bytes.
|
|
|
|
System packets (everything else) are sent on channel 1
|
|
and are ALWAYS marked with ENET_PACKET_FLAG_RELIABLE.
|
|
Yes, you WILL need the ID byte!
|
|
No, you must NOT pad the packets past their expected length.
|
|
|
|
Packets are compressed:
|
|
- Use enet_host_compress_with_range_coder() on your ENetHost.
|
|
|
|
Connection data field is "1CEB" in little-endian
|
|
- that's 0x42454331, and that's a one not a capital 'i'.
|
|
|
|
Base encapsulation:
|
|
0x0F baselen.u8 base[baselen] 0x00:
|
|
S->C Set base directory
|
|
|
|
This is the first message sent from the server.
|
|
The client MUST wait for this message, and this message ONLY.
|
|
|
|
The local client does NOT receive this message;
|
|
the base dir is already set.
|
|
|
|
If the base dir is already set, FATAL ERROR
|
|
|
|
/*
|
|
0x10 salt[32] version.u32 namelen.u8 name[namelen] 0x00:
|
|
C->S Authentication with server
|
|
"salt" is agreed on from some sort of master server
|
|
Currently ignored and should all be 0x00
|
|
"name" is also ignored at the moment and should be all 0x00
|
|
"version" is the current protocol version
|
|
|
|
current: 0x00000001
|
|
|
|
TODO: add some sort of auth method
|
|
|
|
0x11:
|
|
S->C Authentication acknowledgement
|
|
|
|
Gives the package directory
|
|
*/
|
|
|
|
0x17 msglen.u8 msg[msglen] 0x00:
|
|
C->S Quit / S->C Kick
|
|
|
|
Connection MUST be terminated
|
|
after sending/receiving this message
|
|
|
|
0x30 flags.u8 namelen.u8 name[namelen] 0x00:
|
|
C->S ONLY
|
|
Request file to be transferred
|
|
"name" is the filename
|
|
"flags" has these bits:
|
|
bits 0-3:
|
|
0000 = * RESERVED *
|
|
0001 = JSON data
|
|
0010 = log data [ NOT SUPPORTED YET ]
|
|
0011 = lua script
|
|
0100 = icemap data
|
|
0101 = vxl data
|
|
0110 = autodetected map data
|
|
0111 = pmf model
|
|
1000 = tga image
|
|
1001 = wav audio
|
|
1010 = .it music module
|
|
1011 = raw binary data
|
|
1100 = png image
|
|
1101 = * RESERVED *
|
|
111x = * RESERVED *
|
|
|
|
if the server is still sending a file, FATAL ERROR
|
|
0x31 clen.u32 ulen.u32:
|
|
S->C ONLY
|
|
Start file transfer
|
|
"clen" is the compressed length
|
|
"ulen" is the uncompressed length
|
|
|
|
All files are compressed as zlib streams
|
|
|
|
if the client didn't request any files, IGNORE + SEND 0x34
|
|
0x32:
|
|
S->C ONLY
|
|
Successfully end file transfer
|
|
|
|
If it doesn't unpack correctly, FATAL ERROR
|
|
If no file transfer active, IGNORE
|
|
0x33: offset.u32 len.u16 data[len]
|
|
S->C ONLY
|
|
Send a block of data
|
|
Maximum length of len is 1024
|
|
|
|
If offset+len > clen, FATAL ERROR
|
|
If no file transfer active, IGNORE + SEND 0x34
|
|
0x34:
|
|
C->S ONLY
|
|
Abort incoming file transfer
|
|
0x35:
|
|
S->C ONLY
|
|
Abort outgoing file transfer
|
|
|
|
0x40..0x7E data[this-0x3F]:
|
|
Lua packet of length (this-0x3F)
|
|
0x7F length.u16 data[length]:
|
|
Lua packet of length "length"
|
|
Minimum length of a packet is 1
|
|
Maximum length of a packet is 1276
|
|
Exceeding these bounds is a FATAL ERROR
|
|
|
|
Iceball Base Mod:
|
|
Notes:
|
|
- pid is from the range 1 to 250.
|
|
- The actual packet IDs might vary.
|
|
--- Check pkg/base/network.lua for the correct order.
|
|
|
|
0x01 time.u16:
|
|
ping with lower 16 bits of current time in msecs
|
|
0x02 time.u16:
|
|
pong with lower 16 bits of current time in msecs
|
|
|
|
if the connection exceeds 10 seconds of lag, kill it
|
|
|
|
if the gap between the server and client time
|
|
extends by 10 seconds, client is probably using CE speedhack
|
|
|
|
0x03 pid x.s16 y.s16 z.s16: @
|
|
player set position
|
|
|
|
positions are 11.5 fixed point,
|
|
giving a hypothetical max map size of 1024x128x1024
|
|
|
|
note, for C->S pid MUST be 0x00
|
|
|
|
0x04 pid ya.u8 xa.u8 keys.u8: @
|
|
player set orientation / keys
|
|
|
|
angles are as defined:
|
|
for ya, -128->128 is full circle
|
|
for xa, -128->128 is half circle
|
|
|
|
keys are:
|
|
0x01: up
|
|
0x02: down
|
|
0x04: left
|
|
0x08: right
|
|
0x10: sneak | scope
|
|
0x20: crouch
|
|
0x40: jump
|
|
0x80: * RESERVED *
|
|
|
|
note, for C->S pid MUST be 0x00
|
|
|
|
0x05 pid team weapon mode score.s16 kills.s16 deaths.s16 name.z squad.z: (S->C) @
|
|
adds player to server
|
|
|
|
note, this can be used to update a player on the server
|
|
|
|
"weapon" can be one of these:
|
|
1: rifle
|
|
2: lee-enfield
|
|
|
|
"mode" can be one of these:
|
|
1: normal player
|
|
2: map editor
|
|
3: spectator
|
|
|
|
yeah that's it really.
|
|
|
|
0x06 pid: (S->C) @
|
|
sets client player id to "pid"
|
|
|
|
0x07 pid: (S->C) @
|
|
removes player from server
|
|
|
|
0x08 x.u16 y.u16 z.u16 b g r typ: @
|
|
place a block
|
|
|
|
this also decrements the block count clientside
|
|
|
|
0x09 x.u16 y.u16 z.u16: @
|
|
destroy a block
|
|
|
|
0x0A x.u16 y.u16 z.u16: (C->S) @
|
|
destroy a 3 high pillar
|
|
|
|
(TODO: use this next one:)
|
|
|
|
0x0B x.u16 y.u16 z.u16:
|
|
collapse a section of blocks
|
|
|
|
NOTE: will be IGNORED if the floodfill hits the bottom!
|
|
|
|
0x0C msg.z (C->S) @
|
|
send chat message
|
|
|
|
0x0D msg.z (C->S) @
|
|
send teamchat message
|
|
|
|
0x0E bgra.u32 msg.z (S->C) @
|
|
add text to chat
|
|
|
|
0x0F bgra.u32 msg.z (S->C) @
|
|
add text to killfeed
|
|
|
|
0x10 pid x.fs y.fs z.fs ya.u8 xa.u8: (S->C) @
|
|
player spawn
|
|
|
|
health is set to 100
|
|
blocks is set to 25
|
|
grenades is set to 2
|
|
|
|
ammo is set to full
|
|
|
|
0x11 team.s8 weapon.u8 name.z (C->S) @
|
|
offer player
|
|
if team == -1, server autoselects
|
|
|
|
0x12 iid.u16 x.s16 y.s16 z.s16 flags.u8 @
|
|
set item position
|
|
|
|
these are hardcoded as follows:
|
|
1 = blue intel
|
|
2 = blue tent
|
|
3 = green intel
|
|
4 = green tent
|
|
|
|
flag bits:
|
|
0x01 = visible
|
|
|
|
TODO: make this more generic!
|
|
|
|
0x13 tpid.u8 type.u8 (C->S) @
|
|
fire shot, hitting target player
|
|
yes, do this EVERY shot.
|
|
|
|
if tpid == 0 and type == 0, shot didn't hit anyone
|
|
|
|
types are as follows:
|
|
0 = none
|
|
1 = head
|
|
2 = body
|
|
3 = limb
|
|
|
|
0x14 pid.u8 newhealth.u8 (S->C) @
|
|
set health due to damage
|
|
|
|
if newhealth is 0, player is dead
|
|
|
|
0x15 pid.u8 (S->C) @
|
|
tent restock
|
|
|
|
health is set to 100
|
|
blocks is set to 100
|
|
grenades is set to 4
|
|
|
|
ammo is set to full
|
|
|
|
0x16 iid.u16 pid.u8 (S->C) @
|
|
set item carrier
|
|
|
|
if pid == 0, no carrier
|
|
|
|
these are hardcoded as follows:
|
|
1 = blue intel
|
|
2 = blue tent
|
|
3 = green intel
|
|
4 = green tent
|
|
|
|
0x17 pid.u8 tool.u8 @
|
|
set tool
|
|
|
|
TOOL_SPADE = 0
|
|
TOOL_BLOCK = 1
|
|
TOOL_GUN = 2
|
|
TOOL_NADE = 3
|
|
|
|
0x18 pid.u8 r.u8 g.u8 b.u8 @
|
|
set block colour
|
|
|
|
0x19 pid.u8 newblocks.u8 (S->C) @
|
|
set block count
|
|
|
|
0x1A pid.u8 (S->C) @
|
|
emit tracer
|
|
|
|
0x1B px.s16 py.s16 pz.s16 vx.s16 vy.s16 vz.s16 time.u16 (S->C) @
|
|
throw grenade
|
|
|
|
px,py,pz is the start position (11:5)
|
|
vx,vy,vz is the velocity (8:8)
|
|
|
|
time/100 is how long in seconds until the grenade explodes
|
|
|
|
0x1C @
|
|
show red circles on map
|
|
|
|
0x1D pid.u8 @
|
|
reload gun
|
|
|
|
TODO: make the ammo counts serverside
|
|
|
|
0x1E msg.z (C->S) @
|
|
send squadchat message
|
|
|
|
0x1F team score.u16 (S->C) @
|
|
update team scores
|
|
|
|
0x20 x.u16 y.u16 z.u16 damage.u16 @
|
|
damage a block
|
|
|