dannythefool
King
- Joined
- Jul 15, 2009
- Messages
- 657
EDIT: Update 5 from October 25. Improves compatibility with map files and replays that start on a later turn than 0. Added an "alpha" button that switches between three levels of transparency for the borders.
There's now a public web service provided by flexd. If you don't want to go through all the steps below, head over to http://civ5.flexd.net/ and give it a try. Note that background maps aren't supported yet. Get the details from this post.
Old screenshot from update 2:
Script features with changes from this update in bold:
Credits:
The examples have been updated too and they all have rivers now. You will need Safari, Chrome or Firefox, and I'm told that Opera also works; IE doesn't work yet since it doesn't support the HTML5 canvas element and probably one or two other things I'm doing:
Fat Disclaimer!
This is still based on a lot of guesswork, and I really think the replay files are half broken like other parts of the game after looking at them, but I get satisfactory results from all 14 replay files that I have. If you have a replay file that doesn't work, please send it to me! My e-mail address is in the script.
The same goes for localized replays. My native language isn't English, but I play Civ V in English so I only have English replays. To make this script work with localized replays, I need examples to experiment with! Several guesses the script makes depend on the localized event descriptions.
Caveats:
I'm sorry that this isn't very user friendly yet. If you want, you can follow these steps to run the script on your own system:
There's now a public web service provided by flexd. If you don't want to go through all the steps below, head over to http://civ5.flexd.net/ and give it a try. Note that background maps aren't supported yet. Get the details from this post.
Old screenshot from update 2:

Script features with changes from this update in bold:
- See the leader and civ names, the difficulty level, map size and type, advanced game options, enabled victory types (only shown if at least one was disabled), and how the game ended. Please let me know if bad data is displayed for any of these.
- Scrollable list of events as recorded by the game with turn count and text.
- Use map data from a Civ5Map file as background. Rivers are now displayed, too. You can create files in this format from within the game. Load a save game from which you want to visualize the replay, then open the save dialog again. At the bottom, slightly to the left, there is a "Save as Map" button. Unfortunately, replay files don't seem to contain map data, so for now, this is the only way.
- Animated map of tiles changing ownership, including city locations. Now you can pick how transparent the territory borders are rendered. Cities have name tags. Contiguous regions of empires are now rendered as such, and their inside is rendered slightly transparently if a map backdrop is being used.
- Manually step through the history of your empire.
- Score histogram, see how the players' scores developed during the game.
- The script guesses the civ based on the first city each civ founds and uses the same colours as the game if possible (only works with English and French replays - unrecognized civs are still black&white unfortunately).
- The display width of the HTML can be set on the command line.
Credits:
- BotYann has provided a French translation and replay files. Thanks! See instructions below on how to run the script in French mode. If it doesn't work, it's 100% my fault!
- Collin G. has provided some HTML enhancements and replay files. Thanks!
- player1 fanatic suggested a usability change, thanks!
- blind biker suggested a usability change, thanks!
The examples have been updated too and they all have rivers now. You will need Safari, Chrome or Firefox, and I'm told that Opera also works; IE doesn't work yet since it doesn't support the HTML5 canvas element and probably one or two other things I'm doing:
- A gunboat diplomatic victory: http://discordia.erinye.com/civ5replay/alexander.html
- Cathy experimenting on city states, having to restrain Caesar: http://discordia.erinye.com/civ5replay/cathy.html
- Very short deity duel: http://discordia.erinye.com/civ5replay/wu.html
Fat Disclaimer!
This is still based on a lot of guesswork, and I really think the replay files are half broken like other parts of the game after looking at them, but I get satisfactory results from all 14 replay files that I have. If you have a replay file that doesn't work, please send it to me! My e-mail address is in the script.
The same goes for localized replays. My native language isn't English, but I play Civ V in English so I only have English replays. To make this script work with localized replays, I need examples to experiment with! Several guesses the script makes depend on the localized event descriptions.
Caveats:
- All the textual descriptions are created by the game. They have lots of errors, like the leader name being used in place of the civ name, civ name missing after liberating a civ, research pacts showing as TXT_KEY_MISC_PLAYERS_SIGN_RESEARCH_AGREEMENT instead of real English, random punctuation and so on. I can't really fix those, you'll have to live with them.
- There appears to be no good way to distinguish between a tile losing ownership because a city was razed, and a tile reverting to a city state because a city state was liberated. The script makes several guesses based on what contiguous region a reverting tile belongs to, what it belonged to previously, advanced game options, and so on, in order to be able to make razed cities disappear while keeping captured ones on the map. If you have a replay file where this produces the wrong outcome, please send it to me, my address is in the script.
- The script is not really user friendly right now. If nobody beats me to it I may or may not make this into a web service at some point.
- The javascript code is not completely optimized yet.
- HTML files can turn out quite large.
I'm sorry that this isn't very user friendly yet. If you want, you can follow these steps to run the script on your own system:
- Get my replay export script here: http://discordia.erinye.com/civ5replay/civ5replay.py
- If you don't have python, download version 2.x (not 3!) here, then install it: http://python.org/
- Replay files for your completed games are in your user directory, inside "Documents\My Games\Sid Meier's Civilization 5\Replays"
- Copy the replay file you want to view to the same place where you put civ5replay.py (or remember the full path)
- Optional: If you want the terrain to show, you need to export a map using Civilization V. Load a save from any turn from the game you want to replay, then open the save dialog again. Click the "Save as Map" button and pick a name you can remember. Maps end up in the "Maps" directory in the same location where the "Replays" directory is located. Copy the map file to the same place where you put the script if you want.
- Open CMD, and type "cd " plus the path where you put civ5replay.py, e.g. your downloads folder
- Type "python civ5replay.py -H replay.html " plus the name of the replay file (or full path if you didn't copy it here)
- Optional: If you have a Civ5Map file matching the replay, you can add " -m " plus the path to the map file (if you copied it to the same location where the script is, this is just the file name) and the script will include the map as a backdrop.
- Optional: If your replay file is in French, add " -l fr" to the command line. I don't know if this is working, I don't have any French replays! If it isn't working, by all means please send me a replay file I can test this on
- Optional: You can set the width of the canvas element if you want. Add " -w 1600" to make it 1600 pixels wide, etc.
- If all is well, the script will spam you with a list of events as recorded in the replay while it is processing them, it'll eventually finish and write an html file
- If an error happens, please let me know. There's a lot of guesswork involved in this and I'm pretty sure that it won't work for every replay yet, that would just be too strange...
- Open the resulting replay.html file in Safari, Chrome or Firefox