The network protocol of Ace of Spades is rather simple (even though it hasn't been fully documented yet).
The protocol uses UDP. Pretty much all variables are big-endian (apart from a few), and every datagram packet consists of:
- A 2-byte header, consisting of flags (compressed, has timer), an unique value, and the connection id.
- A 2-byte timer (if the timer flag is set)
- Packets data (this is compressed if the compressed flag is set)
The compression is probably dynamic Huffman (see pyspades for a decompression routine).
Every packet consists of
- 1-byte packet ID (and a flag that's set if an ACK is wanted)
- 1-byte sequence type (0 and 0xFF - basically,
- 2-byte sequence number (used for ACK)
- Packet-specific data
There are 11 different packet types:
- 1 -> ACK
- 2 -> Connection request
- 3 -> Connection response
- 4 -> Disconnect
- 5 -> Ping
- 6 -> Sized data (includes chat messages, sending name, position data, etc.)
- 7 -> Sized unknown (not used?)
- 8 -> Sized map data (sent in chunks)
- 9 -> Unreliable sized data with additional sequence (for orientation)
- 10 -> Unknown (used)
- 11 -> Unknown (not used?)
For the sized data types, there are different packet types for master/server/client. For further reading, see pyspades.
pyspades is a project that attempts to document the protocol and write an alternative server in Python.
It can be found at http://code.google.com/p/pyspades/
The information above was taken from this project. Findings and contributions should be made to pyspades for a better understanding of the protocol.