Page 1 of 1

editing a save file

Posted: Thu Aug 31, 2017 5:29 pm
by djconklin
What program will open a saved game file?

What do I look for to edit the research of the various players?

Re: editing a save file

Posted: Thu Aug 31, 2017 8:27 pm
by VladimirSlavik
It's a compressed plain text file. See for yourself...

Re: editing a save file

Posted: Fri Sep 01, 2017 9:55 am
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.

Re: editing a save file

Posted: Fri Sep 01, 2017 5:08 pm
by djconklin
>Just decompress it and open it in a text editor.

Therein lies the problem: how do I decompress it?

Re: editing a save file

Posted: Fri Sep 01, 2017 5:09 pm
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.

Re: editing a save file

Posted: Fri Sep 01, 2017 7:13 pm
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.)

Re: editing a save file

Posted: Fri Sep 01, 2017 8:24 pm
by djconklin
Cute! I have no idea what this says: https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Re: editing a save file

Posted: Sat Sep 02, 2017 5:53 am
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.

Re: editing a save file

Posted: Mon Sep 04, 2017 9:33 am
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.

Re: editing a save file

Posted: Mon Sep 04, 2017 4:31 pm
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!