Random software: Blizzard parser

September 16, 2015

goblizzard, as described there in the README, is a Golang implementation of parsers for various files related to replays from some video games.

This was just a random fiddling around project — nothing too interesting and sadly inconclusive. I post it here because this blog is in theory about what I'm doing and here is a thing I've done.

These file formats are hilariously complex (e.g. multiple different hash functions and hash tables that are obfuscated; one file header field even indicates the disk sector size) and at one layer they have a bunch of data structures that are encoded in a bitpacked format. (The bitpacked format itself is really strange, as bits are read first from the LSB side of bytes but in MSB order.)

The one perhaps interesting piece of this is some of the code generation. Blizzard published a Python module that includes decoders for these data structures; I wrote code that loaded the Python module, pulled out all the definitions, and generated equivalent Go code. This gives you static typing over the various events, as seen in the API docs.