Civ 5 save editor

bmaupin

Chieftain
Joined
Aug 12, 2017
Messages
26
I've created a very basic web app to allow changing save game options that normally can't be changed after the game's been started (victory conditions, etc):

https://bmaupin.github.io/civ5save-editor/

It's probably a few years too late, but better late than never!

Here's a screenshot; you can also just click the Demo button to play around with it without having to open a save file:

Spoiler Screenshot :



A few caveats:
  • This is alpha quality so I expect there to be lots of bugs. Feel free to post them here for now and I'll try to look into them. If you have issues with a particular save file please post that too.
  • Works in recent versions of modern browsers. Doesn't work in older browsers such as Internet Explorer.
  • I haven't tested it yet with saves that had mods enabled. I'd love to hear from anyone if it works or not.

Oh, and in case anyone cares, it's open-source :)
 
Last edited:
It's a pretty webpage - how did you code it?

Thanks! First I wrote a javascript library for parsing the save file then once I had that working I created the frontend using React and Material UI. That was actually my motivation for writing it in the first place; I needed to learn React and changing the victory conditions is something I had done in the past using a hex editor (not very fun).

I mentioned it's open-source but I neglected to include the links.

The save file library is here: https://github.com/bmaupin/js-civ5save
The frontend code is here: https://github.com/bmaupin/civ5save-editor
 
Last edited:
Opens in Safari!
How much work would it be to have it show who is in the game? I think that is in the file headers. How about changing the difficulty level?
 
Opens in Safari!

Oh great! No problems with it then? What version of Safari are you using, by the way?

How much work would it be to have it show who is in the game? I think that is in the file headers.

What specifically are you looking for? I think I've seen player names and civilizations when I was working on parsing the file. Oh, and status (human, PC, dead).

How about changing the difficulty level?

This should definitely be doable from a technical perspective. My only concern would be doing the work and then it has no effect on the game. Would you be willing to help me test it? Here's what I propose: if you can send me a save file, I can manually change the difficulty using a hex editor. Then I'll send it back to you. If it seems to work, then I can work on adding it to the app. It might be best if you set the difficulty really low or high, that way the change should be more obvious.
 
Would you mind if I told reddit about this or do you want to do that on your own?

I don't mind. If you could post the link or send it to me I can try to keep an eye on it in case people have issues. At some point I'll probably require that issues be posted through github but for the time being I think I can manage to keep up with a couple forum threads :)

It might be worth mentioning that it's at an early state and may be buggy. I'll probably update the first post in this thread with any issues I find for the time being until I can get them fixed. Thanks for the interest!
 
I'll tell /r/civ5/. Actually on second thoughts could be a better if you did.

For testing could you change this Emperor save to a Deity one?

https://drive.google.com/open?id=0Byx--Bgaa2TKMnFIdGxpNWQ0cG8

I doubt it'll work first time as I'm sure on t0 the AI have already gotten their units and techs and buffs.
 
Last edited:
I'll tell /r/civ5/. Actually on second thoughts could be a better if you did.

I really don't mind if you want to post it. If not, I can do it when I get a chance.

For testing could you change this Emperor save to a Deity one?

https://drive.google.com/open?id=0Byx--Bgaa2TKMnFIdGxpNWQ0cG8

I doubt it'll work first time as I'm sure on t0 the AI have already gotten their units and techs and buffs.

I don't mind editing it, but emperor and deity are only 2 levels of difficulty apart. Do you think it'd be enough to notice the difference? Funnily enough I don't think I've ever played on Deity so I wouldn't really know.
 
Last edited:
I don't mind editing it, but emperor and deity are only 2 levels of difficulty apart. Do you think it'd be enough to notice the difference? Funnily enough I don't think I've ever played on Deity so I wouldn't really know.
Yes, even Imortal to Deity a big jump. The biggest thing is probably the AI gets 2 settlers.
 
Yes, even Imortal to Deity a big jump. The biggest thing is probably the AI gets 2 settlers.

Okay, here you go. Let me know if it seems to have worked.

My guess is it won't change the amount of settlers the AI has since I would imagine those are established before the game is saved. But beyond that I'm curious if it will have any other effects.
 

Attachments

  • Isabella_0000 BC-4000-diety.Civ5Save
    503 KB · Views: 436
One useful feature would be trimming off the bits that look for DLC. Some people buy the Map Packs but then have difficulty sharing files with people that don’t have the same ones, even though the DLC is not needed once the map is generated.

Oh great! No problems with it then? What version of Safari are you using, by the way?
Safari 10.1.2 on OS X 10.12.6.

What specifically are you looking for? I think I've seen player names and civilizations when I was working on parsing the file. Oh, and status (human, PC, dead).
At one point I had ambitions to better the appearance of browsing civ files in the Finder (similar to Windows Explorer). Listing the Civs in the game would be one easy option I figured, since I see that in plain text with the hex editor. But I never had success with manually trimming files, so I quickly gave up. Is the file structure documented anywhere?

