Data Packets

From WoT Developer Wiki
Jump to: navigation, search

Data Packets

When you decrypt and unpack a replay file's extra data (all the stuff past the first blocks), you will be able to parse this as a data stream. The data stream contains what appears to be a direct copy of the data sent to your game client from the WoT server when you are in a match, and can be used to reconstruct the battle result, as well as dumping out the data in a format that can be used to create, say, battle simulators.

Generic Terms

These terms are used throughout this documentation.

  • Packet: A single packet of data
  • Payload: A packets' optional payload of data
  • Clock: This is a timer value indicating the number of milliseconds (or even higher resolution) since the match was started; this does not add up to an even 15 or 10 minutes but includes such time as the 30 second countdown as well as any extra waiting-for-players time.
  • long: My oldfashioned way of saying "uint32"
  • uint32: An unsigned 32 bit integer (4 bytes long)
  • short: My oldfashioned way of saying "uint16"
  • uint16: An unsigned 16 bit integer (2 bytes long)
  • byte: My oldfashioned way of saying "uint8"
  • uint8: An unsigned 8 bit integer (1 byte long)
  • float: A floating point number (4 bytes long)

Generic Structures

Most data packets can contain structured data, most obvious in this case is that a lot of packets contain Python pickled data. You'll have to look for an appropriate unpickler for your favorite language to get the most out of this.

Strings are encoded in Pascal (or Java) format; a leading length indicator followed by the string itself. The length is usually a long, but can sometimes be a short or even a byte, depending on the packet in question.

Generic Packet Layout

Every packet is laid out as follows:

| uint32 | uint32 | float | variable ... |
 |        |        |       | 
 |        |        |       `-- optional payload
 |        |        `-- clock
 |        `-- packet type
 `-- payload size

The payload size can be 0, which means there is no additional payload. The minimum packet size therefore is 12 bytes.

Payload Layout

The payload varies significantly between packets, but the following have been found to be in predictable positions:

  • player/vehicle id: offset 0, type uint32
  • subtype: offset 4, type uint32
  • data length: offset 8, type uint32

Depending on the packet type, the subtype may contain an additional indication what it's used for. The data length will be the number of bytes starting at offset 12 that should be treated as the included data. This data can either be a packed format, or a Python pickle.

Packet List