|
I never made a formal TL post about this library, so better late than never.
SC2Replay-CSharp is an open-source library for assisting developers in parsing information in Starcraft 2 replay files. While a work in progress, it can parse lots of useful information including player, team, match information, and chat logs.
Tested to support replays from 1.1.3-1.3.4, but may work with earlier versions.
Let me emphasize: This is intended for developers.
Latest Version: 1.3 Last Updated: 7/12/2011
Contribute on Github.
Releases can be found in the download section on Github, but I recommend compiling the latest version of the code to ensure the most stability with the latest replays.
Please try to submit bugs on the Github issues page, otherwise feel free to comment, make requests, and critique to your liking. Also let me know if you're using this in a project, I'll add you to the list!
Software using this library
+ Show Spoiler +
Changelog:
+ Show Spoiler +v1.3 * Player teams are more reliable for all matchups. * SelectedRace added to Player (shows the race the player selected in lobby, including Random) * Timestamp now reflects the correct time at which the game happened, taking into account Timezones to adjust to proper UTC time.
v1.2 * Fixes issues with Korean text in file names. * Fixes "replay" appearing in namespaces twice.
v1.1 * Korean player names now parse correctly. * Korean chat is now parsed correctly. * Player's BNET IDs and BNET Gateway is now parsed.
v1.0 * Some kind of stable release. I wasn't tracking changes up to this point.
My Other Releases Starboard - SC2 Caster Scoreboard SC2Replay Chat Log Editor SC2 Replay Sync
|
Good contribution to the dev community.
|
Very cool, finally a C# based framework :D
If I can get some spare time I may try to help with this! Thanks for the contribution.
|
Very nice, had a little look at this just now since I was curious about what information is actually stored in a replay (due to MLG comment about not releasing replays). The MpqLib you use is it the one made by Magos?
|
On August 02 2011 18:03 bok wrote: Very nice, had a little look at this just now since I was curious about what information is actually stored in a replay (due to MLG comment about not releasing replays). The MpqLib you use is it the one made by Magos?
Yup, although I'd almost like to move away from it. I know some people who wanted to use this library through Mono, and it's not possible with that library. Also, it can't deal with korean characters in paths (UTF8 not supported I suppose) so I've had to make work-arounds to deal with that.
|
Thanks a lot, I was looking for something like this!
EDIT: I'm not too good at bit fiddling, could you explain what this does?
public static long ParseLongValueStruct(BinaryReader reader) { long l2 = 0;
for (int k = 0;; k += 7) { long l1 = reader.ReadByte();
l2 |= (l1 & 0x7F) << k;
if ((l1 & 0x80) == 0) { return (l2 & 1L) > 0L ? -(l2 >> 1) : l2 >> 1; } } }
|
On August 12 2011 00:23 Qxz wrote:I'm not too good at bit fiddling, could you explain what this does? Show nested quote +public static long ParseLongValueStruct(BinaryReader reader) { long l2 = 0;
for (int k = 0;; k += 7) { long l1 = reader.ReadByte();
l2 |= (l1 & 0x7F) << k;
if ((l1 & 0x80) == 0) { return (l2 & 1L) > 0L ? -(l2 >> 1) : l2 >> 1; } } }
The first bit on every byte in a ValueStruct indicates whether there is another byte to be read. If so, the loop continues and the bits are shifted appropriately.
|
You sir a an amazingly massive BAUS!!
This is awesome!!
|
How have you found all those bits stuff that the BinaryReader use? I am interested to participate but I just do not see where to begin
|
On August 31 2011 00:46 daok911 wrote: How have you found all those bits stuff that the BinaryReader use? I am interested to participate but I just do not see where to begin
A combination of using hex editors to examine the data, porting code from phpsc2replay, and looking at decompiled SC2Gears code. In other words, it's not exactly easy.
|
Wow, this is awesome. I don't program much, but when I do, it's in C# and I'm always finding that it's a pain to find good libraries in C# sometimes, it's nice to see someone making a good SC2 replay library for it.
|
I've made a fork of this library. It needs further testing, but as far as I can tell it's solid.
I reverse engineered replay.game.events from scratch, and I added full events parsing for all versions from 1.1.0 onward. The amount of raw data the library now gives from a replay parse is more than SC2Gears. I also separated the translation of version-specific ids to version-independent enum values into a simple data file system, making version upgrades much easier to deal with.
I documented the technical details of the replay.game.events file on the wiki, for anyone who may be interested.
I'll start testing more rigorously tomorrow (I've only ran through one replay for each patch version, and a few more for 1.4.3), as well as implementing any suggestions you may have.
|
|
|
|