The International Simutrans Forum


Author Topic: Industry demand spike caused by saving a game  (Read 1141 times)

0 Members and 1 Guest are viewing this topic.

Offline Jando

  • *
  • Posts: 506
Industry demand spike caused by saving a game
« on: June 20, 2019, 02:00:49 PM »
Here is a saved game that allows me to cause a demand spike from an existing industry by saving the game. Just the save, no save-load cycle required:

How to observe:
1. Load above saved game, hit pause.
2. Open stop list, jump to station Tatsand Victoria.
3. 6 tiles south of the station at position 1047/455 you find a pub. Open pub window, switch on in-transit graph for beer. Graph shows previous demand spikes for beer 9 and 11 months ago and correct demand behaviour since then.
4. Unpause the game and save the game under another name. You may need to save the game twice to see a demand spike, there seems to be some timing involved here, not every save results in a demand spike. In about 20 attempts by now I have always seen a demand spike after 1 or 2 saves.

Note one can also cause a demand spike saving the game while it is paused, however, it won't be visible cause the graph will only show the spike after unpausing. By now I'm pretty sure that most if not all demand spikes from existing industries are caused by saving the game.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19688
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Industry demand spike caused by saving a game
« Reply #1 on: June 28, 2019, 12:31:22 AM »
Thank you for this report. This is actually a very complex issue.

It is caused by the "boost" system, which was introduced into Standard some years ago: the idea is that, as more passengers arrive at an industry (Standard does not distinguish between commuting and visiting passengers), the industry's base production increases. As the base production increases, so the time to consume stock calculated decreases and the maximum in transit percentage increases. The trouble is that, with the logistics system, the actual consumption of a consumer industry is not affected by boost, but rather relies on the actual number of visiting passengers. Thus, more goods would be demanded than would actually be consumed.

Why does this happen when saving the game? This is because the boost figures were recalculated at this point, but otherwise very infrequently. I have modified this to recalculate only when loading, but this did not affect the occurrence of this issue when saving and then reloading.

The ultimate solution to this is simply to strip out much of the boost system. However, this would be a large and complex piece of work, as certain elements of this system (such as the electricity and mail based boost and some aspects of the GUI) need to be retained and made to integrate better with the current system. The plan is to reform the industry boost system at the same time as the work on the town growth is undertaken, as this work will include work on industry.

In the meantime, I have prevented the passenger and mail related boost figures from affecting the get_current_production figures in end consumer industries. This prevents this problem from occurring, although it is possible that there might be some unwanted effects that are complex to track down.

Thank you for reporting this; I should be grateful if you could re-test with the next nightly build.

Offline Jando

  • *
  • Posts: 506
Re: Industry demand spike caused by saving a game
« Reply #2 on: June 29, 2019, 10:48:57 PM »
Thank you for your work on this issue, James.

The observed spike from the original post does not happen any more with the latest nightly, thus that's good news. :) Have not seen any odd side effects so far, but also hard to judge what is odd at times, hehe. I'd say we consider this fixed, I'll continue testing the cargo demand system and will report any odd observations. 

Thank you again!