Improved smooth_economy patch
Moderator: OpenTTD Developers
-
- Chief Executive
- Posts: 697
- Joined: 10 Jun 2003 00:19
- Location: Australia
Yes, you're right - here's a unified file.
EDIT: Just updated, so the SVN doesn't nag about the industry_cmd.c version. It's now compatible with nightly 2490 (and up....).
EDIT: Just updated, so the SVN doesn't nag about the industry_cmd.c version. It's now compatible with nightly 2490 (and up....).
- Attachments
-
- smooth_economy_enum_allinone_2490.patch
- (1.86 KiB) Downloaded 341 times
-
- my_ind_patch_comments.txt
- (2.14 KiB) Downloaded 394 times
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
And now - at last - the version 1.0 of my patch.
Improved is the behaviour of industries, that are not used/idle - no more message floods from industry, just occasionaly (usually once 2 months) a message.
"Screenshots" of industry_cmd.c:
and industry.h:
Here it is (the patch for nightly 2490 and above...):
Improved is the behaviour of industries, that are not used/idle - no more message floods from industry, just occasionaly (usually once 2 months) a message.
"Screenshots" of industry_cmd.c:
Code: Select all
if ((i->pct_transported[j] > PERCENT_USED_A) && CHANCE16I(1, CHANCE_USED, r))
new += ((RandomRange(AMOUNT_A) + AMOUNT_B) * old) >> 8;
if ((i->pct_transported[j] < PERCENT_USED_B) && (i->pct_transported[j] > 0) && CHANCE16I(1, CHANCE_USED, r) && (old > MIN_RATE))
new -= ((RandomRange(AMOUNT_A) + AMOUNT_B) * old) >> 8;
if ((i->pct_transported[j] == 0) && CHANCE16I(1, _total_industries, r) && (old > (MIN_RATE + 1)))
new += AMOUNT_UNUSED_A - (RandomRange(AMOUNT_UNUSED_B));
Code: Select all
enum {
AMOUNT_A = 50,
AMOUNT_B = 10,
AMOUNT_UNUSED_A = 2,
AMOUNT_UNUSED_B = 5,
CHANCE_USED = 50,
MIN_RATE = 5,
PERCENT_USED_A = 153,
PERCENT_USED_B = 127,
};
- Attachments
-
- smooth_economy_sz_v1-0.patch
- (1.9 KiB) Downloaded 355 times
-
- sz_ind_patch_comments_v1-0.txt
- (2.27 KiB) Downloaded 358 times
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Again - a minor only update - I simplified the code a bit and changed the idle behaviour - there will be some more industry messages, but only in the biggest maps (>512x512 tiles), which is quite normal, as there are A LOT of industries (at least ten thousand producing - also the area of 2048x2048 map is 16 times bigger than that of 512x512 and the number of messages only increases by some 12 (not factor ).
To make it simple - just disable "Economy changes" messages in "News Settings".
Happy building.
P.S.: A bit corrected - too simplified on some areas in 1.1.
Code "screenshots":
industry_cmd.c
industry.h
And patches (from source/trunk 2521):
To make it simple - just disable "Economy changes" messages in "News Settings".
Happy building.
P.S.: A bit corrected - too simplified on some areas in 1.1.
Code "screenshots":
industry_cmd.c
Code: Select all
new = old = i->production_rate[j];
if ((i->pct_transported[j] > PERCENT_INCREASE) && CHANCE16I(1, CHANCE_USED, r))
new += ((AMOUNT_A + RandomRange(AMOUNT_B)) * old) >> 5;
if ((i->pct_transported[j] < PERCENT_DECREASE) && (i->pct_transported[j] > 0) && CHANCE16I(1, CHANCE_USED, r) && (old > MIN_RATE))
new -= ((AMOUNT_A + RandomRange(AMOUNT_B)) * old) >> 5;
if ((i->pct_transported[j] == 0) && CHANCE16I(1, CHANCE_UNUSED + (_total_industries >> 6), r) && (old > MIN_RATE))
new += (old >> 2) - RandomRange(old >> 1);
Code: Select all
enum {
AMOUNT_A = 3,
AMOUNT_B = 5,
CHANCE_USED = 33,
CHANCE_UNUSED = 50,
MIN_RATE = 5,
PERCENT_DECREASE = 127,
PERCENT_INCREASE = 153,
};
- Attachments
-
- smooth_economy_sz_v1-2.patch
- Patch
- (1.86 KiB) Downloaded 358 times
-
- sz_ind_patch_comments_v1-2.txt
- Comments
- (2.3 KiB) Downloaded 373 times
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Thank you for your kind words.
I shall put the latest version of it in the first post too.
Please - tell me, if you find industry too responsive, because in the latest version I raised the chance to increase/decrease from 2 to 3% and it seems quite responsive...
I shall put the latest version of it in the first post too.
Please - tell me, if you find industry too responsive, because in the latest version I raised the chance to increase/decrease from 2 to 3% and it seems quite responsive...
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
1.4 - Increase is smaller with bigger productions with this one and idle production ranges from 32 to around 170 (not much more) and the "safety switches" are gone.
- Attachments
-
- smooth_economy_sz_v1-4.patch
- (2.28 KiB) Downloaded 315 times
-
- sz_ind_patch_comments_v1-4.txt
- (2.09 KiB) Downloaded 345 times
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Just a compatibility release - for source r2653 and up.
- Attachments
-
- smooth_economy_sz_v1-4_r2653.patch
- (2.28 KiB) Downloaded 356 times
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
-
- Engineer
- Posts: 14
- Joined: 26 Jul 2005 13:16
Industry is dying!
Hello!
i use the LKraiders integrated build which includes your patch 1.4, and i have some problems that seem to have to do with the improved smooth economy.
i hope i can write about it here anyway, since it has with changing industry production to do. perhaps it belongs in the integrated build patch thread thouigh.
it is a great idea, but it doenst work for me.
when i started the industries had normal outputs. however, after i connected them to my railroad network, production seems to drop, and most alarmingly in iron ore mines. my iron or mines was 80-110 production when i started, but now all but one of my 8 iron ore mines have dropped in production to 27-30 ore per month. this is while serviced by several trains, and in the lowest producing mines i transport 99% of all the ore(!). this occurs with other industries too, for example a coal mine, which produced 240 at the start, and now have dropped to 110 cpm even though basically constantly loading trains and a % transported of 65-70 or more.
i did an experiment when i chose a station, made sure it always had trains on full load waiting, increased my town rating, bought a statue, and fast forwarded. the production was stuck on 27 iron ore for several years.
i use the LKraiders integrated build which includes your patch 1.4, and i have some problems that seem to have to do with the improved smooth economy.
i hope i can write about it here anyway, since it has with changing industry production to do. perhaps it belongs in the integrated build patch thread thouigh.
it is a great idea, but it doenst work for me.
when i started the industries had normal outputs. however, after i connected them to my railroad network, production seems to drop, and most alarmingly in iron ore mines. my iron or mines was 80-110 production when i started, but now all but one of my 8 iron ore mines have dropped in production to 27-30 ore per month. this is while serviced by several trains, and in the lowest producing mines i transport 99% of all the ore(!). this occurs with other industries too, for example a coal mine, which produced 240 at the start, and now have dropped to 110 cpm even though basically constantly loading trains and a % transported of 65-70 or more.
i did an experiment when i chose a station, made sure it always had trains on full load waiting, increased my town rating, bought a statue, and fast forwarded. the production was stuck on 27 iron ore for several years.
- Attachments
-
- Malwich Motors, 13th Dec 1947.png
- This shows the low production of the industries
- (52.14 KiB) Downloaded 276 times
-
- This shows the low production and high transported %
- Malwich Motors, 21st Nov 1947.png (40.71 KiB) Viewed 7744 times
Hello and welcome to the Forum.
In the LKRaider's Integrated nightly build 2424i4 there is the v1.2 of my Industry patch included and not 1.4, although none of the patches cause such drastic decrease regardless of non-use of industry.
The general idea is to have station rating over 60% for industry to increase (in time (2% chance)). Of course if your stations are not visited by road vehicle/train the cargo will not be going to it (because of another patch in the "i4").
Now if industry is not used, there's a mild tendency to decrease (over increase), but slowly (only 2% chance).
Please read my 1.2 comments.
The second (and first too for that matter) screenshot shows the productions in "world recession" - all the productions go to 1/2.
In all the "i4" games I've played/seen/tested in countless hours, this hasn't happend yet and also you should look again at the settings and installation of your integrated nightly build.
In the LKRaider's Integrated nightly build 2424i4 there is the v1.2 of my Industry patch included and not 1.4, although none of the patches cause such drastic decrease regardless of non-use of industry.
The general idea is to have station rating over 60% for industry to increase (in time (2% chance)). Of course if your stations are not visited by road vehicle/train the cargo will not be going to it (because of another patch in the "i4").
Now if industry is not used, there's a mild tendency to decrease (over increase), but slowly (only 2% chance).
Please read my 1.2 comments.
The second (and first too for that matter) screenshot shows the productions in "world recession" - all the productions go to 1/2.
In all the "i4" games I've played/seen/tested in countless hours, this hasn't happend yet and also you should look again at the settings and installation of your integrated nightly build.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
PLEASE try to reproduce the bug in a stand-alone build (ie clean svn+the relevant patch one) before asking for help...
...most of those patches that went into the "integrated" build are not ready/stable enough and they were not designed to integrate with each other, so many problems should be because of all the patches together, not because of some individual one.
thank you.
...most of those patches that went into the "integrated" build are not ready/stable enough and they were not designed to integrate with each other, so many problems should be because of all the patches together, not because of some individual one.
thank you.
If ain't broken, don't fix it. | JabberID: stavrosg@jabber.org
Hello, I am a signature virus. Please copy me to your signature to help me spread.
Hello, I am a signature virus. Please copy me to your signature to help me spread.
Well, Stavros, that is not a bad idea, however my patch is totally independent of the other patches and the workings are explained in the comments file with the "i4" 1.2 release - it's somewhere in this topic.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
-
- Engineer
- Posts: 14
- Joined: 26 Jul 2005 13:16
wow, that was a very fast reply, and from the programmer as well. thanks a lot. i really appreciate your efforts in improving the game.
i'm sorry for the misunderstanding about 1.2/1.4. the readme of r2424i4 doesnt really say.
I finally realized what a world recession is, and that explains the low amounts of cargo. i didnt know this at first, and experimented in some ways to find out what was wrong. it turns out that i switched economy-fluctating to steady while i was in the recession, which meant that all industries permanently only have half production. apparently they wont increase from cargo transported either.
does your patch work with economy-steady?
i'm sorry for the misunderstanding about 1.2/1.4. the readme of r2424i4 doesnt really say.
I finally realized what a world recession is, and that explains the low amounts of cargo. i didnt know this at first, and experimented in some ways to find out what was wrong. it turns out that i switched economy-fluctating to steady while i was in the recession, which meant that all industries permanently only have half production. apparently they wont increase from cargo transported either.
does your patch work with economy-steady?
Well - I try to get my patch to the people, and not even being a programmer, but an avid fan.
Anyhow - it works with steady and fluctuating economy. You can get the better productions again, just switch to fluctuating and wait (usually not more than 1 year) for the productions to get normal again and then you can safely switch to steady. Apart from 3 (1-year) recessions in 100 years, the fluctuating economy is nothing scary.
I think it'll perform nicely for you - just build and efficient system and have over 60% station ratings and don't worry about industries - they'll increase.
Anyhow - it works with steady and fluctuating economy. You can get the better productions again, just switch to fluctuating and wait (usually not more than 1 year) for the productions to get normal again and then you can safely switch to steady. Apart from 3 (1-year) recessions in 100 years, the fluctuating economy is nothing scary.
I think it'll perform nicely for you - just build and efficient system and have over 60% station ratings and don't worry about industries - they'll increase.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
-
- Engineer
- Posts: 14
- Joined: 26 Jul 2005 13:16
well, the recession did not end ever after almost a decade after switching to fluctating again, so i guess that that is a bug. i guess i'll revert to an earlier save. also the 27 producing industries did not go up again with 99% transported.
i am confused that if it is the *ratings* or the *% transported* that affects production, the source seems to indicate it is the latter.
i understand that it would help i i isolate the problem, but i am really not interested in downloading compilers and libs and have all the hassle with building my own special exe, i just want to play the game, and LKraiders build add several important features that i desire, unstable and untested though.
OpenTTD will surely be a great game over time as all features mature.
i am confused that if it is the *ratings* or the *% transported* that affects production, the source seems to indicate it is the latter.
i understand that it would help i i isolate the problem, but i am really not interested in downloading compilers and libs and have all the hassle with building my own special exe, i just want to play the game, and LKraiders build add several important features that i desire, unstable and untested though.
OpenTTD will surely be a great game over time as all features mature.
Well - that recession could also be a bug in "i4", it worked for me in normal OTTD and the nightly...
Well - it's % transported, but I said station ratings, as they affect % transported.
Read the comments with my patch and you'll see industries can't really increase from that low productions, because it increases in small increments (10-25%) and it increases the amount (production_rate), that is given 8 or 9 times per month and not the whole production_level - again read the comments.
To increase such low productions I'd have to use at least 50% increases, but that would be very similar to non_smooth economy. Imagine one saying - Woohoo - my mine increased from 16 to 24 tonnes per month - with existing patch and 1.2 in "i4" productions don't fall under 40/32 (no point) and can easily increase, if you'd let the recession end normally.
If they are too low - just press CTRL+ALT+C and set them higher and they'll pick up.
Well - it's % transported, but I said station ratings, as they affect % transported.
Read the comments with my patch and you'll see industries can't really increase from that low productions, because it increases in small increments (10-25%) and it increases the amount (production_rate), that is given 8 or 9 times per month and not the whole production_level - again read the comments.
To increase such low productions I'd have to use at least 50% increases, but that would be very similar to non_smooth economy. Imagine one saying - Woohoo - my mine increased from 16 to 24 tonnes per month - with existing patch and 1.2 in "i4" productions don't fall under 40/32 (no point) and can easily increase, if you'd let the recession end normally.
If they are too low - just press CTRL+ALT+C and set them higher and they'll pick up.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Some minor improvements in "increase if-clause".
- Attachments
-
- smooth_economy_sz_v1-5_r2653.patch
- (2.3 KiB) Downloaded 316 times
-
- sz_ind_patch_comments_v1-5.txt
- (2.12 KiB) Downloaded 347 times
Last edited by SirkoZ on 30 Jul 2005 12:01, edited 1 time in total.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
-
- Engineer
- Posts: 14
- Joined: 26 Jul 2005 13:16
my problems are solved now, and i dont really have those very low productios, but it doesnt get very high eighter at stations i serve often, but perhaps i dont wait long enough (i've played 1930-1968).
i wonder if it is worth to make my own build, is it very fussy to get right? i do quite a bit of programming, and use SDL for my own programs, is it possible to build OpenTTD in MSVS.NET 2003?
but that was off topic, you dont have to answer that. i'll look around for info.
great work on the patch!
a comment on the 1.5 readme, the .txt document still says 1.4 at top.
i wonder if it is worth to make my own build, is it very fussy to get right? i do quite a bit of programming, and use SDL for my own programs, is it possible to build OpenTTD in MSVS.NET 2003?
but that was off topic, you dont have to answer that. i'll look around for info.
great work on the patch!
a comment on the 1.5 readme, the .txt document still says 1.4 at top.
Last edited by CheeseWeaver on 30 Jul 2005 12:37, edited 1 time in total.
OT-answer:CheeseWeaver wrote:i wonder if it is worth to make my own build, is it very fussy to get right? i do quite a bit of programming, and use SDL for my own programs, is it possible to build OpenTTD in MSVS.NET 2003?
It sure is possible to compile in MSVS.NET 2003, as long as the included project file is up-to-date (sometimes it takes a few hours till the .vcproj is updated for new/renamed files) and if nobody has broken compatibility (which happens sometimes, too, but is usually solved shortly afterwards).
CheeseWeaver - I'm glad you like it - well - it does take some more time to get to higher values, but the bigger the production, the smaller are the increases (kind of exponential) and it can decrease (seldomly) just a little bit too.
General behaviour/idea of my patch: you build the rail system as efficient as possible and industry will act accordingly - more efficient, higher productions.
BTW - I'll update/correct the 1.4 in the readme.
As for MS VS.NET - yes, it compiles nicely - I use it - just follow the compile tips on wiki.openttd.org .
You have to have SDL, png files (useful files), put them in VS Vc7's "lib" and "include" dir and it'll work nicely.
General behaviour/idea of my patch: you build the rail system as efficient as possible and industry will act accordingly - more efficient, higher productions.
BTW - I'll update/correct the 1.4 in the readme.
As for MS VS.NET - yes, it compiles nicely - I use it - just follow the compile tips on wiki.openttd.org .
You have to have SDL, png files (useful files), put them in VS Vc7's "lib" and "include" dir and it'll work nicely.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Who is online
Users browsing this forum: No registered users and 53 guests