• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Extracting game state information from replays

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
Hi,

What is the standard way to programmatically interface with WC3 replay files to extract arbitrary game state information (e.g. how much gold does Player X have at time T, what is the final unit composition of the winner, what are the sequence of actions taken by the winning player(s), etc.)?

(apologies if this is in the wrong forum)
 
There are specs here for the w3g file:
http://w3g.deepnode.de/files/w3g_format.txt
And the replay actions documentation:
http://w3g.deepnode.de/files/w3g_actions.txt

Essentially, you just follow the format. You can have a struct defined with the dword's and bytes (according to the file specification), and then you read N bytes into the struct, and then you interact with the data.

But I don't know if/how you can check gold. The replay format is actually one of the longer file formats. You may want to look into "Replay Parsers", since they can do the blunt of the work for you.

As for the winning circumstances, that requires a map-specific implementation. The w3g isn't as friendly as a wc3 interface, so you can't necessarily ask it things at random. It has a schedule of "actions" which you can refer to. As such, you can abuse these actions to tell your parser such circumstances. For example, let's say the replay file keeps track of orders. If you want to send a message "40" to represent the winning score, you can order something 40 times and detect it in your replay parser. Of course, it isn't quite that black and white.

Here are some useful links:
http://www.wc3c.net/showthread.php?t=108962
^Just a replay explorer, you may want to check it out. And of course, w3mmd:
http://www.wc3c.net/showthread.php?t=104567
Basically, it provides an interface for doing what I described. You can output some arbitrary "data" that can be subsequently read from the w3g file. Perhaps Replay Explorer can work in combination with it? I don't know. I'm really not an expert on the topic, so that is the best info I can give.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
Thank you for this comprehensive reply.

I've looked at most of the links briefly--the first two seem most relevant, but is all very low level :[

Given what I've seen, would I need to roll my own game state extraction program?

I was hoping I could just get one very large text file that represented the total game state for a given replay, and then parse that to extract the information I wanted. If only life were this simple!

w3mmd cannot be applied retroactively, or can it?
 
Status
Not open for further replies.
Top