github.com/icza/s2prot (go): Package s2prot is a decoder/parser of Blizzard's StarCraft II replay file format (*.SC2Replay).  s2prot processes the "raw" data that can be decoded from replay files using an MPQ parser such as https://github.com/icza/mpq.  The package is safe for concurrent use.  The package s2prot/rep provides enumerations and types to model data structures of StarCraft II replays (*.SC2Replay) decoded by the s2prot package. These provide a higher level overview and much easier to use.  The below example code can be found in https://github.com/icza/s2prot/blob/master/_example/rep.go.  To open and parse a replay:  And that's all! We now have all the info from the replay! Printing some of it:  Output:  Tip: the Struct type defines a String() method which returns a nicely formatted JSON representation; this is what most type are "made of":  Output:  The below example code can be found in https://github.com/icza/s2prot/blob/master/_example/s2prot.go.  To use s2prot, we need an MPQ parser to get content from a replay.  Replay header (which is the MPQ User Data) can be decoded by s2prot.DecodeHeader(). Printing replay version:  Base build is part of the replay header:  Which can be used to obtain the proper instance of Protocol:  Which can now be used to decode all other info in the replay. To decode the Details and print the map name:  Tip: We can of course print the whole decoded header which is a Struct:  Which yields a JSON text similar to the one posted above (at High-level Usage).  - s2protocol: Blizzard's reference implementation in python: https://github.com/Blizzard/s2protocol  - s2protocol implementation of the Scelight project: https://github.com/icza/scelight/tree/master/src-app/hu/scelight/sc2/rep/s2prot  - Replay model of the Scelight project: https://github.com/icza/scelight/tree/master/src-app/hu/scelight/sc2/rep/model
Keywords: command-line-tool|decoder|parser|replay|replay-header|sc2replay|starcraft-ii-replays