• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:13
CEST 11:13
KST 18:13
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
uThermal's 2v2 Tour: $15,000 Main Event10Serral wins EWC 202544Tournament Spotlight: FEL Cracow 202510Power Rank - Esports World Cup 202580RSL Season 1 - Final Week9
Community News
Weekly Cups (Aug 4-10): MaxPax wins a triple3SC2's Safe House 2 - October 18 & 195Weekly Cups (Jul 28-Aug 3): herO doubles up6LiuLi Cup - August 2025 Tournaments5[BSL 2025] H2 - Team Wars, Weeklies & SB Ladder10
StarCraft 2
General
Weekly Cups (Aug 4-10): MaxPax wins a triple Real talk: we need to stop nerfing everything Geoff 'iNcontroL' Robinson has passed away Serral wins EWC 2025 uThermal's 2v2 Tour: $15,000 Main Event
Tourneys
Global Tourney for College Students in September RSL: Revival, a new crowdfunded tournament series SC2's Safe House 2 - October 18 & 19 Sparkling Tuna Cup - Weekly Open Tournament LiuLi Cup - August 2025 Tournaments
Strategy
Custom Maps
External Content
Mutation # 486 Watch the Skies Mutation # 485 Death from Below Mutation # 484 Magnetic Pull Mutation #239 Bad Weather
Brood War
General
ASL20 Pre-season Tier List ranking! Simultaneous Streaming by CasterMuse StarCon Philadelphia Player “Jedi” cheat on CSL ASL Season 20 Ro24 Groups
Tourneys
[Megathread] Daily Proleagues KCM 2025 Season 3 Small VOD Thread 2.0 [ASL20] Online Qualifiers Day 2
Strategy
Fighting Spirit mining rates [G] Mineral Boosting Simple Questions, Simple Answers Muta micro map competition
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Total Annihilation Server - TAForever Beyond All Reason [MMORPG] Tree of Savior (Successor of Ragnarok)
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread [\m/] Heavy Metal Thread [Manga] One Piece Movie Discussion! Korean Music Discussion
Sports
TeamLiquid Health and Fitness Initiative For 2023 2024 - 2025 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment" Computer Build, Upgrade & Buying Resource Thread
TL Community
TeamLiquid Team Shirt On Sale The Automated Ban List
Blogs
Gaming After Dark: Poor Slee…
TrAiDoS
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
Customize Sidebar...

Website Feedback

Closed Threads



Active: 595 users

sc2replay-csharp - Open-source C# Parsing Library

Forum Index > SC2 General
Post a Reply
Ascend
Profile Joined July 2010
United States120 Posts
July 13 2011 02:10 GMT
#1
[image loading]

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 +
* SC2Replay Chat Log Editor ~ Ascend
* SC2 ChatCloud ~ tomatolicious


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
Caster and Software Developer. Releases: "Starboard" "SC2 Replay Sync" "SC2 Replay Chat Editor" "SC2 C# Replay Parser"
Alabasern
Profile Blog Joined September 2010
United States4005 Posts
July 13 2011 03:26 GMT
#2
Good contribution to the dev community.
Support your esport!
TheAlchemist89
Profile Blog Joined December 2010
160 Posts
July 13 2011 03:29 GMT
#3
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.
bok
Profile Joined April 2011
Sweden5 Posts
August 02 2011 09:03 GMT
#4
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?
Ascend
Profile Joined July 2010
United States120 Posts
August 05 2011 18:56 GMT
#5
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.
Caster and Software Developer. Releases: "Starboard" "SC2 Replay Sync" "SC2 Replay Chat Editor" "SC2 C# Replay Parser"
Qxz
Profile Joined May 2011
Canada189 Posts
Last Edited: 2011-08-11 15:28:58
August 11 2011 15:23 GMT
#6
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;
}
}
}
Ascend
Profile Joined July 2010
United States120 Posts
Last Edited: 2011-08-11 16:25:22
August 11 2011 16:24 GMT
#7
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.
Caster and Software Developer. Releases: "Starboard" "SC2 Replay Sync" "SC2 Replay Chat Editor" "SC2 C# Replay Parser"
Chronald
Profile Joined December 2009
United States619 Posts
August 11 2011 16:26 GMT
#8
You sir a an amazingly massive BAUS!!

This is awesome!!
Got that.
daok911
Profile Joined July 2011
Canada8 Posts
August 30 2011 15:46 GMT
#9
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
Ascend
Profile Joined July 2010
United States120 Posts
September 06 2011 23:27 GMT
#10
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.
Caster and Software Developer. Releases: "Starboard" "SC2 Replay Sync" "SC2 Replay Chat Editor" "SC2 C# Replay Parser"
Bobbias
Profile Blog Joined March 2008
Canada1373 Posts
September 07 2011 00:16 GMT
#11
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.
Furlqt
Profile Joined July 2011
United States23 Posts
Last Edited: 2012-06-24 04:56:39
June 24 2012 04:50 GMT
#12
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.
Please log in or register to reply.
Live Events Refresh
Next event in 1h 47m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SC2_NightMare 30
StarCraft: Brood War
Barracks 1773
BeSt 526
Bisu 490
Tasteless 344
ggaemo 326
actioN 207
EffOrt 134
PianO 111
Killer 110
ZerO 61
[ Show more ]
Backho 57
Sacsri 57
TY 55
Pusan 49
HiyA 46
soO 43
sorry 42
Soma 29
Bale 12
CasterMuse 0
Dota 2
XcaliburYe239
League of Legends
JimRising 426
Counter-Strike
olofmeister1651
Stewie2K620
shoxiejesuss580
allub279
Super Smash Bros
Mew2King136
Westballz37
Heroes of the Storm
Khaldor180
Other Games
summit1g7429
FrodaN2399
ceh9552
Happy288
Fuzer 148
SortOf113
ZerO(Twitch)2
Organizations
Other Games
gamesdonequick848
StarCraft: Brood War
CasterMuse 17
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• davetesta60
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 2
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV296
League of Legends
• HappyZerGling137
Upcoming Events
Wardi Open
1h 47m
Wardi Open
5h 47m
RotterdaM Event
6h 47m
Replay Cast
14h 47m
WardiTV Summer Champion…
1d 1h
RSL Revival
1d 7h
PiGosaur Monday
1d 14h
WardiTV Summer Champion…
2 days
The PondCast
3 days
WardiTV Summer Champion…
3 days
[ Show More ]
Replay Cast
3 days
LiuLi Cup
4 days
Online Event
5 days
SC Evo League
5 days
uThermal 2v2 Circuit
5 days
Sparkling Tuna Cup
6 days
WardiTV Summer Champion…
6 days
SC Evo League
6 days
uThermal 2v2 Circuit
6 days
Liquipedia Results

Completed

StarCon 2025 Philadelphia
FEL Cracow 2025
CC Div. A S7

Ongoing

Copa Latinoamericana 4
Jiahua Invitational
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
uThermal 2v2 Main Event
HCC Europe
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

ASL Season 20
CSLAN 3
BSL Season 21
BSL 21 Team A
RSL Revival: Season 2
Maestros of the Game
SEL Season 2 Championship
WardiTV Summer 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.