News:

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

New city generation function.

Started by inkelyad, July 03, 2010, 12:46:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

Hmm. Is there a way, do you think, of making sure that all cities have at least one building apart from the city hall?
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

#36
Well, I can hardcode minimum city population.

Better way will be to fix stadt_t::step_bau. But I really don't understand how it should work.

Edit: City hall counts as 4 buildings? Can it be source of problem?
Edit: Most likely it is.
From besch/writer/building_writer.cc:

       } else if (!STRICMP(type_name, "tow")) {
               besch.level = obj.get_int("passengers",  besch.level);
               besch.extra_data = obj.get_int("build_time", 0);


From simcity.h(stadt_t::baue_gebaeude)

       if (h == NULL  &&  sum_wohnung > sum_industrie  &&  sum_wohnung > sum_gewerbe) {
           h = hausbauer_t::get_wohnhaus(0, current_month, cl, new_town);
           if (h != NULL) {
               // will be aligned next to a street
               won += h->get_level() * 10; // woh -- amount with homes
           }
       }


So, from simutrans point of view, people live in city hall.



inkelyad

I have no solution for 'people live in city hall' problem. But I can force cities to have at least one building.
Changes pushed to github.

Second (very small) patch make central part of the new city more dense.

jamespetts

Ahh, thank you! Just trying this now - it seems to work well. Thank you very much for all your work on this.
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

We need smaller city hall in pakset. Big stone building does not look right in small village.

inkelyad

Please revert my commit be1798625c3de288d3680374499ef8a3bffda25c ('more dense center'). Sometimes it make almost infinite loop.

jamespetts

Inkelyad,

can you detect those conditions and deal with them instead? This seems to be a good feature in principle.
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

It become infinite loop when city can't grow for some reason (i think. It is random condition and hard to debug).

jamespetts

Hmm - one possibility is counting the number of loops and setting an upper limit, after which the program simply breaks away from the cycle. Would doing so cause any instability, or would it just result in a city with fewer buildings than its population would normally merit?
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

No, it will not break anything. But cycle limit must be high. Low limit will break 'more dense center' goal.

Further, with current pak128.Britain-Ex and 'obey era' in 18.. this feature does not work as expected -- pak don't have high level buildings for dense center.

So it is better just remove commit. I'll try to invent more smart algorithm later.

jamespetts

This is now incorporated into 9.0.
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.