Network protocol (Worms Armageddon)

From Worms Knowledge Base

Revision as of 15:15, 9 July 2007 by Robi (Talk | contribs) (Packet Commands List)

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 (max is 0x1414, if larger, the header(s) is(are) sent again)
04 Word Command

Length: 6

Packet Commands List

Hex Dec Description
0x00 00 #Chat Message
0x07 07 Password Required (no data)
0x08 08 Sucessfully joined (or password ok) need to figure out what the data means (version of the host ??)
0x09 09 Wrong password (no data)
0x0A 10 Error joining (nickname already used, or missing, or flag missing/incorrect) < need to figure out exact symptoms
0x0B 11 #Player list
0x0D 13 #Custom Scheme data
0x11 17 #Changing Scheme data
0x12 18 #Changing Scheme data
0x13 19 #Changing Scheme data
0x14 20 #Changing Scheme data or #Remove Team ???? wtf
0x15 21 #Changing Scheme data
0x1A 26 #Add Team
0x1B 27 You have been Kicked (no data)
0x1F 31 Default Scheme data
0x2B 43 Monochrome Map

Chat Message

Just a String, 00 Terminated. Normal Text : GLB:FromNick:ALL:Text (when FromNick says "Text")

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

Custom Scheme data

Command: 0x000d (13dec)
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

Still not sure about the weird FFs and 5363 ... any help ?

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.

The packet is sent twice because we often double click to set a scheme, where one click is enough to send the scheme once.

//end of edit//


Default Scheme data

Command: 0x001f (31dec)
Direction: To client
Size: 12
Offset Size Value
00 Word Always 1 ?
02 DWord An identifier for the scheme.
Identifier Scheme
1 Beginner
2 Intermediate
3 Pro
4 ???
5 ???
6 Artillery
7 Classic
8 Armageddon
9 The Darkside
10 ???
11 Retro
12 ???
13 Strategic
14 Sudden Sinking
15 Tournament
16 Blast Zone
17 The Full Wormage


Changing Scheme data

Command: Depends
Direction: To client
Size: 12
Offset Size Value
00 Word Always 0x3E (62dec) ?
02 DWord Value
Command Description
0x11 (17dec) Round Time (Positive = Minutes, Negative = Seconds)
0x12 (18dec) Turn Time (FFFFFFFF = Infinite)
0x13 (19dec) Victories needed
0x14 (20dec) Worm Selection (0 = Disabled ; 1 = Enabled)
0x15 (21dec) Worms HP
0x1D (29dec) Worm Placment (0 = Disabled ; 1 = Enabled)

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 ...

Exemple of a multi-packeted BIT-file :

<01 48 1414 2B00> <A2 01 [E2 34 00 00] [00 00 00 00] [00 14 00 00]> [ 01 00 00 00 { .BIT file DAT } ]

<01 48 1414 2B00> <A2 01 [E2 34 00 00] [00 14 00 00] [00 14 00 00]> [ { .BIT file DAT } ]

<01 9C F60C 2B00> <A5 01 [E2 34 00 00] [00 28 00 00] [E2 0C 00 00]> [ { .BIT file DAT } ]

<Message header> <map header : [total DATA lenght] [offset] [lenght of DATA]> { start 01 for BIT 02 for LEV (need to check this!)?? } [ data ]

size of the .BIT file tested : 13534 bytes = 0x34DE

0x1400 + 0x1400 + 0x0CE2 = 0x34E2

0x34E2 - 0x4 = 0x34DE

Personal tools