Network protocol (Worms Armageddon)

From Worms Knowledge Base

Revision as of 00:47, 27 June 2007 by Robi (Talk | contribs) (Map data)

Jump to: navigation, search

General

  • Sizes and offsets are in bytes
  • All offsets are from the start of the packet's data
  • Word size = 2 bytes
  • DWord size = 4 bytes
  • Everything is LSB on the wire

Message header

Offset Size Value
00 Byte 1 for frontend messages, 2 for ingame (compression?)
01 Byte (??)
02 Word Message size
04 Word Command

Length: 6

Join

Joining consists of several steps:

Step 1

Command: 0x0004
Direction: From client
Size: 128
  • Nick at 06, null terminated, ends (last place the null could be) at 22.
  • Gameid (ascii) at 23, null string for IP games.
  • Version at 64, composed of 30 24 F4 (hex)

NB : these 3 parameters are sufficient to enter a game. Everything else can be 0 and it's ok. Figure out what follows.

Step 2

Command: 0x0008
Direction: To client
Size: 6

Acknowledgement. Empty message. Figure out error messages. (different commands?)

Step 3

Command: 0x0005
Direction: From client
Size: 114
  • Nick at 06, null terminated.
  • Flag (+1) at 72 (if 13 is France, then to put French flag, you have to put 13+1 = 0x0E)

Figure out what follows.

Step 4

Server sends:

  • Player list, see below.
  • Team list (when not empty), see below.
  • Map data, see below. (Map is not sent when we rejoin?)
  • A message with command 0x001f? What is it?

Figure out how the scheme is sent here when it's not the default Intermediate

Player list

Command: 0x000b
Direction: To client
Size: 1176

This looks like it's sending a raw array of player structures. Each player structure is 120 bytes in size.

Names are limited to 17 characters, and are padded with 0 bytes. (If a name is exactly 17 characters, there will NOT be a null-terminator) Figure out what the rest is.

Considering there can be 7 players, the total length should be 840 bytes. Array starts at 06, 08 or 0b?

Depending, that leaves 330, 328 or 324 trailing bytes. Figure out what follows (or what is before the array).

Team list

Command: 0x000c
Direction: To client
Size: ??

TODO

Scheme data

Command: 0x000d
Direction: To client
Size: 308

I saw two messages for a single scheme change? Word at 06 is 0x0000 for the first, 0x0007 for the second. Otherwise identical.

DWord at 08 is always 0xffffffff? Byte at 0xd always 0x00?

(Atleast for version 1 scheme:) Scheme starts at 0e. No SCHM header. No version number? 79 bytes after, probably 76 extra for scheme version 2. Remaining 3 are 0x0046ec?

//edit by Robi//

Updating the Scheme :

53 63 FF FF FF FF 00 [ .WSC file starting at offset 5 ] FF FF FF

The size seems to be always 308, so it is always v2 Scheme, if you put a v1 scheme, it is convertised to v2 (padded with 0's) That's why the version isn't in the packet.

Still don't know why it's sent twice though...

//end of edit//

Ready signal

Command: 0x000f
Direction: Both ways
Size: 16

Word at 06 always 0x736e?

DWord at 08 is on/off? DWord at 0b is player number?

Map data

(Atleast for random generated)

Command: 0x002b
Direction: To client
Size: 64

Using a .BIT file (modified with map editor) : when using this, the size of the packet might change depending of the .BIT file A3 01 5B 00 00 00 00 00 00 00 5B 00 00 00 01 00 00 00 [ .BIT file ]

Using a .LEV file (random generated) : A0 01 2C 00 00 00 00 00 00 00 2C 00 00 00 02 00 00 00 [ .LEV file ]

Maybe it's just the same, need to figure out what those mean ...

Personal tools