Would you be willing to help me test it? Here's what I propose: if you can send me a save file, I can manually change the difficulty using a hex editor. Then I'll send it back to you. If it seems to work, then I can work on adding it to the app. It might be best if you set the difficulty really low or high, that way the change should be more obvious.
Yes, I will help test. I think the main appeal would be for folks who would appreciate more aggressive AIs but cannot handle the starting bonuses. For a trial, I suggest this TSG161_Start.Civ5Save (Prince) and that you bump it up to Deity. That was my most recent low-level game and I have some notes, so I should be able to tell the difference pretty quickly.
 
Last edited:
It didn't crash and it even said Deity on the menu where you load saves, but ingame it was Emperor.

I've been doing some experimenting myself with dynamic difficulty levels. Could I ask how you specifically determined that the game was still effectively emperor please? Assuming you are correct, this seems to imply that the numbers derived from the difficulty level are themselves stored in the save, or that there is a second copy of the difficulty level in the save and this other copy is the one that actually gets used to determine how the game plays.
 
The AI bonuses come in two parts - starting bonuses like 2nd settler and free techs, and ongoing bonuses like a discount on other tech costs. As has been noted in this thread, changing the difficulty in a save game won't affect the first type of bonus, only the second.

I believe if you continued that game you would find the AI's would progress at a deity pace, rather than emperor.

However, your comment "Also the game said it was Emperor" has me worried - you said previously that it said deity on the load screen, where does it say emperor?

The way I expect things to work, only the difficulty level is stored, and this is used (dynamically) to access the correct table of bonus rates from the XML. Your earlier message made me consider the possibility that the values from the table might also be stored, but I don't think that now.
 
I've been doing some experimenting myself with dynamic difficulty levels. Could I ask how you specifically determined that the game was still effectively emperor please? Assuming you are correct, this seems to imply that the numbers derived from the difficulty level are themselves stored in the save, or that there is a second copy of the difficulty level in the save and this other copy is the one that actually gets used to determine how the game plays.

When I met Assurbarnical I didn't get the usual Deity discount on techs and he didn't have 2 cities. Also the game said it was Emperor.

Surely everything is stored in the save, except random seed of course.

I'm definitely no expert on the game or the save file format, but if I had to take a guess, I'd say that the difficulty may be stored in more than one place in the file. For instance, I've seen the map in at least 3 different places in the same save file.

One possibility is that the difficulty is stored in the compressed part of the save file. My code only parses the uncompressed part of the save file, which is at most the first 3% of the file. Handling the compressed part is probably more than I have time for right now, but my code's open-source so someone is definitely more than welcome to build on it.

In my research for parsing the save format, I only remember running across one place where someone was handling the compressed portion of the file: https://github.com/rivarolle/civ5-saveparser. See parser.py for the most of the relevant stuff.
 
It didn't crash and it even said Deity on the menu where you load saves, but ingame it was Emperor. Could you try changing the speed?

Here you go; I changed it to marathon.
 

Attachments

  • Isabella_0000 BC-4000-marathon.Civ5Save
    503 KB · Views: 408
One useful feature would be trimming off the bits that look for DLC. Some people buy the Map Packs but then have difficulty sharing files with people that don’t have the same ones, even though the DLC is not needed once the map is generated.

As you can see in the app, I'm already reading the list of DLC installed. For what you're describing, do you think it'd be as simple as removing DLC in that list? Maybe a simple button that just removes everything in the list? As with changing the difficulty, I don't mind adding it to the app if it works but I'd like to test it manually first. If you could send me a save file I could make an attempt at removing the DLC from it.

Safari 10.1.2 on OS X 10.12.6.

Since you first posted I was able to get access to browser testing courtesy of BrowserStack, and it does seem that it works in Safari starting with version 10. Oddly enough the layout is messed up even though it's fine in all other current browsers, even ones where the app doesn't work. I've looked into it a little bit but not much luck yet.

At one point I had ambitions to better the appearance of browsing civ files in the Finder (similar to Windows Explorer). Listing the Civs in the game would be one easy option I figured, since I see that in plain text with the hex editor. But I never had success with manually trimming files, so I quickly gave up.

I think adding it to the app should be doable, I'm just mostly curious what kind of information you're looking for. Would something like this be enough?:

Players: Shoshone, Morocco, France​

Or perhaps?:

Players: Shoshone (human), Morocco (AI), France (dead)​

Is the file structure documented anywhere?

I poked around very briefly in the SDK but I wasn't able to find anything useful. Pretty much everything I know about the file structure I documented here, including links to other sources I found: https://github.com/bmaupin/js-civ5save/blob/master/wiki/format.md

I also tried to describe the format in markup as best as possible for my code, although it's far from perfect because I'm ignoring what I don't need and there are lots of quirks that I couldn't really describe declaratively (extra bytes are added to specific locations if an expansion pack is installed, for example). That's here: https://github.com/bmaupin/js-civ5save/blob/master/src/Civ5SavePropertyDefinitions.json

Yes, I will help test. I think the main appeal would be for folks who would appreciate more aggressive AIs but cannot handle the starting bonuses. For a trial, I suggest this TSG161_Start.Civ5Save (Prince) and that you bump it up to Deity. That was my most recent low-level game and I have some notes, so I should be able to tell the difference pretty quickly.

phillipwyllie's been doing some testing too but I can't imagine it'd hurt to have some more data points. I've attached the updated save.
 

Attachments

  • TSG161_Start-deity.Civ5Save
    476.5 KB · Views: 336
Top Bottom