News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Feedback, industry mechanism.

Started by Dutchman on Rails, June 27, 2010, 03:11:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dutchman on Rails

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.

jamespetts

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.
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.

Dutchman on Rails

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.

jamespetts

DoR,

can you elaborate on what you mean by "closed on their own"?
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.

Dutchman on Rails

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.

jamespetts

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?
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.

Dutchman on Rails

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

jamespetts

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.
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.

Dutchman on Rails

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.

jamespetts

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.
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.

Dutchman on Rails

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.

jamespetts

Hmm. Perhaps one day, this code should be looked at to identify all incomplete industry chains.
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.

Dutchman on Rails

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?

jamespetts

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.
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.

Dutchman on Rails

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?

jamespetts

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.
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.

Dutchman on Rails

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?