Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
project:sc2inspector [2011/12/31 10:13] – [Project Log] smarkproject:sc2inspector [2013/03/06 18:05] – [SC2Inspector - C#] smark
Line 1: Line 1:
 ====== SC2Inspector - C# ====== ====== SC2Inspector - C# ======
  
 +===== Synopsis =====
 +
 +This project was originally envisioned to be a C# version of SC2Gears. The goal was to provide an extremely detailed look at the SC2 Replay File format.
 ===== Reference ===== ===== Reference =====
  
Line 86: Line 89:
 |--- 12 (NumberInVLF) - Unknown |--- 12 (NumberInVLF) - Unknown
 `--- 13 (NumberInVLF) - Unknown</code> `--- 13 (NumberInVLF) - Unknown</code>
 +
 +==== replay.attributes.events Sample Data ====
 +
 +| <code>0x0BBF
 +    0x1 - Part
 +    0x2 - Part
 +0x01F4
 +    0x1 - Humn
 +    0x2 - Humn
 +0x0BB9
 +    0x1 - Zerg
 +    0x2 - Terr
 +0x07DC
 +    0x1 - T3
 +    0x2 - T1
 +0x07E2
 +    0x1 - T3
 +    0x2 - T4 </code> | <code>0x07D7
 +    0x1 - T1
 +    0x2 - T2
 +0x0BBB
 +    0x1 -  100
 +    0x2 -  100
 +0x07D6
 +    0x1 - T3
 +    0x2 - T4
 +0x07D2
 +    0x1 - T2
 +    0x2 - T1
 +0x0BBA
 +    0x1 - tc04
 +    0x2 - tc07</code> | <code>0x07D8
 +    0x1 - T1
 +    0x2 - T2
 +0x07D4
 +    0x1 - T1
 +    0x2 - T2
 +0x07D3
 +    0x1 - T2
 +    0x2 - T2
 +0x0BBC
 +    0x1 - Medi
 +    0x2 - Medi
 +0x07DB
 +    0x1 - T1
 +    0x2 - T2</code> | <code>0x07D5
 +    0x1 - T1
 +    0x2 - T2
 +0x03E8
 +    0x10 - Dflt
 +0x0BC0
 +    0x1 - Obs
 +    0x2 - Obs
 +0x0BC2
 +    0x10 - yes
 +0x07E1
 +    0x1 - T3
 +    0x2 - T4
 +0x07D0
 +    0x10 - t2</code> | <code>0x0BB8
 +    0x10 - Fasr
 +0x0BBE
 +    0x10 - 10
 +0x0BC1
 +    0x10 - Priv
 +0x03E9
 +    0x10 - yes
 +0x07D1
 +    0x10 - 1v1</code> 
 +    
 +    
 +    
 +    
 +    
 +    |
 +
 ===== Project Log ===== ===== Project Log =====
-=== 12/31/2011 @ 03: ===+=== 1/2/2011 @ 05:26 === 
 +Ok so I've been working on this most of the day. I've finished the InitData file as well as the AttributesEvents file! It looks like I'm 100% done with the game metadata about the players. Here's all the information I have: {{:project:120102_sc2inspector_replaydetails_locals.png?linkonly|SC2Inspector ReplayDetails Locals}} 
 + 
 +The attributes.events file has kind of an interesting format. This one bit of code pretty much does all the work: 
 +<code csharp>uint NumAttribs = BinaryReader.ReadUInt32(); 
 +uint AttribHeader; 
 +uint AttribId; 
 +int PlayerId; 
 +string AttribVal; 
 +int NumSlots; 
 +for (int i = 0; i < NumAttribs; i++) { 
 + AttribHeader = BinaryReader.ReadUInt32(); 
 + AttribId = BinaryReader.ReadUInt32(); 
 + PlayerId = BinaryReader.ReadByte(); 
 + AttribVal = Conversion.ReverseString(Encoding.Default.GetString(BinaryReader.ReadBytes(4))).Replace("\0", String.Empty); 
 + if (!AttribDict.ContainsKey(AttribId)) { 
 + AttribDict.Add(AttribId, new Dictionary<int, string>()); 
 +
 + AttribDict[AttribId].Add(PlayerId, AttribVal); 
 +
 +if (NumAttribs == 0) { 
 + throw new Exception("Zero attributes."); 
 +}</code> 
 + 
 +I run that code after I read four bytes from the beginning. It splits everything out into what can be used as a multidimensional associative array. Here's some sample data: [[sc2inspector#replayattributesevents_sample_data|replay.attributes.events Sample Data]]. There's some information in there which I'm not sure about either. Either way this segment is done. I FINALLY think that tomorrow I can go ahead and start on replay.events! 
 + 
 +Time to update this table: 
 + 
 +^ Filename ^ Purpose ^ 
 +| replay.details | Contains sometimes inaccurate (?) data about players including their name, RealId, Race, Map name, save time, etc. | 
 +| replay.initData | Contains information about who is playing (names), as well as the Realm, Map hash, and some sort of account identifier. | 
 +| replay.attribute.events | Contains detailed information about the players, their race, difficulty, color, team info, game speed, etc. | 
 +| replay.game.events | Actions | 
 +| replay.message.events | Chat, Ping | 
 +| replay.smartcam.events | Presumably player cameras | 
 +| replay.sync.events | Presumably consistency checks | 
 + 
 + 
 +Committed r7. 
 + 
 +=== 12/31/2011 @ 03:12 ===
 Ok so I've been slacking on my documentation. I have fully parsed all of the documented fields in the replay.details file. Here is what the output looks like: {{:project:111231_sc2inspector_replaydetails_locals.png?linkonly|ReplayDetails Locals Window}} Ok so I've been slacking on my documentation. I have fully parsed all of the documented fields in the replay.details file. Here is what the output looks like: {{:project:111231_sc2inspector_replaydetails_locals.png?linkonly|ReplayDetails Locals Window}}
  
Line 95: Line 214:
  
 Because I went back and modified MPQ\x1B UserData retrieval I was able to successfully extract the actual game playtime. The value that is given is in 1/16s of a second. I do not know where this value comes from. I do know that the current version of Sc2gears (8.8) is displaying incorrect game lengths. It seems to be applying ~1/22 of a second to the values. I verified this by viewing a replay in the StarCraft II client itself. The game time is 20:02 and SC2gears reports it as 14:28. Weird. Because I went back and modified MPQ\x1B UserData retrieval I was able to successfully extract the actual game playtime. The value that is given is in 1/16s of a second. I do not know where this value comes from. I do know that the current version of Sc2gears (8.8) is displaying incorrect game lengths. It seems to be applying ~1/22 of a second to the values. I verified this by viewing a replay in the StarCraft II client itself. The game time is 20:02 and SC2gears reports it as 14:28. Weird.
 +
 +Committed r6.
  
 === 12/31/2011 @ 00:16 === === 12/31/2011 @ 00:16 ===
Line 115: Line 236:
 | replay.smartcam.events | Presumably player cameras | | replay.smartcam.events | Presumably player cameras |
 | replay.sync.events | Presumably consistency checks | | replay.sync.events | Presumably consistency checks |
- 
- 
  
 === 12/30/2011 @ 00:39 === === 12/30/2011 @ 00:39 ===
Line 228: Line 347:
   * SC2Replay-CSharp - https://github.com/ascendedguard/sc2replay-csharp   * SC2Replay-CSharp - https://github.com/ascendedguard/sc2replay-csharp
   * Parsing SC2 Replays - http://www.teamliquid.net/forum/viewmessage.php?topic_id=121694   * Parsing SC2 Replays - http://www.teamliquid.net/forum/viewmessage.php?topic_id=121694
 +  * SC2Reader - https://github.com/GraylinKim/sc2reader/wiki
project/sc2inspector.txt · Last modified: 2013/03/06 18:06 by smark
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0