• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 20:13
CEST 02:13
KST 09: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
RSL Season 1 - Final Week6[ASL19] Finals Recap: Standing Tall15HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0
Community News
Esports World Cup 2025 - Brackets Revealed15Weekly Cups (July 7-13): Classic continues to roll8Team TLMC #5 - Submission extension3Firefly given lifetime ban by ESIC following match-fixing investigation17$25,000 Streamerzone StarCraft Pro Series announced7
StarCraft 2
General
Esports World Cup 2025 - Brackets Revealed Who will win EWC 2025? RSL Revival patreon money discussion thread The GOAT ranking of GOAT rankings Server Blocker
Tourneys
FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament Sea Duckling Open (Global, Bronze-Diamond) RSL: Revival, a new crowdfunded tournament series $5,100+ SEL Season 2 Championship (SC: Evo)
Strategy
How did i lose this ZvP, whats the proper response
Custom Maps
External Content
Mutation # 482 Wheel of Misfortune Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome
Brood War
General
Flash Announces (and Retracts) Hiatus From ASL BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion Soulkey Muta Micro Map? [ASL19] Finals Recap: Standing Tall
Tourneys
[Megathread] Daily Proleagues 2025 ACS Season 2 Qualifier Cosmonarchy Pro Showmatches CSL Xiamen International Invitational
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread CCLP - Command & Conquer League Project The PlayStation 5
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 Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread We are Ready to Testify: Emergence Stop Killing Games - European Citizens Initiative
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Korean Music Discussion Movie Discussion! [Manga] One Piece Anime Discussion Thread [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 NBA General Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Ping To Win? Pings And Their…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 613 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 9h 47m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
JuggernautJason187
Livibee 70
CosmosSc2 66
Dota 2
monkeys_forever1014
NeuroSwarm134
canceldota57
League of Legends
Grubby4570
Trikslyr74
Counter-Strike
oskar260
Super Smash Bros
AZ_Axe111
Other Games
tarik_tv23701
summit1g15281
shahzam603
C9.Mang0199
ViBE168
Skadoodle149
PPMD37
Organizations
Other Games
gamesdonequick1865
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Hupsaiya 65
• RyuSc2 48
• davetesta34
• sitaska34
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota21497
League of Legends
• TFBlade195
Upcoming Events
CranKy Ducklings
9h 47m
Epic.LAN
11h 47m
CSO Contender
16h 47m
Sparkling Tuna Cup
1d 9h
Online Event
1d 15h
Esports World Cup
3 days
ByuN vs Astrea
Lambo vs HeRoMaRinE
Clem vs TBD
Solar vs Zoun
SHIN vs Reynor
Maru vs TriGGeR
herO vs Lancer
Cure vs ShoWTimE
Esports World Cup
4 days
Esports World Cup
5 days
Esports World Cup
6 days
Liquipedia Results

Completed

CSL Xiamen Invitational: ShowMatche
RSL Revival: Season 1
Murky Cup #2

Ongoing

BSL 2v2 Season 3
Copa Latinoamericana 4
Jiahua Invitational
BSL20 Non-Korean Championship
CSL Xiamen Invitational
2025 ACS Season 2
Championship of Russia 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25

Upcoming

CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
BSL Season 21
RSL Revival: Season 2
SEL Season 2 Championship
uThermal 2v2 Main Event
FEL Cracov 2025
Esports World Cup 2025
Underdog Cup #2
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
BLAST Bounty Fall Qual
IEM Cologne 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.