Savegame file format

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Bjørn
Engineer
Engineer
Posts: 4
Joined: 02 Jan 2014 02:15

Savegame file format

Post by Bjørn »

Is there somewhere in the documentation a description of the format of the save file, or must I dig through the source to piece it together?
I would like to make a small standalone utility to display information about a saved game, not unlike what already exists for grf files.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Savegame file format

Post by Alberth »

The format is not stable, every now and then a setting gets added, changed, or removed, and we get a new savegame version.
I don't know all the details, but basically it is a compressed chunk-like format, the code lives in src/saveload.

It may be easier to extend the load GUI to display additional information (but not sure about that either).
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Savegame file format

Post by frosch »

Maybe this can also give you some hints:
http://devs.openttd.org/~frosch/scndeps.c

It lacks support for compressed savegames though, so effectively is not useable at all :p
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Bjørn
Engineer
Engineer
Posts: 4
Joined: 02 Jan 2014 02:15

Re: Savegame file format

Post by Bjørn »

Thanks for the help. This looks messier than I had imagined. Was the format originally designed to be deliberately difficult to decode (in the old proprietary game)?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Savegame file format

Post by planetmaker »

Bjørn wrote:Thanks for the help. This looks messier than I had imagined. Was the format originally designed to be deliberately difficult to decode (in the old proprietary game)?
I don't think so. See also an old analysis of the TTD savegame format at http://marcin.ttdpatch.net/sv1codec/TTD-locations.html
It's quite efficient and doesn't waste space as it was written in a time where disk space was still measured in kilo- and Megabytes instead of Giga- and Terabytes.
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Savegame file format

Post by Eddi »

it's certainly not difficult, it's clearly structured (RIFF), just needs a lot of metainformation that is not stored in the file itself (but in the algorithm decoding it)

add to that the compression using standard libraries
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Google [Bot] and 19 guests