The International Simutrans Forum

 

Author Topic: Option to make electricity/pax/post a requirement for factories  (Read 530 times)

0 Members and 1 Guest are viewing this topic.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1448
  • PAK-DEV P192C
  • Languages: DE, EN
Option to make electricity/pax/post a requirement for factories
« on: January 24, 2020, 10:05:03 AM »
Current Situation (Example):
A factory has a productivity of 100%. If electricity is delivered, it has a productivity of 200%.

Proposal:
A factory has a productivity of 0%. If electricity is delivered, it has a productivity of 100%. This is only true if set in the dat (eg. "requires_electricity=1")

Reasoning:
The idea that a factory could not produce at all without workers or electricity isn't far fetched, and it's tempting to create a factory intended to produce 500 Units/month, but give it a base rate of 5 units/month and 10000% boost from electricity. However, the spawning algorithm would see 5 units rather than 500, so if the consumer needs 500 units per month, 100 producers spawn.
If a factory is intended to be only used with electricity, it just makes sense for the spawning algorithm to work under the assumption that electricity will be delivered. Hence lack of electricity decreasing production rather then the other way around.
It's not just about the spawning though. Said factory producing only 5 units would have no easily visible identifier that you absolutely should increase production with electricity. A novice player who does not look through production charts might miss it completely and think it a bug. So it would be better to remove those 5 units as well and make it clearly not working, perhaps adding the information "This factory requires electricity" in the main window.
For gameplay, it's like any other good required for production. Eg. the aluminium factory would require bauxite and electricity rather than just bauxite.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9993
  • Languages: De,EN,JP
Re: Option to make electricity/pax/post a requirement for factories
« Reply #1 on: January 24, 2020, 01:19:01 PM »
The boost was introduced to ail some troubles with the factory placement/growth. So one could use one factory with a boost instead of two with one on the other side of the map.

This was deliberately not done in order to not force a player to transport passengers or build an electric grid, when he/she wants to develop a freight network.

And the spawning algorithm does not fare well with dynamic factories anyway (like fields).

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 19823
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Option to make electricity/pax/post a requirement for factories
« Reply #2 on: January 24, 2020, 02:12:04 PM »
Note that Extended does have a requirement for industries to have workers in order to operate, although an option to disable this in factories outside cities had to be introduced after it was found that this could lead to deadlocks in some cases.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5642
  • Languages: EN, NO
Re: Option to make electricity/pax/post a requirement for factories
« Reply #3 on: January 24, 2020, 04:23:50 PM »
I play Simutrans to be a transportation company, not an electricity company. Sometimes, I'm even annoyed that I have to build roads. How do the huge factories manage to get constructed in the middle of nowhere without road access? (However, I might be more annoyed at an AI building stupid roads.)

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2826
  • Languages: EN
Re: Option to make electricity/pax/post a requirement for factories
« Reply #4 on: January 24, 2020, 05:11:06 PM »
Note that Extended does have a requirement for industries to have workers in order to operate, although an option to disable this in factories outside cities had to be introduced after it was found that this could lead to deadlocks in some cases.
If it works of course. It most certainly did not in the bridgewater brunel server but only time will tell if that issue is fixed.

Proposal:A factory has a productivity of 0%. If electricity is delivered, it has a productivity of 100%. This is only true if set in the dat (eg. "requires_electricity=1")
At some stage I was considering overhauling how factories work, but I got distracted and never started. Specifically factories could be given internal "plants" which do the manufacturing in batches. The batches avoid rounding error with production speed since instead the rate at which batches complete an be adjusted rather than an amount of products. The plants could then be given different operating modes, such as using energy as an input, requiring some workforce/mail factor or forcing production of a waste output that must be dealt with. A factory could have multiple plants, to solve multi production situations. Plant managers could multiplex time between different plants in a group based on some control logic.

Backwards compatibility should be possible since the current mechanics could map to plants in various configurations. The change in how production is calculated would cause slightly different results due to rounding, but the difference would likely be unperceivable to the average person and only an improvement in extreme cases.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1448
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Option to make electricity/pax/post a requirement for factories
« Reply #5 on: January 24, 2020, 10:54:27 PM »
This was deliberately not done in order to not force a player to transport passengers or build an electric grid, when he/she wants to develop a freight network.
You know, I never liked boats in Simutrans. Please ban oil rigs which force me to use them if I want to play without them ;) Also, I can force a player to transport passengers simply by not having any factories, except maybe some solar power plants. Whether they would play such a pakset is their decision, right? Are you telling me that this time, it's not too hard to implement or requires too many resources, but you prefer to restrict pak creators rather than players, even though players have a variety of paksets to choose from while the alternative for a pak creator is... I guess OTTD?

