Skip to content
Graylin Kim edited this page Jan 18, 2012 · 1 revision

replay.game.events

The replay.game.events file has no header. It consists only of an uninterrupted sequence of game events. Most of these events are unknowns and those that are known are generally poorly processed with little to no information about the event extracted. What little I have found on these events I am including here.

Time stamps

All game events start with a time stamp which represents the number of game frames (16/second) since the last event. So the time stamp is in units of frames rather than seconds. You must convert to get the actual time.

The time stamp is of variable length where the last two bits of the first byte indicate how many more bytes, between 0-3, will follow. These indicator bits are shifted off and the remaining bits become the base of the time stamp. The complete 8 bits from all following bytes are, in turn, added to the back of the time stamp until completion.

Examples:

  • 0A 05 12

    1. The last 2 bits of the first byte are 10 so we can expect 2 additional bytes to follow.

      The base for the time stamp becomes = 0000 10

    2. The next byte is 05 or 0000 0101 so the time stamp becomes = 0000 10 0000 0101

    3. The next byte is 12 or 0001 0010 so the time stamp becomes = 0000 10 0000 0101 0001 0010

    4. For readability we can realign the bytes and pad zeros on the left = 0000 0010 0000 0101 0001 0010

    5. Which is equivalent to 0x020512 which comes out to well over 2 hours (0x020512 (f) / 16 (f/s) / 3600 (s/h)).

      Such a large time stamp would likely never be seen, but acts as a solid example.

Event Header

The event header consists of two bytes. The first byte is broken into two parts:

  • The first 3 bits indicate the event type
  • The last 5 bits indicate the player triggering the event. Just as in the attributes file, Player 16 indicates global events

The second byte serves as the event code and distinguishes between events in each event type.

Processing the Event Body

Each different event is encoded differently and different versions of Starcraft II recorded some of the events differently then in previous versions. To deal with this, the event type, event code, and build number of the replay must also be taken into consideration when determining how to parse the rest of the event. All events fall into one of 6 different groups, determined by the event type. Each event type has its own wiki page which further documents the event formats.

Clone this wiki locally