The International Simutrans Forum

 

Author Topic: New city placement function  (Read 4194 times)

0 Members and 1 Guest are viewing this topic.

Offline inkelyad

  • Devotees (Inactive)
  • *
  • Posts: 482
  • Languages: EN, RU
New city placement function
« on: July 05, 2010, 06:54:46 PM »
From my topic about new city placement function:
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10622
  • Languages: De,EN,JP
Re: New city placement function
« Reply #1 on: July 05, 2010, 07:53:41 PM »
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.

Offline sojo

  • Devotees (Inactive)
  • *
  • Posts: 851
  • Maintainer pak96.comic
    • German home of Simutrans
Re: New city placement function
« Reply #2 on: July 06, 2010, 12:12:46 PM »
I like this both screenshots. :) Nice idea.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20762
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: New city placement function
« Reply #3 on: July 07, 2010, 04:39:28 PM »
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.

Offline inkelyad

  • Devotees (Inactive)
  • *
  • Posts: 482
  • Languages: EN, RU
Re: New city placement function
« Reply #4 on: July 07, 2010, 05:25:12 PM »
Right now I make profiling data. It is not that slow. For example(20 maps, 512x512, 50 cities):
Code: [Select]
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.
« Last Edit: July 07, 2010, 05:40:56 PM by inkelyad »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20762
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: New city placement function
« Reply #5 on: July 07, 2010, 05:59:17 PM »
How does that compare to the profile for city generation in Experimental without that patch applied?

Offline inkelyad

  • Devotees (Inactive)
  • *
  • Posts: 482
  • Languages: EN, RU
Re: New city placement function
« Reply #6 on: July 07, 2010, 06:40:30 PM »
I not finish profiling yet. But does it really matter? It just 5 seconds out of 500.