Python Warcraft 3 Replay Parser for OS X
Written by John Rozewicki   
Monday, 23 February 2009
This is a mess of a program that I've written, but it has worked on every replay I've thrown at it. There are already other better replay programs available for Windows, but getting them to work properly in OS X can be a headache. I wanted to be able to get my actions per minute without opening Wine or VMWare. So, on Saturday morning I set out to write my parser. It was finished tonight, Monday. I'd say that's a pretty good turnaround time for something that parses such a complicated file format.

Here's a sample command line for it:

python PyWC3APMCalc.py "/Applications/Warcraft III Folder/Replay/Replay.w3g"

To use the program a little bit easier:
  1. Open up Terminal
  2. Type "python", and add a space.
  3. Drag PyWC3APMCalc.py to the terminal window.
  4. Add a space, if necessary.
  5. Drag your replay file to the terminal window.
  6. Hit enter.
  7. Brag about APM to all your friends.
Download, and leave comments on bugs.
Trackback(0)
Comments (8)add comment
...
written by Neel , April 08, 2009

Hi,

Thanks for a wonderful APM calculator. It ran without any hitches the first few times, but after 3-4 replay's that got parsed it kept on giving me the following error.

Traceback (most recent call last):
File "PyWC3APMCalc.py", line 376, in
GameType = PullGameType(FirstPlayerRecordNull, EncodedStringNull)
File "PyWC3APMCalc.py", line 56, in PullGameType
GameType = GameTypeDict[struct.unpack_from('B', DecompressedData, EncodedStringNull 5)[0]]
KeyError: 66

All the replays (including the ones that worked) are from the latest version of warcraft. Seeing as this post is quite recent, I'm assuming your program should work for them.

Any ideas?

...
written by Bob Chance , April 09, 2009



That's not necessarily true, since the newest patch (1.23a) was released just recently in March. Therefore it's quite possible that it can't pass the newest replay files from the latest patch (All the other replay analyzing apps for Windows that I've run also have problems).

That said, it has worked for me flawlessly for replays generated from the newest 1.23a patch. I also tested it on Windows, so I'm unsure if the error has something to do with how Mac behaves.

Also, if the error doesn't re-occur if you simply re-run the script, that's a viable work around.

Just my 2 cents smilies/smiley.gif.

-------

By the way John, thanks for the parser script!

...
written by Bob Chance , April 09, 2009

Just to add on to my last post, it seems that while the script is compatible with 1.23a replay files, it doesn't seem to work for 1.22a (and perhaps earlier, as well?).

I guess this is to be expected as the replay file structure seems to have changed between 1.22a and 1.23a.

...
written by Rafael Almeida , April 11, 2009

That script was very helpful. I'm using windows, though. So I took the liberty of adding a rudimentary TK interface to it. It sure makes my life easier on windows. I hope you enjoy: http://tinyurl.com/c6qcjq

...
written by Bob Chance , April 13, 2009

Just an update, I also ran into Neel's problem, and what helped was to simply comment out that line and instead specify explicitely what "GameType" will be (it's a list, with the first element being private/public, and the second being the game type "ladder/custom").

Furthermore, it seems that sometimes the script has problems pulling out the "CreatorName", so specify that manually as well and you should be fine smilies/smiley.gif.

I did, however, run into another error which I will reproduce below:
-------------------
Traceback (most recent call last):
File "pywc3apmcalc.py", line 406, in
Result = ReplayDataParser[ReplayDataHead[0]]()
File "pywc3apmcalc.py", line 131, in ParseTimeSlotBlock
Result = ActionDataParser[ActionDataHead[0]](actionblock,actionb lockpos)
KeyError: '\x00'
---------------

This error has only occured once (with a 1.22a replay), and I don't currently know how to fix it.

...
written by Mung , September 02, 2009

Thanks for making this! Was looking for a APM calc for Mac, and really glad I found this. It was working perfectly until I upgraded to Snow Leopard.. now getting some errors.. maybe the python version changed?

Python Warcraft 3 APM Calculator
by John 'Erlog' Rozewicki ( This e-mail address is being protected from spam bots, you need JavaScript enabled to view it )


Traceback (most recent call last):
File "apm_calc.py", line 346, in
Header = struct.unpack('LLLLL', Replay.read(20))
struct.error: unpack requires a string argument of length 40


...
written by Mykolas , November 21, 2009

hi i am using snow leopard and patch 1.24b and i get Mykolas-Kunickass-MacBook:~ Mykolas$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> /Users/Mykolas/Downloads/PyWC3APMCalc/PyWC3APMCalc.py /Applications/Warcraft\ III\ Folder/Replay/replay.w3g
File "", line 1
/Users/Mykolas/Downloads/PyWC3APMCalc/PyWC3APMCalc.py /Applications/Warcraft\ III\ Folder/Replay/replay.w3g
^
IndentationError: unexpected indent


could you please help me ?? am i doing something wrong or just it doesnt work with 1.24b and snow???

...
written by matt , January 30, 2010

Works fine for the latest TFT version as of January, 30th.

Cheers mate!


Write comment
password
 

busy
 
< Prev   Next >