News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

game freezing when generating map

Started by laos, June 22, 2017, 05:11:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

laos

I used to be able to generate relatively large maps on Windows, but as of the most recent nightly (6/21) and a few recent versions I've been unable to get the Large NE map to render with the following settings:

Settings:
Starting Year 1940
1810 towns
60 big cities
10 clusters
250 cluster size
899 public buildings
899 industries
median population 6000
drives and signals on right

Climate:
water level -2
beach -2
dunes -2
plains - 1
lowlands 4
mountains 8

Game always hangs on a black screen for a very, very long time before either crashing or i give up on the map generation.

Is this just too big a map for the game? I've played maps in the past with relatively similar sizes, at least I think I have. They took a while to load but they did eventually succeed. I've failed to get any maps / save games working as everything crashes before that opportunity.

jamespetts

I have just been able to generate a map with those settings, although it took a very long time (I went away and left it for about twenty minutes, and it had finished by the time that I got back). However, the resulting map is extremely dense with large towns: I suggest halving the number of towns for enhanced gameplay.

One thing that you did not specify, however, is the number of rivers. River generation can take a huge amount of time on a large map. I set it to generate 265 rivers; did you have yours at a higher setting?

I shall have to look into optimising/multi-threading map generation one day, as it does seem to be quite slow at present.
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.

laos

Quote from: jamespetts on June 22, 2017, 12:07:40 PM
I have just been able to generate a map with those settings, although it took a very long time (I went away and left it for about twenty minutes, and it had finished by the time that I got back). However, the resulting map is extremely dense with large towns: I suggest halving the number of towns for enhanced gameplay.

One thing that you did not specify, however, is the number of rivers. River generation can take a huge amount of time on a large map. I set it to generate 265 rivers; did you have yours at a higher setting?

I shall have to look into optimising/multi-threading map generation one day, as it does seem to be quite slow at present.

I had 128 rivers. I just tried with 1200 cities instead and still getting stuck on initializing map. I assume you're using Linux, not Windows?

jamespetts

#3
I use Windows at home and it was on Windows that I ran the test. May I ask what your specifications are and for how long that you left the map generation?

Edit: I have just re-run the creation of the map to your specifications, and I timed it at 20 minutes on my machine.

Edit 2: For reference, it is cities (at 55.18% of CPU time used) and rivers (at 25.49% of CPU time used) that are the most time consuming operations in generating new maps. I think that I have found a simple optimisation that may reduce CPU usage associated with cities on map generation by circa 10%, but this still needs testing. The long-term solution to this will be multi-threading river and city generation on map creation, but this will be a lot of work.
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.

DrSuperGood

Map generation is always a resource intensive process. It can take a minute or so to generate sizable maps in modern Civilization games as an example.

The best solution would be to keep the application responsive and inform the user that it has not crashed and is just taking a very long time. This could be in the form of a blinking text showing what it is currently generating, or preferably a counter of sorts showing how much is left to generate (eg "Generating cities: 113/1810").

jamespetts

Thank you for those suggestions. There is a progress bar, but it tends to get stuck in certain places. I have identified a possibly substantial optimisation in the generation of towns in Extended that can be done relatively simply, but optimising river generation can probably only be done signficiantly by multi-threading, which would be a large task.
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.

laos

#6
Quote from: jamespetts on June 23, 2017, 10:11:20 AM
I use Windows at home and it was on Windows that I ran the test. May I ask what your specifications are and for how long that you left the map generation?

Edit: I have just re-run the creation of the map to your specifications, and I timed it at 20 minutes on my machine.

Edit 2: For reference, it is cities (at 55.18% of CPU time used) and rivers (at 25.49% of CPU time used) that are the most time consuming operations in generating new maps. I think that I have found a simple optimisation that may reduce CPU usage associated with cities on map generation by circa 10%, but this still needs testing. The long-term solution to this will be multi-threading river and city generation on map creation, but this will be a lot of work.

i left the computer running overnight and it's still hanging on "initializing map"

PC is pretty powerful - 6700k, 32GB RAM, GTX 1080 - hence why i think it's a legitimate crash where something during the process is making the game crash, not that it's just taking a long time generate the map - CPU simutrans usage sits around 13% for a long time

I'm using http://bridgewater-brunel.me.uk/downloads/nightly/packages/Simutrans-Extended-Complete.zip plus the latest nightly .exe -- feel free to share other instructions if I am not using the proper steps/process for windows nightlies

jamespetts

#7
That is odd - I have not been able to reproduce an actual crash at all. The important thing for performance is your CPU, but yours seems as if it is likely to be at least as powerful as mine (and even if it is a laptop version, that would not account for it getting stuck if it is running overnight unless it has overheated so drastically as to cause it to scale back to a small fraction of its capability, which seems doubtful). Can you post screenshots of your settings to make sure that I reproduce them precisely?

Edit: I have now committed to Github a substantial optimisation of map generation. It still takes a while (as map generation generally is wont to do), but it should be faster than it was before. Can you re-test? I should be most grateful.
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.

laos

looks like it is significantly faster with map loading. Additionally I think an error on my end was causing full failure of map generation related to missing DLLs, so my apologies for not noticing this when discussing the bug earlier.

jamespetts

Splendid - thank you very much for testing that!
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.