Looks like everyone is asleep on IRC, so I'll post it here.
I have tested quite some time different implementations of smooth industries and I made one, that really works nicely.
Industry nicely responds to demand and increases production if there is large demand on the station (high station ratings),
or decreases it actively (very shortly), if demand (station ratings) drop, so there is very little "wasted" goods waiting on the station.
I think, that this behaviour of industries would go very nicely together with very large systems (with path-based signalling).
It would be also nice if it could get included into the trunk.
If you want an .exe, say so - here is the change in industry_cmd.c:
(Line 1688 of the latest "trunk" - I think 2221. Line 1700 and beyond stays the same.)
INSTEAD OF THIS (original):
Code: Select all
default: /* INDUSTRY_PRODUCTION */
for (j = 0; j < 2 && i->produced_cargo[j] != 255; j++){
uint32 r = Random();
int old, new, percent;
int mag;
new = old = i->production_rate[j];
if (CHANCE16I(20, 1024, r))
new -= ((RandomRange(50) + 10) * old) >> 8;
if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16))
new += ((RandomRange(50) + 10) * old) >> 8;
Code: Select all
default: /* INDUSTRY_PRODUCTION */
for (j = 0; j < 2 && i->produced_cargo[j] != CT_INVALID; j++){
uint32 r = Random();
int old, new, percent;
int mag;
int influence = (i->pct_transported[j] > 153) ? _patches.prod_changes : -(_patches.prod_changes);
new = old = i->production_rate[j];
// if more than 60% of cargo is transported, there is an up to 3% chance we increase - bigger production = lesser increase
if (CHANCE16I((10 + influence), 500, r))
new += (1 + (((old >> 3) * (i->pct_transported[j] + 75)) >> 8) + (old >> 4) - (old >> (5 + ((i->pct_transported[j] + 25) >> 7))) - (old >> 6) - (old >> 7));
// if less than 60% of cargo is transported, there is an up to 3% chance we decrease - bigger production = bigger decrease
if (CHANCE16I((10 - influence), 500, r >> 16))
new -= (RandomRange((old >> 2) + 1) - (old >> 3) + (old >> 4) + (old >> 5) + (old >> 6) + (old >> 7));
// make sure prod_rate doesn't exceed 255 or oil rig doesn't produce too many passengers
new = clamp(new, 0, 255);
if (i->type == IT_OIL_RIG && j == 1) new = clamp(new, 0, 16);
if (i->type == IT_BANK_TEMP && _opt.landscape == LT_NORMAL) new = clamp(new, 0, 64);