News:

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

Hang while placing industries

Started by TheUniqueTiger, February 04, 2011, 07:31:16 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TheUniqueTiger

Hello,
With 9.2 experimental on creating new map, while placing industries on large maps (tried with 1024*1024, 2048*2048) with electricity output < 50% or so, Simutrans seems to hang. No matter how long I wait, the progress bar doesn't change neither does the new map show up. Earlier I used to play with electricity output 100% which would create all power stations & their suppliers which are small chains, but as the electricity output is lowered, many other goods chains come up and this I think causes the game to hang when placing such large chains over a huge map.
Please look into it. Thanks.

jamespetts

Thank you for the report. Just to clarify - does it hang when the map is first generated, or when you manually place industries as the public player?
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.

TheUniqueTiger

Its while creating a new map (as mentioned at the start of my post). I haven't tried placing industries after map is created. Coal/oil power-station chains generate quickly, whereas if its presumably some other chain with lots of industries, it hangs with no further progress. I have tested with the following settings:
Number of industry chains: 16 or more
Crossconnect factories percentage: 15
Factory spacing: 32

jamespetts

Initial testing shows that it doesn't actually hang completely: it just takes a very, very long time to place all those non-power station industry chains (and the bigger the map, the more area over which it has to search to place the industries). I don't know exactly why the power stations make things so much easier, except that they seem to be quite simple chains. However, the code is designed so as to make sure that the game never gets stuck in an infinite loop here, so it will eventually finish. You may be better keeping the electricity percentage at 100% (which is more realistic in any event) for now.
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.

TheUniqueTiger

You must have seen it progressing but according to me it does take 'long enough' to consider hung. If a 2.93GHz core is running at its maximum for 4mins and still not placing an industry chain, that needs to be improved really. While placing 20 chains including a few non-power ones, it goes quickly for the initial few (probably power chains), then slow for two or three (small chains), then very slow for another one (mid size chains), but thats it... beyond that its stuck (large chains). Well, 100% electricity doesn't give any other chain except coal & oil for power which are the least profitable of all. For the moment I've gone back to playing a Simutrans standard 102.2.2 generated map, 2048*2048, with 16 industry chains (including large chains) generated too quickly in comparison to believe. Besides mine is a Core2Duo 2.93GHz with 3GB RAM. I wonder how a person with lower config would generate large maps! On numerous occasions I ended up doing 'End Task'.

So is there any way of getting it done faster? I would like the developers to develop a faster algorithm for placing industries at least as fast as in standard. I could give some inputs regarding algorithm (Please give me an overview of existing algorithm for the same!).

Thanks & Regards!

jamespetts

TheUniqueTiger,

thank you for your input. I wasn't aware that this was so much slower than Standard, and I'm not entirely clear on why that should be, I must confess, as the algorithms for placing industries are not changed from Standard to Experimental. If you would like to suggest improvements, you would be more than welcome. The code for placing industries can be found here (see line 1314 onwards) and here (see the method increase_industry_density).
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.

TheUniqueTiger

Thanks for pointing out the code. I have gone through it once and I think it may be stuck on a loop which tries to create new industry for unfinished chain rather than the new chain creation. I will go through it in detail tomorrow. If I can find any improvements possible I'll surely help with code. Thanks again.

jamespetts

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.

TheUniqueTiger

Simutrans Experimental 9.2 with pakBritain-Ex 0.7.1 hangs the way I mentioned above.
The same with pak128 1.4.6 creates the map with identical settings within 16 secs placing all kinds of industry chains, large or small.

Hence I conclude its some pak-related settings and not the Simutrans code which is causing the problem. This should be conveyed to the pakBritain-Ex manager(s).
Thanks.

jamespetts

Ahh - I am the Pak128.Britain-Ex maintainer! I am in the process of rebalancing the industry settings for the next release, so it will be interesting to see whether this issue occurs when that process is complete.
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.

jamespetts

I have recently found a bug that might be the cause of this, which will be fixed in the next release.
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.

TheUniqueTiger

Thats great... Looking forward to the next release. I hope it creates map quickly now.

jamespetts

Can you re-check to see whether you still get this problem in 9.3?
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.

TheUniqueTiger

I couldn't get the new config files for 9.3 as the download page showed error. Tried the 9.3 exe and it still hangs the same way. This time I waited for 3 mins.

jamespetts

Can you try the configuration files downloaded from here? Also, after the lapse of 3 minutes, was the world otherwise created properly?
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.

TheUniqueTiger

This whole issue came up because of the default "factory spacing" being 32. All the time I never bothered to change it.
Even with 9.3 it was getting stuck again, this time even with electric promille set to 1000. Quite unusual. So this time I changed the factory spacing to 6 and the same world was created *very fast*. Increasing the factory spacing to 16 just increased the creation time but still loaded quite fast. One thing that I didn't like that even with electric promille 1000, I got just 1/20 chains as a gas-fired power station. This was something very odd... 16 cities, 12 industry chains but just one gas-fired power station? No coal/oil power stations at all? On another occasion I just got 1 gas-fired & 1 coal power station out of 20 chains with 99k citizens.

1. Default factory spacing should be less. It is a major factor in time taken for creating world. Larger values tend to hang the process.
2. Power stations are too few to start with... even with electric promille 1000.

jamespetts

These are not necessarily bugs. On map creation, it seems that placing industries with that level of separation is quite a computationally expensive task (although I find that maps generate quite quickly with factory_spacing = 48, but I have a fast computer).

As to the power stations - in later eras in Pak128.Britain, only gas fired power stations are available, as, in reality, no coal or oil plants were built in the UK from the 1980s onwards. The power station should be sufficient to serve the whole map (later power stations have a high output), as 16 cities and 12 industry chains is actually a very low amount: a single power station could easily serve that many cities and industries in reality, and more. In any event, the game will check at the beginning of every new month to see whether the is a shortage of electricity, and add further power stations to meet unmet demand.
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.

jamespetts

Can you check to see whether the industry placement behaviour is acceptable within known limits in 9.4?
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.