Quote
And the spawning algorithm does not fare well with dynamic factories anyway (like fields).
So because something does not work flawlessly it does not need to be partly improved? oô

an option to disable this in factories outside cities had to be introduced after it was found that this could lead to deadlocks in some cases.
Could you elaborate how this may lead to deadlocks? That would be a serious concern and the most helpful answer so far.

I play Simutrans to be a transportation company, not an electricity company. Sometimes, I'm even annoyed that I have to build roads. How do the huge factories manage to get constructed in the middle of nowhere without road access? (However, I might be more annoyed at an AI building stupid roads.)
Fair enough. Who is about to stop you from doing so? Even if p192c would turn into a SimCity-clone, it wouldn't affect your gameplay expierience with p64 at all.

At some stage I was considering overhauling how factories work, but I got distracted and never started.
I know, and I would certainly like to see what could have been. But I don't think this has to be that complicated, it's just a multiplier to productivity after all.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2826
  • Languages: EN
Re: Option to make electricity/pax/post a requirement for factories
« Reply #6 on: January 25, 2020, 05:55:54 AM »
Could you elaborate how this may lead to deadlocks? That would be a serious concern and the most helpful answer so far.
Only applies to Simutrans Extended. Passengers have a maximum travel time past which they will not even embark on the journey. This is approximately 40 in game minutes for commuters. A remote farm stead or mine in the middle of nowhere could not be served commuters from a village with the transport options available in the 1800, and even in the 21st century it is difficult since it would require a dedicated service with sub 40 minute interval which is unlikely to break even.

In standard this is less of an issue. You can bounce passengers via aircraft all over the world unnecessarily for all they care.
I know, and I would certainly like to see what could have been. But I don't think this has to be that complicated, it's just a multiplier to productivity after all.
Maybe base bonus amount? This could be specified as a negative value.

Otherwise it is yet another special case logic that could complicate things later.

Offline makie

  • Devotee
  • *
  • Posts: 194
    • Homepage PAK128-German
  • Languages: DE
Re: Option to make electricity/pax/post a requirement for factories
« Reply #7 on: January 25, 2020, 08:00:29 AM »
The idea that a factory could not produce at all without workers or electricity isn't far fetched, and it's tempting to create a factory intended to produce 500 Units/month, but give it a base rate of 5 units/month and 10000% boost from electricity.
However, the spawning algorithm would see 5 units rather than 500, so if the consumer needs 500 units per month, 100 producers spawn.
Our solution is to keep the production rate the same and to reduce the consumption and production of goods.

This is example of a wafer factory uses a lot of electricity and almost does not work without electricity.

Quote
# -------------------------------
#   PAK128.german
#   Industrie
#   Neu: 22-08-2018
# Es ist so gebaut daß es erst mit einem Stromanschluß richtig funktioniert und es braucht viel Strom
# --------------------------------
Obj=factory
Name=Waferfabrik_1965
copyright=pumuckl999
DistributionWeight=127
Productivity=100
Range=2
pax_level=50
location=land
InputGood[0]=Chemikalien
InputCapacity[0]=400
InputFactor[0]=2
InputGood[1]=Sand
InputCapacity[1]=400
InputFactor[1]=9
InputGood[2]=Kohle
InputCapacity[2]=400
InputFactor[2]=5
OutputGood[0]=Wafer
OutputCapacity[0]=400
OutputFactor[0]=6
electricity_amount=1200
electricity_boost=20000
Passenger_boost=2000
Mail_boost=500

Offline Vladki

  • Devotee
  • *
  • Posts: 3328
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Option to make electricity/pax/post a requirement for factories
« Reply #8 on: January 25, 2020, 09:30:22 AM »
Would it be possible to have electricity not as boost, but as one of input goods?

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1448
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Option to make electricity/pax/post a requirement for factories
« Reply #9 on: January 25, 2020, 01:02:13 PM »
Our solution is to keep the production rate the same and to reduce the consumption and production of goods.
This is example of a wafer factory uses a lot of electricity and almost does not work without electricity.

I see, it's possible to fight one flaw of the spawning algorithm with another. One would have to hope it does not get fixed, since the spawning algorithm should put input_factor and output_factor into consideration, and it would not be shown in a player-friendly way. Thank you for that very useful temporary solution.

