Author Topic: Intention of certain code in simfab.cc  (Read 2288 times)

0 Members and 1 Guest are viewing this topic.

Online jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15125
  • Total likes: 353
  • Helpful: 153
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Intention of certain code in simfab.cc
« on: February 02, 2014, 07:34:56 PM »
May I ask anyone who knows: what is the intention of this code, found in simfab.cc:

Code: [Select]
// if less than 3/4 filled we neary always consume power
currently_producing |= (ausgang[product].menge*4 < ausgang[product].max*3);

This seems to resolve to false even though a factory is producing goods in some cases; is this intended?
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.

Offline TurfIt

Re: Intention of certain code in simfab.cc
« Reply #1 on: February 02, 2014, 07:51:38 PM »
Intended. Electric demand turns off when output store is >=75% full.

Online jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15125
  • Total likes: 353
  • Helpful: 153
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Intention of certain code in simfab.cc
« Reply #2 on: February 02, 2014, 08:02:23 PM »
Interesting. What is the reason for this?
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.

Offline TurfIt

Re: Intention of certain code in simfab.cc
« Reply #3 on: February 02, 2014, 08:07:15 PM »
I don't know - it predates my time...
But, at 75% full, the production rate has already fallen way off; Why continue wasting the limited electric on a factory that doesn't need it? The factory clearly doesn't need the boost if it's ending up 75% full. So this behaviour remains a reasonable game mechanic IMO.

Online jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15125
  • Total likes: 353
  • Helpful: 153
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Intention of certain code in simfab.cc
« Reply #4 on: February 02, 2014, 08:09:23 PM »
Hmm, interesting. I am not sure that this makes much sense in real world terms: a modern factory equipped to run with electricity does not turn off the power and tell all its workers to toil inefficiently by hand when demand is reduced, and the actual rate of production is not reduced in the game in these conditions, either.
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.

Offline TurfIt

Re: Intention of certain code in simfab.cc
« Reply #5 on: February 02, 2014, 08:38:00 PM »
Of course it doesn't make sense in the realworld. It is a game after all...
And in the realworld, layoffs do happen.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8685
  • Total likes: 294
  • Helpful: 228
  • Languages: De,EN,JP
Re: Intention of certain code in simfab.cc
« Reply #6 on: February 02, 2014, 11:37:29 PM »
They do in Germany, it is called Kurzarbeit. The goverment pays a part of the wage, but the worker only work much less. See http://en.wikipedia.org/wiki/Short_time

Offline kierongreen

Re: Intention of certain code in simfab.cc
« Reply #7 on: February 02, 2014, 11:41:06 PM »
In simutrans it's perfectly possible to have a modern factory with no transformer hence no electricity though...

Online jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15125
  • Total likes: 353
  • Helpful: 153
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Intention of certain code in simfab.cc
« Reply #8 on: February 02, 2014, 11:50:33 PM »
None of these things are really reasons for a factory connected to a substation to stop demanding electricity when its output storage gets to 75% full, though; if a tapering of production is what is intended, why should it apply only to factories connected to electricity, and why should only output storage (and not, say, the input storage of its customers) be taken into account? In any event, a player might design her/his transport network so that a large ship or long train comes and takes away the whole of the factory's output storage just as it is full, so it reaching 75% does not really indicate any reason to slow production in and of itself.

I have removed this function in Experimental, and caused factories to demand electricity whenever they produce anything.
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8685
  • Total likes: 294
  • Helpful: 228
  • Languages: De,EN,JP
Re: Intention of certain code in simfab.cc
« Reply #9 on: February 02, 2014, 11:56:32 PM »
The factory output per time unit is related to the filling of the output storage since the dawn of simutrans. The more in the output storage, the slower the factory production. Not sure why Hajo designed it this way, but at 75% filled output storage the production is less than 25% compared to an empty one.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4543
  • Total likes: 163
  • Helpful: 106
  • Languages: EN, NO
Re: Intention of certain code in simfab.cc
« Reply #10 on: February 03, 2014, 06:22:04 AM »
It certainly makes sense that electricity demand is reduced at the same rate as production drops. That electricity demand stops completely makes as much sense as modern factories operating without electricity in the first place. (Or indeed that factories lies dormant for decades waiting for someone to maybe one day provide transportation services.) The power lines in Simutrans must perhaps be seen as dedicated industrial lines for high-power equipment, rather than a generic power grid. Although it does seem somewhat unlikely that they can switch to the public power grid that easily and that they save enough money doing so for short periods.

Online jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15125
  • Total likes: 353
  • Helpful: 153
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Intention of certain code in simfab.cc
« Reply #11 on: February 03, 2014, 11:49:19 AM »
It certainly makes sense that electricity demand is reduced at the same rate as production drops. That electricity demand stops completely makes as much sense as modern factories operating without electricity in the first place. (Or indeed that factories lies dormant for decades waiting for someone to maybe one day provide transportation services.) The power lines in Simutrans must perhaps be seen as dedicated industrial lines for high-power equipment, rather than a generic power grid. Although it does seem somewhat unlikely that they can switch to the public power grid that easily and that they save enough money doing so for short periods.

There is residual code in Standard that suggests that it was always intended that cities should be able to be electrified, too (and this has been done in Experimental, some time ago now), so the dedicated power grid theory I suspect was not the original intention.
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8685
  • Total likes: 294
  • Helpful: 228
  • Languages: De,EN,JP
Re: Intention of certain code in simfab.cc
« Reply #12 on: February 03, 2014, 09:47:44 PM »
The code stemmed from me. I originally intended to base this number on the number of working power stations within the city catchment circle. So it would have rather support a "grid" theory.

Nevertheless, power is ment to be scare and used straegically. Hence not consuming for dormant factories seems fair.