User Guide

3D Gamestudio Programmer's Manual
© Conitec July 2002
12
The A5 Client/Server Protocol
The protocol is optimized for using as less bandwidth as possible. Only parameters that have
changed are sent over the network. Sending a player's changed XYZ coordinate from the server
to the client, for instance, needs only 12 bytes (including header). A dead reckoning mechanism
is used for extrapolating positions and angles between cycles.
The structure of the messages is a single-byte code, followed by code-dependant informations.
When describing the content of messages, we use the following conventions:
Byte =
an unsigned integer, on one byte.
Short =
a signed integer, on two bytes, Big Endian order (Intel order).
Long =
a signed integer, on four bytes, Big Endian order (Intel order).
Float =
a floating point number, on four bytes, Big Endian order (Intel order).
Fixed =
a fixed point number in 22.10 format, on four bytes, Big Endian order (Intel order).
String =
a sequence of characters, terminated by 0 ('\0')
Angle =
a short, to be multiplied by 360.0/65535.0 to convert it to degrees.
Position =
a coordinate packed in three bytes by dividing it by 8
CPosition =
either
Position
or
Fixed,
depending on the
pos_resolution
variable
Scale(x) =
a value packed into one byte to be multiplied by x/255.0.
Client Messages
The following commands are used for transferring information from a client to the server.
Command Bytecode Arguments Description
cls_fill 0x01
Filler byte for inflating UDP
messages to a minimum length.
cls_join 0x02 Long Player_DPID
String Player_Name
Request for joining the session
(TCP).
cls_create 0x03 Long Player_DPID
String File_Name
Position Start[3]
Short Action_Index
Short Identifier
Request creating an entity with
given model name, and link the
client to it (TCP).
cls_remove 0x04 Long Entity_DPID
Request removing entity on the
server (TCP).
cls_ping 0x07 Long Player_DPID
Sent after each client frame (UDP). If
a client does not send anything for
more than 5 seconds, it is
automatically disconnected by the
server.
cls_level 0x09 Long Player_DPID
String Level_Name
Inform server that client has loaded
a level (TCP).
cls_var 0x0a Short Var_Index
Short Var_Length
Fixed Var[Var_Length]
Send a variable or an array (TCP).
cls_string 0x0b Short String_Index
String Text
Send a string (TCP).