The International Simutrans Forum

Development => Technical Documentation => Topic started by: ojii on April 01, 2011, 09:33:15 PM

Title: Savefile format
Post by: ojii on April 01, 2011, 09:33:15 PM
Hi everyone

I might be missing some obvious stuff, but are there any docs on the savefile format? I'm asking because while I'm a programmer, I don't know much C++, but I had this nice idea of writing a program that turns savefiles into nice network diagrams, by extracting the lines and station positions from a savefile.

I'm a Python programmer (I know other stuff, but that's what I'm most comfortable with), so I can read binary savefiles as long as I know the structure of it.

Also: As a general programmer, but not necessarily a good C++ programmer, what could I be helpful with in contributing to simutrans?
Title: Re: Savefile format
Post by: jamespetts on April 01, 2011, 09:49:13 PM
Ahh - the save file format is a little haphazard, I'm afraid, and isn't formally documented anywhere. It works by the process of the code writing bytes representing certain data in a particular order and reading them back in the exact same order, with a number of additional complexities (versioning, for example, and groups of data, each of which use data read earlier to determine the format of the data that is to be expected next). I'm afraid that the only way to work out the format is to read the code.
Title: Re: Savefile format
Post by: Ashley on April 02, 2011, 07:46:45 AM
I have done a certain amount of reverse-engineering of this when writing a little utility to parse the results of a gameinfo query. If you (like I) know Python fairly well then reading the relevant bits of the Simutrans code isn't too difficult. I'll try and post later when I have more time with a few pointers to get you started.
Title: Re: Savefile format
Post by: VS on April 02, 2011, 10:31:04 AM
One possibility is to write library that uses directly Simutrans code and interfaces with python. Other than that, you'll be always chasing a moving target, adapting your code to match ongoing changes. There is no documentation, as usual with open source... the source is the reference.