• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 15:41
CEST 21:41
KST 04:41
  • 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
BGE Stara Zagora 2025: Info & Preview27Code S RO12 Preview: GuMiho, Bunny, SHIN, ByuN3The Memories We Share - Facing the Final(?) GSL46Code S RO12 Preview: Cure, Zoun, Solar, Creator4[ASL19] Finals Preview: Daunting Task30
Community News
[BSL20] ProLeague: Bracket Stage & Dates9GSL Ro4 and Finals moved to Sunday June 15th12Weekly Cups (May 27-June 1): ByuN goes back-to-back0EWC 2025 Regional Qualifier Results26Code S RO12 Results + RO8 Groups (2025 Season 2)3
StarCraft 2
General
The SCII GOAT: A statistical Evaluation BGE Stara Zagora 2025: Info & Preview Magnus Carlsen and Fabi review Clem's chess game. Jim claims he and Firefly were involved in match-fixing GSL Ro4 and Finals moved to Sunday June 15th
Tourneys
Bellum Gens Elite: Stara Zagora 2025 Sparkling Tuna Cup - Weekly Open Tournament SOOPer7s Showmatches 2025 Master Swan Open (Global Bronze-Master 2) $5,100+ SEL Season 2 Championship (SC: Evo)
Strategy
[G] Darkgrid Layout Simple Questions Simple Answers [G] PvT Cheese: 13 Gate Proxy Robo
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 477 Slow and Steady Mutation # 476 Charnel House Mutation # 475 Hard Target Mutation # 474 Futile Resistance
Brood War
General
Mihu vs Korea Players Statistics BGH auto balance -> http://bghmmr.eu/ BW General Discussion [BSL20] ProLeague: Bracket Stage & Dates Will foreigners ever be able to challenge Koreans?
Tourneys
[ASL19] Grand Finals NA Team League 6/8/2025 [Megathread] Daily Proleagues [BSL20] ProLeague Bracket Stage - Day 2
Strategy
I am doing this better than progamers do. [G] How to get started on ladder as a new Z player
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread What do you want from future RTS games? Path of Exile Mechabellum
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
LiquidLegends to reintegrate into TL.net
Heroes of the Storm
Heroes of the Storm 2.0 Simple Questions, Simple Answers
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Vape Nation Thread European Politico-economics QA Mega-thread
Fan Clubs
Maru Fan Club Serral Fan Club
Media & Entertainment
Korean Music Discussion [Manga] One Piece
Sports
2024 - 2025 Football Thread Formula 1 Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Cleaning My Mechanical Keyboard
TL Community
The Automated Ban List
Blogs
Cognitive styles x game perf…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Poker
Nebuchad
Customize Sidebar...

Website Feedback

Closed Threads



Active: 22270 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
BSL: ProLeague
18:00
Bracket Stage: Day 2
HBO vs Doodle
spx vs Tech
DragOn vs Hawk
Dewalt vs TerrOr
ZZZero.O323
Liquipedia
Fire Grow Cup
15:00
#10 - Playoffs
CranKy Ducklings274
MindelVK57
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 528
IndyStarCraft 229
BRAT_OK 132
ROOTCatZ 123
MindelVK 57
CosmosSc2 49
EnDerr 5
StarCraft: Brood War
Calm 3204
Rain 1929
Horang2 656
ZZZero.O 323
firebathero 175
Aegong 59
PianO 35
League of Legends
Dendi1608
JimRising 508
Counter-Strike
fl0m6548
olofmeister2398
Stewie2K151
Super Smash Bros
C9.Mang07470
Chillindude29
Heroes of the Storm
Liquid`Hasu559
Khaldor239
Other Games
tarik_tv44647
summit1g2490
FrodaN1906
B2W.Neo1000
Pyrionflax194
ArmadaUGS114
ViBE31
Organizations
Dota 2
PGL Dota 2 - Secondary Stream8747
Other Games
gamesdonequick845
BasetradeTV160
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• HeavenSC 59
• Adnapsc2 24
• Dystopia_ 4
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• 3DClanTV 20
• HerbMon 8
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21600
• Ler129
Other Games
• imaqtpie1355
• Shiphtur296
Upcoming Events
Replay Cast
1d 4h
Replay Cast
1d 14h
WardiTV Invitational
1d 15h
WardiTV Invitational
1d 15h
GSL Code S
2 days
Rogue vs GuMiho
Maru vs Solar
Online Event
3 days
Replay Cast
3 days
GSL Code S
3 days
herO vs Zoun
Classic vs Bunny
The PondCast
3 days
Replay Cast
4 days
[ Show More ]
WardiTV Invitational
4 days
Korean StarCraft League
5 days
CranKy Ducklings
5 days
WardiTV Invitational
5 days
Cheesadelphia
5 days
GSL Code S
6 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

Proleague 2025-06-05
BGE Stara Zagora 2025
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
KCM Race Survival 2025 Season 2
NPSL S3
Rose Open S1
CSL Season 17: Qualifier 2
2025 GSL S2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
ECL Season 49: Europe
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025
PGL Bucharest 2025
BLAST Open Spring 2025

Upcoming

CSL 17: 2025 SUMMER
Copa Latinoamericana 4
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
SEL Season 2 Championship
Esports World Cup 2025
HSC XXVII
Championship of Russia 2025
Murky Cup #2
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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.