Patch: Disable Random Closing and Opening of Industries

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Patch: Disable Random Closing and Opening of Industries

Post by wleader »

I've been trying to play passenger only games, and invariably even if the map was generated with no industry, some eventually appears and I fail to resist the urge to connect them. Anyway I've also been thinking about the possibility of league games, and the effect of random industries on scenarios. So I thought it would be useful to be able to disable random creation and closing of industries. So here it. Feel free to help me test it.
Attachments
No_Random_Industry_r1.patch
Patch against r11199 to disable random construction and closing of industries.
(3.81 KiB) Downloaded 702 times
Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by Progman »

Maybe its better to use 2 options for seperating closing and opening or use one option which allowes you to set these individual. I would like to play without closing industries, but new industries should be opened anyway.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Disable Random Closing and Opening of Industries

Post by Roujin »

*agree* with Progman.

and does the closing apply to both primary and secondary industry?

iirc, closing of primary industry happens when the production rate goes below a certain level (can anyone tell if this is right?) - with your patch, what happens if the production goes below that level? can it decrease and decrease downto zero?
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
flake
Engineer
Engineer
Posts: 66
Joined: 28 Apr 2004 10:07
Location: Salzburg
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by flake »

yay! i am not fond of closing industries, so i'll give it a try.
*<(:-}
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by athanasios »

I agree too.
1. No new raw industries.
2. No new industries.
3. No closing of raw industries (3a Oil Wells)
4. No closing of industries.

But 4 has been discussed extensively before. My opinion, as I have already said before, is for industries not served to deteriorate and to need money (fund them) to come back to operation by time. They should fall to ruins after a very long time of inactivity (50 - 60 years).
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
Rafagd
Engineer
Engineer
Posts: 36
Joined: 01 Oct 2007 15:30

Re: Patch: Disable Random Closing and Opening of Industries

Post by Rafagd »

option4 would be good for easy mode and player guide games...

option3 would be good for a hard mode if not too many industries are on the map... So players would need not only compete for them, but try to maintain them alive!
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by belugas »

Just for your information, the creation of random industries can be blocked by Action 00 for industries, property 18. Set it to zero and you have less of a problem.
I have to admit the closing may be a little trickier. But setting bits 1 or 2 in property 21 in conjunction with Industry Production Callback would certainly do the trick
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by DaleStan »

belugas wrote:Just for your information, the creation of random industries can be blocked by
I have to admit the closing may be a little trickier. But setting bits 1 or 2 in property 21 in conjunction with Industry Production Callback would certainly do the trick
Huh? The production callback has something to do with random closing? If so, that's a bug.
I would guess that bits 4 and 5 would be more useful.

Belugas: OpenTTD can do production changes smaller other than halve/double. Can newGRFs request this?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Re: Patch: Disable Random Closing and Opening of Industries

Post by wleader »

belugas wrote:Just for your information, the creation of random industries can be blocked by Action 00 for industries, property 18. Set it to zero and you have less of a problem.
I had no idea that sort of thing was possible with newgrfs. But looking at the Action 0 Docs I would agree that it would be an easy way to prevent random industries from appearing. If we wanted to have the same functionality to prevent closing, woudn't we have to add some property to the industry spec that could be modified by a newgrf? If TTD patch would agree to such a change, then I would be for it, but since my patches have been just little tweaks here and there, I doubt that my opinion matters very much.

I can also see how granularity of control, as has been suggested, could be useful in various situations, but it makes the patch a great deal more complicated than it is. Right now its just a few lines in the close industry code, and a single line in the MaybeNewIndustry function.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by belugas »

DaleStan wrote:Belugas: OpenTTD can do production changes smaller other than halve/double. Can newGRFs request this?
If i'm not mistaken, cb29, cb35 (industry_cmd.cpp:1861) and industry production callback (action2) (newgrf_industries.cpp:487) do follow the specs.
Are you talking about a new kind of feature? I guess anything can be done, as long as we all agree on the requirement (including Csaboka, of course)
Or did you (already) find a bug?
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by DaleStan »

It's not a bug so much as a misfeature. Callbacks 29/35 can only specify power-of-two production changes. Unless I miss my guess, industries not using those callbacks, or industries returning 04 from CB29, will get the whole range of small percentage changes.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 623
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by glx »

