News:

Beta test the new forum at https://simutrans.forum/
Use the "Forum Search"
It may help you to find anything in the forum ;).

The size of cities after map creation.

Started by inkelyad, May 30, 2010, 07:24:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

inkelyad


jamespetts

Inkelyad,

this looks very interesting, although I haven't had a chance to try it yet as I'm currently away from home. Looking at your patch, it doesn't seem that this is specific to Simutrans-Experimental, and could work equally well in Simutrans-Standard. I'll move the topic to the standard development and bug reports, patch releases folder so that the Standard developers can have a look at this one. I shall also have a look at it when I get the chance, if it hasn't already been slated for inclusion in Standard by then.

Edit: May I ask - how does it work for you when you test it?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

The current generation is already 25000*mean_number/(simrand(20000)+100) (the 100 is just to avoid too large towns). Thus this is already close to said distribution.

jamespetts

Inkelyad,

do you notice a major difference in practice between the original version and your version when maps are generated?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

inkelyad

#4
In current implementation there is almost 10% chance city population will
be greater then mean_number * 10. When city number is 22 that means there is
only 10% chance map will have less then 7 such cities. It is way too often.

Zipf's distribution don't do that. It creates only one big city.


jamespetts

Inkelyad,

can you give some examples of the maps created with and without your patch - either in a table or with screenshots? It's hard to gauge the effect without a little more detail.

Prissi - in your opinion, is Inkelyad right about the difference in distribution between the model in this patch and that in Standard; and which do you think is closer to reality?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

inkelyad

Sorry, my math was wrong. But current implementation really too often makes too big cities.

jamespetts

Quote from: inkelyad on May 31, 2010, 04:41:27 PM
Sorry, my math was wrong. But current implementation really too often makes too big cities.


The maths in your patch, in your explanation of the patch, or both? Does that mean that we should not use your patch?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

inkelyad

Math in explanation. I am wrong about "When city number is 22 that means there is
only 10% chance map will have less then 7 such cities".

prissi

In you link Zipf distribution is Pn = 1/n (when alpha=1 what should be often the case, according to the text.) That is exactly the code implemented in Simutrans.

The only difference is, that Pn is limited between 25*mean_number < generated number < 0.124 * mean_number. There is a 10% chance for a city larger than 1,19 than mean_number, and a 5% chance for 2.27*mean_number, and a 1% chance for 8.333*mean_number. The probability for a city larger than 10x mean_number is actually 0,66%, i.e. you need on average more than 150 cities until one is larger than 10x mean_number.

Since those are random numbers, you milage may vary ...

jamespetts

I'm still not clear on how the patch differs in practice from the current Simutrans implementation...
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

A short glance at the algorithm would indicate, that you would always have a guranteed Zipf distribution on your map (with some small jittering) compared to the current, more random one (especially for small number of towns). As this is noticeable in practice: just patch and see.

inkelyad

Quote from: jamespetts on May 31, 2010, 04:32:28 PM
can you give some examples of the maps created with and without your patch - either in a table or with screenshots? It's hard to gauge the effect without a little more detail.
Yes. See attached OpenOffice OpenDocument Spreadsheet

prissi

Actually, standard has a better Zipf distribution, the slope is exactly -1 ... The main difference between the patch and the unpatched version is, that the mean number is effectively 2.5 higher than in the patched version (well, more precisely rising from 2 to 2.8, since the slope differs a little.) All in all the effect of this patch can be achieved by dividing the mean_citicen number by 2.4 before starting creation.

jamespetts

Prissi,

thank you very much for the graphs - most useful!

Inkelyad,

did you intend for your patch to have the effect that Prissi describes?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

I just plotted Inkelyads data; so the credit should go to him ...

inkelyad

#16
Quote from: prissi on May 31, 2010, 08:30:48 PM
The probability for a city larger than 10x mean_number is actually 0,66%, i.e. you need on average more than 150 cities until one is larger than 10x mean_number.
There is something wrong here. See attached data(100 rows 50 cities each). Rank 1 cities larger then 10*mean_number are too common in "Standard".
Quote from: prissi on June 01, 2010, 09:25:21 PM
The main difference between the patch and the unpatched version is, that the mean number is effectively 2.5 higher than in the patched version (well, more precisely rising from 2 to 2.8, since the slope differs a little.)
I beliveve main difference is Rank 1 distributions (see images)

inkelyad

#17
Quote from: jamespetts on June 01, 2010, 10:50:50 PM
did you intend for your patch to have the effect that Prissi describes?
No.
It is hard to get proper "city and satellite towns/villages" map in current implementation. Rank 1 sizes are "too random".

The goal was to correct it.

But it seems to me I was too successful. Now randomness is too small.

jamespetts

Quote from: inkelyad on June 05, 2010, 02:11:30 AM
No.
It is hard to get proper "city and satellite towns/villages" map in current implementation. Rank 1 sizes are "too random".

The goal was to correct it.

But it seems to me I was too successful. Now randomness is too small.

Hmm - perhaps a happy medium is to be sought...?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

inkelyad

Quote from: jamespetts on June 05, 2010, 12:04:52 PM
Hmm - perhaps a happy medium is to be sought...?
Ok. New version. Now number of 'big cities' is player configurable.
Option is not persistent yet. I don't want break option savefile compatibility.

jamespetts

Interesting... can you give some worked examples with map generation with various options?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

inkelyad

Map size: 512x512
Median population: 5000
Number of cities: 50
Number of big cities: 1, 5 and 30

inkelyad

Map size: 512x512
Median population: 3000, 8000 and 16000
Number of cities: 50
Number of big cities: 3

inkelyad

Map size: 128x128
Median population: 1600
Number of cities: 30
Number of big cities: 1, 5 and 20

jamespetts

That's very interesting indeed. I do like the customisability of the new system (which adds something to the existing model). I'd be very interested in people's views on whether this is a good idea, as I'm considering incorporating it into Simutrans-Experimental, if it hasn't already been put into Standard.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

vilvoh

I like the idea. Taking a look at the graphics, for me it's clear that standard Simutrans tends to create much more small cities than large ones. It has sense if you want to power the possibilities of the map. Small cities means less developed areas and more margin for the player to expand the game (put more effort into making cities grow). On the other side, Zipfs customizable maps may add some pepper to the initial conditions of the sceneario. The variety that zipfs generates is flexible but also balanced enough to make the initial conditions interesting.

Imho, you should include it at STExp and if players like it, I would estimate the inclusion in ST, too.

Escala Real...a blog about Simutrans in Spanish...

prissi

As it is in experimental and adding another rather difficult parameter to the city creation, I move this to incoporated.