The International Simutrans Forum

 

Author Topic: Feedback, industry mechanism.  (Read 4664 times)

0 Members and 1 Guest are viewing this topic.

Offline Dutchman on Rails

  • *
  • Posts: 239
Feedback, industry mechanism.
« on: June 27, 2010, 03:11:47 PM »
Hi James,

My recent experimental game gave me some experience in how the industry settings appear to work.

From previous games, I know that industry creation is still on a 'per chain' basis, using the original events.

However, when closing, industry can close on both a 'per chain' and a 'per industry' basis. So an individual industry can close, cascading to all suppliers if not having a contract to any other industry, but also individual industries can close, leaving consumers hanging in mid-air.

As you remembered, we talked about changing the way industry creation behaves. I think the solution lies in having industry creation behave on a 'per industry' basis as well, using the demand of their potential consumers as a criterion. This leaves the endpoints of course, which pop-up as normal.

I doubt I can program it, but if I have time, I'll attempt to look at the code, to see how the current logic works precisely, and see if there are hooks on which a design can be made.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Feedback, industry mechanism.
« Reply #1 on: June 27, 2010, 03:15:52 PM »
DoR,

thank you for your thoughts. The industry closing system is designed not to leave any industries that need a connexion to another industry in order to function remaining without such a connexion: they will try to reconnect to another industry of the appropriate type, and, if they cannot reconnect, they will close. Do you find that this is not the case?

Incidentally, I have just released version 8.2 - I should be interested in your feedback on that version.

Offline Dutchman on Rails

  • *
  • Posts: 239
Re: Feedback, industry mechanism.
« Reply #2 on: June 27, 2010, 06:14:37 PM »
Hi James,

Well, my experiences are with the grain and sheep farms, where some of the sheep/grain farms closed on their own.
I'll see about version 8.2.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Feedback, industry mechanism.
« Reply #3 on: June 27, 2010, 06:24:31 PM »
DoR,

can you elaborate on what you mean by "closed on their own"?

Offline Dutchman on Rails

  • *
  • Posts: 239