Maybe base bonus amount? This could be specified as a negative value. Otherwise it is yet another special case logic that could complicate things later.
I think my point is that a multiplier like that shouldn't be 'another special case'. If feels like there could be a system in place that allows for all kinds of multipliers in a more flexible manner. The current boosts would be the exception there, since they are additive to each other and add the base value on top, but together they would still count as one multiplier (1+(electricity_delivered/electricity_amount)*(electricity_boost*1000)+(passenger_delivered/passeng........ you know what I mean. ) - It really does not matter how exactly factories work, as long as it's supposed to be backwards compatible, such multiplier would always affect them correctly. Future changes might offer better solutions, eg. in you plant-example I'd expect factories to be able to produce one good without electricity, but the other only with electricity. But that's just new possibilities and does not change old ones.
That being said, It might be better to just do it like makie suggests, and hope that if the spawning algorithm gets fixed, this specific issue is adressed there, too. After all, my main issue is indeed with the senseless spawning and everything else, including better indications for players, just a bonus.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9993
  • Languages: De,EN,JP
Re: Option to make electricity/pax/post a requirement for factories
« Reply #10 on: January 25, 2020, 01:53:18 PM »
If you have factories, which only work with passengers, how would you allow for a freight only play style? Some for electricity. Play without boats: Set water level to -12 and disallow rivers => no water no oil rigs.

If you want to play without boats, it is possible. But if a factory enforces pax or power, then there is no way without.

If you want less supplier spawned, you need to set InputSupplier[] to some value larger than 0. That is why pak128 deliberately have always no enough coal mines.

Offline wlindley

  • Devotee
  • *
  • Posts: 1022
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Re: Option to make electricity/pax/post a requirement for factories
« Reply #11 on: January 25, 2020, 02:08:34 PM »
Early steam power would be created from wood, woodchips, or coal among other sources; until roughly 1950, factories would often have their own power plants and make their own electricity or steam.  If a factory datfile could specify "electricity OR coal" that would be wonderful.  "Coal" here being a placeholder for "steam" ... maybe we really need "electricity OR (coal AND water)"

Actually being able to specify inputs as "vegetables OR fruit" would be a huge plus for the factory system generally, as we have only "AND" restrictions in datfiles today.

Early mills required water power; a location= specifier in the .dat could force mills to be placed along rivers of at least a given size.  Specify "electricity OR coal OR waterpower".

If we could additionally specify "on a slope" then mills would realistically occur only by river rapids.  Iron and coal mines could also be specified as on hillsides.
That's a lot of complexity to model power sources!  I hope we could keep things as simple as possible.

Offline X

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3799
  • Providing hosting for Simutrans projects
    • pc2.io
  • Languages: EN
Re: Option to make electricity/pax/post a requirement for factories
« Reply #12 on: January 26, 2020, 04:15:06 AM »
There's always a balance between Simutrans the game and Simutrans the real-life simulator. So theoretically, the people coding the game get to generally decide what's possible or not.

I never personally liked the road-train limit. It was nice to have that raised to 4. But that's certainly something that's optional - pak authors can choose not to make anything that works to have three trailers on a truck.

If it was forced to have electricity for factories to produce, that would be bad. As pointed out, while some might like to play that way, many others would not.

But I do have to admit, such a mode might be fun. But I wouldn't want to see Simutrans forced to be just that way.

Would it be possible to make that system optional? Either specified on a pak level, or specified in the options - like Just In Time?

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1448
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Option to make electricity/pax/post a requirement for factories
« Reply #13 on: January 26, 2020, 10:48:48 AM »
If you have factories, which only work with passengers, how would you allow for a freight only play style? Some for electricity. Play without boats: Set water level to -12 and disallow rivers => no water no oil rigs.

You forgot to disable lakes, but it does not matter. That method depends on paksets to include land-based alternatives to all water-dwelling factories. Pak128Britain (not sure if up to date) has a fishing chain, the Fishing Port requires live fish you can only get in a Fishery. That Fishery is a water-based factory, so if there is no water, it cannot spawn. Fishmonger and Fishport do spawn however, but are completely useless. Removing the water didn't do any good, if the chain had spawned with the Fisheries the player could still have decided to ignore the chain, would have been the same result. If said Fisheries would spawn on land, but require post, pax or electricity, you'd have exactly the same situation.
But even better is makies example who already put a factory that pretty much requires electricity in the game. So I guess you need to fix that exploit to make sure it isn't abused by rebel pak creators - or, for the benefit of the game, turn it into a feature that a player can actually understand easily.