That is smooth economy, but I disabled it for industries using production callbacks, as it could close them if they didn't produce anything for more that a month.
User avatar
flake
Engineer
Engineer
Posts: 66
Joined: 28 Apr 2004 10:07
Location: Salzburg
Contact:

Re: Patch: Disable Random Closing and Opening of Industries

Post by flake »

On a dedicated linux machine i recieved a segmentation fault after several months, but could not reproduce it.
The other thing i am not happy about is that it changes the savegame.
*<(:-}
wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Re: Patch: Disable Random Closing and Opening of Industries

Post by wleader »

For now I am considering this patch as proof of concept. Meanwhile I'm looking into the NewGRF specs to see if I can change behavior that way. I'm also waiting to see what the Devs do in regards to preventing closure via NewGRF. Anyone is welcome to play around with the code, but I don't plan on doing anything with it for a while.
Jaume
Engineer
Engineer
Posts: 67
Joined: 24 Aug 2007 15:43

Re: Patch: Disable Random Closing and Opening of Industries

Post by Jaume »

Hi wleader

Look this old patch: http://www.tt-forums.net/viewtopic.php?f=33&t=33781

I don't know how works "newindustries" now, if it works. But I stopped this patch because "newindustries", this patch does all of your patch does. Last version was for r11118, then they are discontinued.

Since August, I'm playing with r11118 and this patch, with stable economy (no changes, no new industries, don't close industries...)
razielanarki
Engineer
Engineer
Posts: 20
Joined: 08 May 2002 05:01

Re: Patch: Disable Random Closing and Opening of Industries

Post by razielanarki »

i think this patch is a good idea, and using newgrfs for this seem a bit over the top for me

a path option would be the best choice imho as it would work "out of the box", w/o any external dependencies (not to mention it would theoretically allow changing it mid game in a more "clean" way)

(but if a newgrf comes out, i'll definitely use it ;) )
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patch: Disable Random Closing and Opening of Industries

Post by Yexo »

Just updated this patch to the latest version. No changes or anything, just updated to r11781
Attachments
norandom_new.diff
(3.61 KiB) Downloaded 380 times
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Patch: Disable Random Closing and Opening of Industries

Post by Bilbo »

athanasios wrote:But 4 has been discussed extensively before. My opinion, as I have already said before, is for industries not served to deteriorate and to need money (fund them) to come back to operation by time. They should fall to ruins after a very long time of inactivity (50 - 60 years).
If you play on very large map (like 2048x2048) most of the industry would rot before your network would become big enough with this approach - one day you serve say 10% of industries on the map and in next 10 years everything not conected would disappear. Not a god idea.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Patch: Disable Random Closing and Opening of Industries

Post by Bilbo »

I thought of another idea that may be used to solve the problem. Create some closed_industry counter and every time industry is closed, increment it. Every time some new industry is spawned somewhere, decrement it. The larger would be the counter, the more chance of new industry to appear. This would mean that total number of industries on map would remain relatively stable even when industries have smaller chance of appearing (bad terrain, badly set chances ...)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
one billion daleks
Traffic Manager
Traffic Manager
Posts: 198
Joined: 31 Oct 2007 10:54
Location: a/c closed

Re: Patch: Disable Random Closing and Opening of Industries

Post by one billion daleks »

Just following up on the speculation about a bug in Industries earlier in the thread ...

I had ECS implemented and this happened ...

A farm I was supplying with fertiliser and vehicles, and collecting fibre and cereal from ... just closed down on me out of the blue. That was rather annoying, as the farm was the starting point for a whole supply chain, and when it closed down, it triggered a cascade of collapse through the entire chain. Unlike say - oilwells - I couldn't see why a farm would close down under those circumstances ...

Another thing, I was supplying Steel, Glass and Dye to a vehicle factory ... but the Dye deliveries weren't being recorded in the factory's stockpile, it stayed at zero ... the truck unloaded the dye and it just vanished - it wasn't even sitting intransit at the station.

I'm running 0.6-beta1 by the way.
Just mentioning these things on the offchance they have some relevence to the thread! :)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Bing [Bot] and 5 guests