editing a save file

You can get help here if Freeciv doesn't start on your computer, or if you keep getting fatal errors while playing etc.
Post Reply
djconklin
Veteran
Posts: 85
Joined: Wed Feb 06, 2013 3:45 pm

editing a save file

Post by djconklin »

What program will open a saved game file?

What do I look for to edit the research of the various players?
User avatar
VladimirSlavik
Posts: 47
Joined: Thu Aug 27, 2015 7:27 am

Re: editing a save file

Post by VladimirSlavik »

It's a compressed plain text file. See for yourself...
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: editing a save file

Post by sveinung »

djconklin wrote:What program will open a saved game file?
It is, as VladimirSlavik said, a compressed text file. Just decompress it and open it in a text editor. Some text editors, like GNU Emacs, can load and edit the compressed file.
djconklin
Veteran
Posts: 85
Joined: Wed Feb 06, 2013 3:45 pm

Re: editing a save file

Post by djconklin »

>Just decompress it and open it in a text editor.

Therein lies the problem: how do I decompress it?
djconklin
Veteran
Posts: 85
Joined: Wed Feb 06, 2013 3:45 pm

Re: editing a save file

Post by djconklin »

VladimirSlavik wrote:It's a compressed plain text file. See for yourself...
All I see is garbage when I try to open it with a text editor.
User avatar
JTN
Elite
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: editing a save file

Post by JTN »

It's compressed with Unixy tools, as indicated by the file extension (.gz, .bz2, .xz).

If you're on a Linux system, you will likely find the tools you need to uncompress it (gunzip, bunzip2, unxz) already installed. If you're on Windows, you'll have to look further afield for suitable decompession tools.

If you have control of the generation of the save file, you can ask for it to be saved uncompressed ("/set compresstype plain", or equivalent from the client's "server settings" UI).

(To anticipate possible next question: we don't formally document the format of the save file, or how it changes between major releases.)
djconklin
Veteran
Posts: 85
Joined: Wed Feb 06, 2013 3:45 pm

Re: editing a save file

Post by djconklin »

Cute! I have no idea what this says: https://msdn.microsoft.com/en-us/librar ... s.85).aspx
User avatar
VladimirSlavik
Posts: 47
Joined: Thu Aug 27, 2015 7:27 am

Re: editing a save file

Post by VladimirSlavik »

On Windows... Somewhat confusingly, to manage compressed files, you need to install an "archive manager" tool, such as winzip, winrar, peazip, 7-zip etc. All of these support reading a lot of formats, including these that freeciv uses (gz, bz2).

Once you have one installed, right click the save file; the menu should offer something like "decompress", "extract" or so. (It might be hidden in a submenu.) Use that and you will get the plain text file. Happy reading and editing!

Note that freeciv can read the saves uncompressed just fine, so there's no need to mess with re-compressing the file once you're done.
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: editing a save file

Post by sveinung »

sveinung wrote:Some text editors, like GNU Emacs, can load and edit the compressed file.
Clarification: GNU Emacs can load and edit the compressed file directly (without you having to decompress it manually first). Most other text editors require you to first decompress the savegame and then edit the decompressed file.
djconklin
Veteran
Posts: 85
Joined: Wed Feb 06, 2013 3:45 pm

Re: editing a save file

Post by djconklin »

VladimirSlavik wrote:On Windows... Somewhat confusingly, to manage compressed files, you need to install an "archive manager" tool, such as winzip, winrar, peazip, 7-zip etc. All of these support reading a lot of formats, including these that freeciv uses (gz, bz2).

Once you have one installed, right click the save file; the menu should offer something like "decompress", "extract" or so. (It might be hidden in a submenu.) Use that and you will get the plain text file. Happy reading and editing!

Note that freeciv can read the saves uncompressed just fine, so there's no need to mess with re-compressing the file once you're done.
THANK YOU!
Post Reply