News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Extract save game data?

Started by Spacethingy, December 13, 2013, 02:54:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spacethingy

It's a long story, but I'm doing Zipf's Law and I want to play Simutrans too, sooooooo......


Is there any way of magically plucking city size data out of a save file? I've had a go with setting the save type to .xml, but even with a relatively small map, Chrome takes about 10 minutes to render it (and none of it makes even the remotest sense...), and Excel/Gnumeric just crash.


In an ideal world, I'd like a little "export data" button ingame, but I have a feeling that may be a heck of a lot of work for very little gain...  ;D


Thanks for any suggestions!


EDIT:
This is a small map's 13 cities that are connected to my network, x=log(rank) y=log(population)
Not a bad correlation already!
Life is like a Simutrans transformer:

You only get one of them, and you can't have it on a slope.

Dwachs

You can write a pseudo-scenario script to export the numbers.

See attached file. Unpack this into <your pakset>/scenario. Use nightly r>=6980. Start with '-debug 2 -log 1'. Open your savegame. Then start the scenario:
Options -> Load Scenario -> world_stats. The scenario prints the size of the cities to the log-file.
Parsley, sage, rosemary, and maggikraut.

An_dz

Amazing, those scenario scripts are powerful.

But just to answer the xml:
All cities are <![CDATA[]]> tags followed by a <koord> tag.
The city size is the first <i64> tag.

Spacethingy

Thanks guys, I'll try it when r6980 compiles tonight. Didn't know the scripting system was going to be so powerful and useful!
Life is like a Simutrans transformer:

You only get one of them, and you can't have it on a slope.

Spacethingy

#4
...and work it does, awsome! That's dead useful.


So, a little analysis of 15ish of the pak64 III server's biggest cities:



The gradient of the trendline could be approximated to -1/6, implying that the population of a city on the server is roughly inversely proportional to the sixth root of it's rank on the city size list.

Or very roughly:


Darn, I love Simutrans...  8)

Edit: woops, used wrong log base.
Life is like a Simutrans transformer:

You only get one of them, and you can't have it on a slope.