• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:51
CEST 06:51
KST 13:51
  • 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
[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Firefly given lifetime ban by ESIC following match-fixing investigation5$25,000 Streamerzone StarCraft Pro Series announced4Weekly Cups (June 30 - July 6): Classic Doubles5[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL66
StarCraft 2
General
The SCII GOAT: A statistical Evaluation The GOAT ranking of GOAT rankings Firefly given lifetime ban by ESIC following match-fixing investigation Weekly Cups (June 30 - July 6): Classic Doubles Jim claims he and Firefly were involved in match-fixing
Tourneys
$25,000 Streamerzone StarCraft Pro Series announced FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament RSL: Revival, a new crowdfunded tournament series WardiTV Mondays
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
i aint gon lie to u bruh... ASL20 Preliminary Maps BGH Auto Balance -> http://bghmmr.eu/ [ASL19] Finals Recap: Standing Tall SC uni coach streams logging into betting site
Tourneys
[BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
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
Things Aren’t Peaceful in Palestine US Politics Mega-thread Summer Games Done Quick 2025! Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread Formula 1 Discussion NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
momentary artworks from des…
tankgirl
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 640 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
PiGosaur Monday
00:00
#39
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft464
Nina 211
StarCraft: Brood War
Leta 222
PianO 13
Icarus 12
Noble 9
Dota 2
monkeys_forever752
League of Legends
JimRising 765
Super Smash Bros
hungrybox516
Other Games
summit1g6529
shahzam989
ViBE244
Organizations
Other Games
gamesdonequick45263
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• Berry_CruncH308
• practicex 145
• Hupsaiya 66
• Kozan
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• Diggity6
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• masondota2586
• Rush306
• Stunt274
Upcoming Events
The PondCast
5h 9m
uThermal 2v2 Circuit
11h 9m
WardiTV European League
11h 9m
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
Replay Cast
19h 9m
RSL Revival
1d 5h
ByuN vs SHIN
Clem vs Reynor
OSC
1d 8h
Replay Cast
1d 19h
RSL Revival
2 days
Classic vs Cure
FEL
2 days
OSC
2 days
[ Show More ]
RSL Revival
3 days
FEL
3 days
FEL
3 days
CSO Cup
3 days
BSL20 Non-Korean Champi…
3 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
4 days
RSL Revival
4 days
FEL
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-07-07
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
Underdog Cup #2
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
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.