Reading Civ5Replay files (update: HTML export!)

Thank you so much for this!

I've got a replay from the new Mongol scenario which doesn't quite work with the script. Maybe you could take a look?

There is one small bug in the script that prevents it from producing output, and is easily fixed; the next update will include this fix. But the main problem is that the data is just not there, the replay doesn't contain the cities that exist at the start of the scenario, and that means the script can't even tell which civ is which. It'll figure out Russia and Greece because Russia eventually founds Moscow and Greece eventually founds Athens but that's about it.

I will probably be able to get the missing information from the map included with the scenario, but that'll require a bit more work as I haven't decoded anything beyond what is included in manually saved maps yet.

In general, scenarios and mods seem to be a bit of a problem. The replay files don't nearly include all data required to make pretty pictures, and the script does a lot of guessing, but some of those guesses break when mods and scenarios change the game. For example, the Mongol scenario adds a lot of custom city states...
 
I'm getting the following error on My Save File ... what am I doing wrong?



Traceback (most recent call last):
File "civ5replay.py", line 1778, in <module>
p("Leader:", replay.leader_info())​
File "civ5replay.py", line 1718, in leader_info
self.read_header()​
File "civ5replay.py", line 1247, in read_header
self.difficulty = difficulty_strings[self.difficulty_level]​
IndexError: list index out of range
 
In my infinite wisdom it somehow still manages to turn off whenever i close my laptop. will need to sort that :p Updating it to the latest parser script today :)
 
There is one small bug in the script that prevents it from producing output, and is easily fixed; the next update will include this fix. But the main problem is that the data is just not there, the replay doesn't contain the cities that exist at the start of the scenario, and that means the script can't even tell which civ is which. It'll figure out Russia and Greece because Russia eventually founds Moscow and Greece eventually founds Athens but that's about it.

I will probably be able to get the missing information from the map included with the scenario, but that'll require a bit more work as I haven't decoded anything beyond what is included in manually saved maps yet.

In general, scenarios and mods seem to be a bit of a problem. The replay files don't nearly include all data required to make pretty pictures, and the script does a lot of guessing, but some of those guesses break when mods and scenarios change the game. For example, the Mongol scenario adds a lot of custom city states...

Hmmm ... thanks for taking a look. Too bad the data is simply missing, I hope it's fairly straight forward to get the data from scenario files. Thanks!
 
Moderator Action: Moved to strategy & tips and stickied the thread.

This should be made a sticky IMO. Did the second best thing. Made a link in my signature if you don't mind.

more @all: If you see something worthy, or you see that something should definetely be done, then contact a moderator via private message and ask him to do it.
I had not really payed attention to this thread, but this seems to be an incredibely fine application and the OP has put a lot of work into it, it should be honoured.
-> Next time, alert some about such things.
 
I'm getting the following error on My Save File ... what am I doing wrong?



Traceback (most recent call last):
File "civ5replay.py", line 1778, in <module>
p("Leader:", replay.leader_info())​
File "civ5replay.py", line 1718, in leader_info
self.read_header()​
File "civ5replay.py", line 1247, in read_header
self.difficulty = difficulty_strings[self.difficulty_level]​
IndexError: list index out of range

Getting the same error
 
There is one small bug in the script that prevents it from producing output, and is easily fixed; the next update will include this fix. But the main problem is that the data is just not there, the replay doesn't contain the cities that exist at the start of the scenario, and that means the script can't even tell which civ is which. It'll figure out Russia and Greece because Russia eventually founds Moscow and Greece eventually founds Athens but that's about it.

I will probably be able to get the missing information from the map included with the scenario, but that'll require a bit more work as I haven't decoded anything beyond what is included in manually saved maps yet.

In general, scenarios and mods seem to be a bit of a problem. The replay files don't nearly include all data required to make pretty pictures, and the script does a lot of guessing, but some of those guesses break when mods and scenarios change the game. For example, the Mongol scenario adds a lot of custom city states...

You could get much of the missing data by parsing the savegame instead. It contains all the data from the replay file (except the end of game score) and the map export.. plus a lot more..

It doesnt contain data on extra civs that is contained in mods (would need to parse from xml) ..

And of course... a program that can parse a game in progress, not just a finished game would make it very easy to cheat (specially in MP games) - keep parsing your autosaves and know where you opponent is and what he is up to..
 
First, if the script doesn't work on your files, please do send me your replay, I can't really do anything about it otherwise. I have no documentation on the file formats involved, so I need files that don't work to figure out what the data contained in them means.

You could get much of the missing data by parsing the savegame instead. It contains all the data from the replay file (except the end of game score) and the map export.. plus a lot more..

Yes, the thought has occurred to me... it's just that as far as I can tell, I'm parsing serialized data without access to the source code of the classes that are being serialized. This already involves a lot of guesswork for replay files that have almost no information stored in them. It's worse for maps, and I'm not really too keen on reverse engineering files that start out at hundreds of megabytes for a new game on turn 1 (if you decompress the large block of zlib-compressed data)...

It doesnt contain data on extra civs that is contained in mods (would need to parse from xml) ..

Yes - and this is really hard because there are so many ways to shuffle things around in a mod or a scenario.

And of course... a program that can parse a game in progress, not just a finished game would make it very easy to cheat (specially in MP games) - keep parsing your autosaves and know where you opponent is and what he is up to..

I suppose if you're hell-bent on cheating that way, you could just load the autosave in a separate instance of CiV... I dunno, I don't play multiplayer.
 
The webservice is down for a short while until me and this nginx config have duked it out. I will win, and it will be up soon! :) (famous last words :-D)
 
Right, it's up again. Also noticed the replay parser has been hanging a long while.. Last job run was #78, currently 150 replays uploaded. It's processing as fast as it can now :) Will be pushing some improvements listing replays uploaded and whatnot soon.
 
It has fallen and it can't get back up. Of all the things that could go wrong: 4 out of 5 disks are now complaining about drive errors.. -_- It's all old stuff so i will need to dig up something even older. This gives me time to fix the other stuff that prevents the replays from being parsed at the moment. :) No ETA sorry.
 
This is so awesome. I can't believe I overlooked this almost two months! Replays are about the only reason I actually finish a game once I know I have it the bag. I'm really impressed :worship:
 
Top Bottom