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

The replay.sync.events file is a fixed width file format with 5 bytes per event. These events occur every 4 seconds for the duration of the game. The first 2 bytes of each event appear to always be 01 40 with the remaining 3 bytes being some random nonsense.

Current conjecture makes this 3 byte code a checksum or pseudo random number of sorts that is used to validate the game state and prevent cheating or bootleg servers, or some such thing. Presumably the events are sent by the battle.net server.

You can take a look yourself:

from pprint import PrettyPrinter
from sc2reader.utils import ReplayBuffer

events1 = list()
#First extract the file using mpyq -x test_replays/1.4.0.19679/Backwater+Gulch.SC2Replay
file1 = "Backwater+Gulch/replay.sync.events"
with open(file1) as syncfile:
    buff = ReplayBuffer(syncfile)
    while buff.left:
        events1.append(buff.read_hex(5))

events2 = list()
#First extract the file using mpyq -x test_replays/1.4.0.19679/The Boneyard (9).SC2Replay
file2 = "The Boneyard (9)/replay.sync.events"
with open(file2) as syncfile:
    buff = ReplayBuffer(syncfile)
    while buff.left:
        events2.append(buff.read_hex(5))

print "{0}\t{1}\t{2}".format(len(events1), len(events2), float(len(events1))/len(events2))

# Use sc2printer --length path/to/file to look up the replay durations
print "18:40\t9:54\t{0}".format( float(18*60+40)/float(9*60+54) )
print float(18*60+40)/280

#-------------------------------

280     148	1.89189189189
18:40	9:54	1.88552188552
4.0

You could also extract the files from the replay inside the script, if you make the edits to do so please post them here (its not hard).

Clone this wiki locally