The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: emirkir on June 12, 2018, 01:36:03 PM

Title: Simutrans-Extended and -64 not working...
Post by: emirkir on June 12, 2018, 01:36:03 PM
Hi again!
As you've been told in my latest posts I have this issue that I can't use Simutrans-Extended and the -64 version.
As @Ves said, to redownload from the Bridgewater-Brunel server didn't work.. So on this link I provided a screen-share of when I recreate the problem:
https://drive.google.com/file/d/1CLO4jARQNvvyK_zl4UrD7dOf09vBJ2DU/view?usp=sharing (mp4-file)

Please help!
Title: Re: Simutrans-Extended and -64 not working...
Post by: ACarlotti on June 12, 2018, 03:51:10 PM
The problem is that the algorithm (lines 970-983 in simworld.cc) for generating a list of population sizes is taking an inconsistent set of parameters. In particular, it is currently impossible to generate cities with a population smaller than half of median_population, which you set to 7500. However, in pak128.sweden we have max_small_city_size=3000. This means that it gets stuck in an infinite loop once it starts trying to generate 'small' cities, since each number it tries is at least 3750.

To avoid this, you can set median_population to less than 6000. There should probably be some checks in the code to prevent this situation arising; in the long term I think the city generation algorithm is likely to be rewritten without this code for generating population sizes.
Title: Re: Simutrans-Extended and -64 not working...
Post by: emirkir on June 12, 2018, 04:47:05 PM
Okay I understand, but is it impossible then to make bigger cities or am I understanding the mechanics wrong?

EDIT: Why don't make a warning with the maximum set value?
Title: Re: Simutrans-Extended and -64 not working...
Post by: emirkir on June 12, 2018, 07:45:39 PM
IMPORTANT! This problem was found in PAK SWEDEN.
Title: Re: Simutrans-Extended and -64 not working...
Post by: ACarlotti on June 12, 2018, 08:59:12 PM
There are a couple of relevant settings you can change - click settings, and select the Extended tab, and there should be a couple of settings called something like max_city_size and max_small_city_size. You could also increase these to solve the problem (although it looks like the world generation will create fewer cities than specified if there isn't enough room for them all).
Title: Re: Simutrans-Extended and -64 not working...
Post by: DrSuperGood on June 12, 2018, 09:24:24 PM
Please try running Pak128-Britain and with localization set to English. This is to rule out the crash being caused by the pakset and not the x86-64 build.
QuoteThe problem is that the algorithm (lines 970-983 in simworld.cc) for generating a list of population sizes is taking an inconsistent set of parameters. In particular, it is currently impossible to generate cities with a population smaller than half of median_population, which you set to 7500. However, in pak128.sweden we have max_small_city_size=3000. This means that it gets stuck in an infinite loop once it starts trying to generate 'small' cities, since each number it tries is at least 3750.

To avoid this, you can set median_population to less than 6000. There should probably be some checks in the code to prevent this situation arising; in the long term I think the city generation algorithm is likely to be rewritten without this code for generating population sizes.
This sounds like a bug. It really should not allow one to do this if it should never happen. Otherwise it should work with what it is given and just generate stupid results, possibly with a warning.
QuoteEDIT: Why don't make a warning with the maximum set value?
The game should not even be allowing you to set impossible settings. It should warn one if the results will be stupid but if a setting is impossible it should refuse to progress.
Title: Re: Simutrans-Extended and -64 not working...
Post by: ACarlotti on June 12, 2018, 09:44:23 PM
Quote from: DrSuperGood on June 12, 2018, 09:24:24 PMPlease try running Pak128-Britain and with localization set to English. This is to rule out the crash being caused by the pakset and not the x86-64 build.

This has nothing to do with the pakset or which system the game was built for. It's basically a bug that's present in all versions; no further testing is needed to diagnose it. The only reason I haven't offered a fix is because I'm not sure what would be most appropriate in the short term.

One option (a quick botch) would be to increase max_small_city_size to median_population and max_city_size to 2*median_population when these values are too small for the specified median_population. A good solution long-term might involve a more significant redesign of the city building code, so will probably have to wait.
Title: Re: Simutrans-Extended and -64 not working...
Post by: DrSuperGood on June 12, 2018, 10:31:35 PM
Use a conditional test to check the values before trying to build the cities. If one is too small then make it bigger. When this occurs, if Simutrans supported warning dialogs then show one, but since it does not then maybe send a warning to the command console that this occurred. The end user experience might not be what is expected with cities being the wrong size, but it will not freeze in an infinite loop which is a much better result.

Another solution, which should be done on top of the above, is to have the UI clamp the values that can be chosen so a user cannot input impossible values into it however this takes extra development time so might not be worth it for now.
Title: Re: Simutrans-Extended and -64 not working...
Post by: emirkir on June 13, 2018, 11:00:33 AM
Ok, so you mean Shift+P and "Increase City-population by 100"?

Thanks!
Title: Re: Simutrans-Extended and -64 not working...
Post by: Matthew on June 13, 2018, 01:22:03 PM
Quote from: emirkir on June 13, 2018, 11:00:33 AM
Ok, so you mean Shift+P and "Increase City-population by 100"?

Thanks!

If you press 'i', then you'll see a special Settings dialogue. These settings can also be changed in the simuconf.tab files (one in simutrans/config, one in the pakset, and one in your user directory).
Title: Re: Simutrans-Extended and -64 not working...
Post by: emirkir on June 13, 2018, 05:46:19 PM
Ok, I'll try that!
Thanks Matthew!
Title: Re: Simutrans-Extended and -64 not working...
Post by: emirkir on June 15, 2018, 05:49:10 PM
I got it to work by not having cities bigger than 6000. It worked smoothly and without further visual/graphics/UI-problems.
But something I noticed was when I entered my values, it didn't spawn what I set in the "create-a-map" start-screen.
I set number of cities to 20 and it only spawned 4.

EDIT: The edit I made before is moved because it don't place in this board...

Thanks!
Title: Re: Simutrans-Extended and -64 not working...
Post by: jamespetts on June 16, 2018, 12:25:00 PM
Thank you for your report, and apologies for the delay in replying. I think that I have managed to fix this, which fix I have pushed to the master branch. The town generation/growth system will eventually need to be overhauled entirely, but this should at least prevent the infinite loops/freezes.
Title: Re: Simutrans-Extended and -64 not working...
Post by: emirkir on June 17, 2018, 01:16:46 PM
OK nice!