News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

New city placement function

Started by inkelyad, July 05, 2010, 06:54:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

inkelyad

From my topic about new city placement function:
Quote from: Isaac.Eiland-Hall on June 30, 2010, 11:14:38 PM
That's freakin' sweet. Something I hope comes to Standard (as with many Experimental features, but this one stands out for me personally hehehe)

So. Simutrans-Standard port.

prissi

I could live with the water option; but the other require many parameters to handle in the new world dialog. No way to put players off like this. Furthermore the water search seem to me much to heavy. I would have rather build two maps with the lateral distance to the next water. The probability for town generation could then depend directly on this factor without much influence the time needed.

sojo

I like this both screenshots. :) Nice idea.
"English is a easy language. But not for me." ;) sojo

follow simutrans_de on Twitter
- A home for Simutrans (in german)

jamespetts

Thank you for your work on this, Inkelyad. I am thinking of including this in Experimental, but if there is going to be a better algorithm for the water search that is faster (map generation speed is quite important for Experimental, as larger map sizes are to be preferred for more realistic play), then that should be looked into. I am not as worried as Prissi about the number of different settings in the new world dialogue (and, if desirable, they can simply be moved to the "climates" dialogue), but, if performance is seriously impacted on a generation of a map of, say, 3072 * 1024 tiles with 175 - 200 cities, this might be an issue.
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
Right now I make profiling data. It is not that slow. For example(20 maps, 512x512, 50 cities):

index % time    self  children    called     name
---------------------------------------------
               0.95  504.55      21/21          karte_t::enlarge_map(einstellungen_t*, signed char*) [4]
[5]     89.5    0.95  504.55      21         karte_t::distribute_groundobjs_cities(einstellungen_t const*, short, short) [5]
               0.00  429.65   18416/19009       wegbauer_t::calc_route(koord3d const&, koord3d const&) [6]
               0.01   45.47   17346/17346       route_t::calc_route(karte_t*, koord3d, koord3d, fahrer_t*, unsigned int, unsigned int) [20]
               0.00   13.95      21/21          karte_t::create_rivers(short) [41]
               2.50    5.57      21/21          stadt_t::random_place(karte_t const*, vector_tpl<int> const*, unsigned int, unsigned int, short, short) [61]
               0.00    3.20    1001/1001        stadt_t::stadt_t(spieler_t*, koord, int) [101]

my new function(random_place) uses only small % of total map generation time.

jamespetts

How does that compare to the profile for city generation in Experimental without that patch applied?
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

I not finish profiling yet. But does it really matter? It just 5 seconds out of 500.