If it was forced to have electricity for factories to produce, that would be bad. As pointed out, while some might like to play that way, many others would not. But I do have to admit, such a mode might be fun. But I wouldn't want to see Simutrans forced to be just that way.
Would it be possible to make that system optional? Either specified on a pak level, or specified in the options - like Just In Time?
I intended this to be a factory specific setting that deliberately needs to be used by the pak developer. The intention is not to have that for every factory, but for specific ones. The average corner store does not need much more electricity than an office or residence, so they would be fine with the implied low-voltage consumer grid (I mean, we don't really assume that Simuthanians have no electricity at home, right?). It's also reasonable to assume that both employees and customers either walk there or use their private cars. A wafer factory, to use makies example, would definitelly need it's own high-voltage connection. An oil platform would be a great example for a factory that indeed does require help getting their workers, since they can't walk or use their car, and probably won't swim either. On the other hand, they don't commute daily, so it wouldn't be that many people.
Part of the idea is to get people out of their comfort zone, though. If a player only plays with freight, it might be because they got confused over all the different options, or tried to play pax in the beginning and failed, faring better once they switched to freight. Factories that require workers don't exactly need a complete pax network, since the workers only live in close cities, attaching those would be enough. So you are not forced to build a pax network, you only need to deliver the good 'pax' from city to factory. Even if that's not your preferred thing to do, it does not compare to actually playing with pax, which want's you to cover the whole map. As for electricity, even if you don't have too much fun connecting a powerplant to a factory, doing it once or twice would not deterr you from the game. It does certainly not compare with actually calculating for the whole map which factories you want to provide with a boost, and how much you can earn from that, and if it's enough to subsidice the required power line (that would probably not pay itself).

Early steam power would be created from wood, woodchips, or coal among other sources; until roughly 1950, factories would often have their own power plants and make their own electricity or steam. If a factory datfile could specify "electricity OR coal" that would be wonderful.  "Coal" here being a placeholder for "steam" ... maybe we really need "electricity OR (coal AND water)"
I'd argue that this would be better done outside the factory. As in: Instead of power lines and a transformer, the player can build a coal generator attached to that factory. While it would still be a hassle, since that generator would need to connect to coal mines and all, I assume it's better than having most factories connect to coal mines, no matter whether they will ever get a coal delivery. Plus, no change to the factory interface is required, which is important if such coal generators were not part of every pakset (and they definitelly wouldn't be)

Early mills required water power; a location= specifier in the .dat could force mills to be placed along rivers of at least a given size.  Specify "electricity OR coal OR waterpower".
Location=River is a thing, so going with the coal generators above, this would just be a waterwheel-generator that can only be placed on a river tile next to a factory. Though you'd have to specify that it's a river, no canal, otherwise why build a coal generator when you can build a canal and a wheel? Perhaps it just doesn't generate enough for the larger factories?

Actually being able to specify inputs as "vegetables OR fruit" would be a huge plus for the factory system generally, as we have only "AND" restrictions in datfiles today.
On the german forums, I suggested good groups. A good group would just be a name of the group and which goods are in it. Eg. the group "vegetables" could contain "carrots" and "horseradish" while the group "fruits" contains "apples" and "bananas", and the group "produce" would contain "vegetables" and "fruits". In a factory, you'd set the group name as if it was the good name (produce). The spawning algorithm would then see any factory that produces carrots, horseradish, apples or bananas as valid delivery options, and once the goods are in the internal factory storage, they all count as produce. Basically, it's as if all those factories produce produce in the first place, but only in regard to this chain - the bunny factory would still want specifically carrots.
In the GUI, the change would only be that all the goods belonging to a group would be added in brackets.

It would be especially useful with things that change over time. The Electronics Producer could require "electronic parts", which are either vacuum tubes or transistors. At the time when producers of transistors spawn and vacuum tubes no more, the electronics producer would not need to change at all.
If it would also work for what a factory produces it would be even better. Eg. a generic mine produces the group "Minerals", and what exactly it produces only becomes clear when a consumer requests those minerals - the ironsmith requests iron, the goldsmith requests gold. (Though what happens if a generic smith requests Minerals? I don't know)
Anyway, while I'd love to see something like that, it has nothing to do with the request here. If you want to discuss it further, I'd kindly ask you to start a new thread.