Re: Feedback, industry mechanism.
« Reply #4 on: June 28, 2010, 06:27:59 AM »
Well, the sheep farm closes, but (possibly as long as there's one sheep farm left), the textile mill does no such thing. Because there are 16 sheep farms needed to provide for one textile mill, this does cause some trouble.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Feedback, industry mechanism.
« Reply #5 on: June 28, 2010, 07:59:52 AM »
DoR,

I'm not sure that I follow - why does it cause trouble that the textile mill does not close even though it has some farms still connected to it?

Offline Dutchman on Rails

  • *
  • Posts: 239
Re: Feedback, industry mechanism.
« Reply #6 on: June 28, 2010, 09:35:54 AM »
Hi James,

The textile mill has a production of well over 200, the sheep farms something like 40 each. If the number of sheep farms drops below 5... ;D

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Feedback, industry mechanism.
« Reply #7 on: June 28, 2010, 07:54:46 PM »
Ahh, so the difficulty is that these industries have insufficient numbers of input suppliers, with the result that they cannot produce sufficient quantities of product? That is a whole new issue. If this is a big problem, not remedied by the natural process of new industries of the same sort as those that had closed opening and linking into the isolated industry, then it may be necessary to add a feature where if the number of input suppliers drops below a certain threshold, the industry tries to link with other available input suppliers, and, if not successful, treats itself as completely isolated and closes (thus reducing the industry density and prompting other industries to be built).

Incidentally, in relation to an earlier suggestion about the ratio of production and consumption of farms and shops: whilst there is much to be said for lowering considerably the consumption of shops and increasing their distributionweight, care should be taken not to increase the production of farms too greatly, or else each farm will require a far more substantial transport link than would in reality be required. The idea, for example, that a single farm deserves a railway line all to itself is absurd, and the industries should be balanced with this in mind.

Offline Dutchman on Rails

  • *
  • Posts: 239
Re: Feedback, industry mechanism.
« Reply #8 on: June 29, 2010, 04:25:23 PM »
Hi James,

"If this is (...) not remedied by the natural process of new industries of the same sort as those that had closed opening and linking into the isolated industry,"

Is that even possible? Granted, I've never quite seen the source code of Simutrans Experimental, and only today took a quick look at that of Simutrans standard, but I get the impression that industries don't open that way. Instead, I get the impression that a full industry chain opens, and then if that last industry chain has more commodities to be supplied, there will be "industry expands it's chain" events until all of the commodities have been supplied. But I don't get the impression that it's possible without extensive modifications to get the effect that closing of industries fills in the variables that are a condition to check if an industry chain needs to be expanded? Or is there something I don't know?

I'll answer your point on the farms in the "Rebalancing industry" settings.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Feedback, industry mechanism.
« Reply #9 on: June 29, 2010, 09:27:06 PM »
If I remember correctly, the "increase industry density" code will check to see whether new industries can be linked into existing chains before creating a new chain.

Offline Dutchman on Rails

  • *
  • Posts: 239
Re: Feedback, industry mechanism.
« Reply #10 on: June 30, 2010, 04:27:41 PM »
From what I see, this is true, but only for the last consumer created. This one is stored in a variable, which is then checked on the next occasion. Once all hierarchies have been satisfied, the variable is set to NULL and a new consumer is created, which is then placed in the variable.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Feedback, industry mechanism.
« Reply #11 on: June 30, 2010, 10:20:11 PM »
Hmm. Perhaps one day, this code should be looked at to identify all incomplete industry chains.

Offline Dutchman on Rails

  • *
  • Posts: 239
Re: Feedback, industry mechanism.
« Reply #12 on: July 02, 2010, 05:07:17 PM »
Well, from looking at the code, the function baue_link_hierarchie seems to already have the code snippets for:

If the total number of suppliers * their production < the demand for a good in a single factory:
   Build and/or crossconnect a new supplier for that good.

It seems to loop through this until the entire hierarchy for a certain good is completed.

What I think you'd need for your question and would also bring my dream industry model a lot closer is to rework those snippets into the following function (called once every month):

For each factory on the map.
   For each good consumed by this factory.
      If the total number of suppliers * their production < the demand for a good in a single factory:
         Build and/or crossconnect a new supplier for that good.
         Report on the action(s).

This will fill any blanks left by closing industries..

How do you think?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Feedback, industry mechanism.
« Reply #13 on: July 02, 2010, 10:24:51 PM »
This would seem to involve building industries even though the target industry density is reached. Perhaps better would be not to build any new industries (other than power stations, as necessary) until each individual industry chain is completed (using the for each good consumed by this factory... etc. model that you suggest). The current mechanism for determining when a new industry should be built should be retained.

Offline Dutchman on Rails

  • *
  • Posts: 239
Re: Feedback, industry mechanism.
« Reply #14 on: July 04, 2010, 07:16:53 PM »
Well, if you remove the calls to baue_link_hierarchie in the power stations and 'other' industry chains sections of increase_industry_density, and modify the 'check unfinished business' section along with the baue_link_hierarchie function, you should end up with something like this:

Every first of month:
     If Criteria for industry expansion are met.
          For each factory on the map.
             For each good consumed by this factory.
                 If the total number of suppliers * their production < the demand for a good in a single factory:
                      Build and/or crossconnect a new supplier for that good.
                      Report on the action(s).
          If no industry needs expansion of it's chain AND extra electricity is needed.
             Build a new power station (but not the rest of the chain, it will come in later months).
             Report on the action.
          If no industry chain needs expansion AND no extra electricity is needed.
             Build a non-electricity consumer (but not the rest of the chain).
             Report on the action.

How do you think?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Feedback, industry mechanism.
« Reply #15 on: July 04, 2010, 10:30:00 PM »
DoR,

thank you for your continued development of this idea. This looks to be moving in the right direction, but more consideration, I think, needs to be given to power stations, not least because they need to be built even when the other criteria for industry expansion are not present (but when there is a need for more electricity) and built as complete chains so that there are never orphaned power stations on the map. There is already code for dealing with power stations (which I think is quite complicated, and should in any event be retained). Thank you again for your input.

Offline Dutchman on Rails

  • *
  • Posts: 239
Re: Feedback, industry mechanism.
« Reply #16 on: July 05, 2010, 07:24:55 AM »
You're welcome about my design efforts. The real work will be in the coding anyway, and my feeble skills at coding in general and non-existent ones in C++ are not nearly up to that job.

I get the impression from looking at the increase_industry_density function that the expansion of power is part of increasing the density and therefore governed by the conditions for such an increase. But regardless of wether or not this is the case, I happen to agree with your point to make electricity a true supply/demand chain, and it would take a relatively minor design change:

Every first of month:
   If Criteria for industry expansion are met.
      For each factory on the map (including power stations).
         For each good consumed by this factory.
            If the total number of suppliers * their production < the demand for a good in a single factory:
               Build and/or crossconnect a new supplier for that good.
               Report on the action(s).
      If no industry chain needs expansion.
         Build a non-electricity consumer (but not the rest of the chain).
         Report on the action.
   If extra electricity is needed.
      Build a new power station (but not the rest of the chain, it will come in later months).
      Report on the action.

How do you think?