Suggestion: Disable closure and opening of Industries

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

What do you think about my suggestion?

Good idea, i'd love to see it in trunk!
48
71%
Good idea, but a NewGRF would be enough for me.
11
16%
I don't need an option like this, but I wouldn't mind if it would exist.
5
7%
I don't need this option and I am against it being included to trunk.
3
4%
None of the above (maybe leave a comment?).
1
1%
 
Total votes: 68

User avatar
Timitry
Transport Coordinator
Transport Coordinator
Posts: 313
Joined: 01 Oct 2004 15:28
Contact:

Suggestion: Disable closure and opening of Industries

Post by Timitry »

Hello everyone!
I'm suggesting an option here to prevent the closure and opening of Industries during the game. It has gotten quite a lot of text, i hope yoou don't mind :)



1. What is this Suggestion all about?

I (and hopefully many more) would like to see a new option in the game, which, if triggered, will prevent industries from closing down during the game and new ones from opening.
Currently, primary industries (such as coal mines) have a chance to close down when the cargo they produce is not being transported, and their production level is very low. Secondary industries (such as steel mills or factories) in contrast have a chance to close down when no cargo is being delivered to them. Also, during the game, both new primary and secondary industries appear randomly on the map.
If this suggestion gets implemented, you will be able to control these behaviours of the industries. There would be two options:

1) The first one would control if industries are allowed to close down, you could choose whether
  • you want to use the old behavior, which means that all industries may close down as usual,
  • you want to prevent only primary industries from closing down,
  • you want to prevent only secondary industries from closing down or
  • you want to prevent all industries from closing down.
2) The second one would control if new industries are allowed to be generated automatically. You could choose whether
  • you want to use the old behavior, which means that new industries will be generated as usual,
  • you want to prevent only primary industries from being generated,
  • you want to prevent only secondary industries from being generated or
  • you want to prevent all kind of industries from being generated.

2. Why is this feature useful?

There are quite a few situations, where a feature such as this would prove to be very useful:

1) You start a new game on a quite big map. You start with setting up a moneymaker, for example by transporting coal or flying passengers from one end of the map to the other. Then you start building a big network for your trains, which takes you ten or twenty years in the game. By the time you are ready to connect industries via your network, a lot of industries have already closed down, and there are few left to connect. If you have hauled coal to generate income, you will have a lot of coal mines left, but few other industries. This situation is very common in OpenTTDCoop-Games, but other players might experience that problem as well. With this new feature, you could “freeze” the starting conditions while building your network.

2) You want to create a heightmap, let’s say of Germany. You create the map and start placing all the towns. To inject some realism, you try to place industries at places where there are also ones in real life. There would be a lot of coal mines and steel mills in the Ruhr-Area, and a lot of farms in the North-East. However, as soon as you start your game, industries will start closing down, and new ones will open – but not where you would like them to be, but randomly spread around the map, destroying you well-designed scenario, which you could prevent with this feature.

3) You want to create a competitive map.
  • a) You create a scenario, which might be very challenging due to the terrain, or which includes some special task the players have to solve, like transporting 80% of all the cargo and passengers. When you hand it out to the players and they start to play, they all have the same conditions at the start. However, some might be lucky, and a lot of primary industries will close down, so that they have less to connect, while others might be bombarded with new industries. That makes it a lot harder to compare their results. Here the feature of disabling the closure and opening of industries would be useful to grant all players the same chances, and make the competition based less on luck.
  • b) You create a map, which you divide in four pieces, which all have the same or at least a similar setup. Each player gets his quarter of the map and has to build up his company on it. While at the start the conditions are perfectly equal for all players, soon new industries will open randomly on the map. Now one player might get a lot of new industries on his quarter, while another one gets none. Again, this feature would be useful to provide the same conditions for all players throughout the whole game.

3. Is there no way that feature can be simulated at the moment?

Well, there are some possibilities to simulate that feature I suggest in some parts, however, they are all not very good:
1) To “prevent” the opening of new industries, you could always delete all industries that appear on the map with the magic bulldozer. However, doing this requires a lot of work, especially on big maps, and distracts you from the things you really want to do, like building your network.
2) To prevent the closure of industries, you “just” need to transport their cargo respectively deliver them with cargo. This option might be useful to prevent an industry you are planning to connect soon from closing down, but it requires a lot of work to do so, and especially on bigger maps like 1024x1024 it will take you ages to connect all the industries on the map just to prevent them from closing down.


4. How can that feature be included?

There would basically be two ways to include the feature into the game:
1) Via a newGRF, where you could possibly set parameters to choose between the options I described in part one of this article.
2) Via a code-wise implementation, which would mean writing a patch and then possibly merging it into trunk.

I am against an implementation via NewGRF, and I want to give you my reasons for that:
1) Comfort: Every player who wants to play your scenario or play online with you needs that specific NewGRF, and will have to search and download it before being able to play. If implemented code-wise, all you need to do is set to switches in the “Advanced Settings”-Menu, under the “Economy”-Tab
One could argue now, that this is the case with all the NewGRFs out there, and ask why this feature should get a special status. Well, in my opinion, this feature adds an elementary option to the game, which is just as important as being able to control how fast towns will grow or whether there can be multiple similar industries per town, so that I think there should be an easier option than to search and download the GRF, add the parameters and start your game – consider that you might want to change the behavior during the game, which could cause problems if using a NewGRF.
2) NewGRFs are rather for Graphics than for Settings. A quote from the OpenTTD-Wiki: “NewGRF is the way new graphics, vehicles, buildings, cargoes and industries can be introduced into OpenTTD.” I think this quote is quite true, I download NewGRFs to get cool new Graphics or Industry Sets, not to change game options. Of course, there are NewGRFs like the BaseCostMod out there, which – again, in my opinion – should also be included code-wise, since using it now is rather complicated and many players might not even know that this NewGRF exists, although they might use the feature if it would be implemented code-wise.
3) If implemented via a NewGRF, there probably would be compatibility problems if you want to play with NewIndustry-Sets such as PBI, which could probably be sorted out if implementing that feature code-wise.


5. Code-wise introduction of the feature

I admit that I have almost no knowledge about coding, so what I’m describing here might not be possible like I imagine it to be. However, I’ll tell you how I would imagine what this feature might work and look like if being included.

You could easily control the opening- and closing-behaviors of the industries via the “Advanced Settings”-Menu, under the “Economy”-Tab, like shown in the mockup I attached. Both of the switches have the four possible options “None”, “Only primary industries”, “Only secondary industries” and “All industries”.

I heard that industries are kind of “asked” each month: “What will you do next month?”, where their answer can be either: “I will increase production”, “I will decrease production”, “Nothing / Everything will stay as it was” or “I will close down”. For implementing the option to prevent industries from closing down, one would probably need to add that if an industry answers “I will close down” it will check for state of the “Industries that may close during the game”-switch. If this is either set to “None” or “Only my kind of industry”, the procedure which would close down the industry would be prevented / not be started.

Then, for the opening of new industries, there will probably be some random function, which at given times might decide to fund a new industry, and will randomly choose one type. Again, this function would need to check for the state of the “Industries that will open during the game”-switch, and if it’s either set to “None” or “Only my kind of industries”, it would either cancel or only choose between the given kind of industries (primary OR secondary).

Again, I want to make clear that I am not a coder, and unfortunately do not have the time to learn C++ to implement this feature myself, I just try to do some of the work by providing this concept. Implementing the feature could or will probably be a bit more complicated than I described, nevertheless I hope someone is up for the challenge and will write a patch, and that this is possible at all.
Please vote in the poll I created to show whether you like the feature or not, and post suggestions, constructive criticism etc. in the thread. The more resonance there is, the higher the chances are there will be some kind of progress.

Thank you for your attention!
Regards, Tim.
Attachments
How the Economy-Tab might look like with the Feature included.
How the Economy-Tab might look like with the Feature included.
OpenTTD - Advanced Settings with Opening and Closure.png (12.84 KiB) Viewed 6978 times
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

I would be interested in seeing this but also would like to know what others and the Devs think.

Though i do believe that Timitry has put time and thought into this which is always a good start on getting something done.
So i agree and well done to timitry for a greatly informative post.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Suggestion: Disable closure and opening of Industries

Post by SirkoZ »

Very nice - with even being available what industry to open/close.
I voted for the top-most option.
User avatar
Timitry
Transport Coordinator
Transport Coordinator
Posts: 313
Joined: 01 Oct 2004 15:28
Contact:

Re: Suggestion: Disable closure and opening of Industries

Post by Timitry »

Thank you for your feedback :)

I just wanted to add that if someone feels like he could do the coding on that, it could be easily split in two parts, so at first one patch could be made for preventing industries from opening and one to prevent them from closing, i guess this would reduce the amount of work already.
Another thing to reduce work would be to only allow the options "None" and "All industries" at first. The options "only primary / secondary industries" might be added later...
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Suggestion: Disable closure and opening of Industries

Post by athanasios »

Well spoken. And it can help create a ladder(s) for each climate.
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.
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

ive only just started codeing in cpp but if you want i could try and make it?
Unless someone with more experience would like to that is, im willing to allow someone else with more experience to do it.
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Suggestion: Disable closure and opening of Industries

Post by CommanderZ »

burty wrote:ive only just started codeing in cpp but if you want i could try and make it?
Unless someone with more experience would like to that is, im willing to allow someone else with more experience to do it.
It should be easy, try it :wink:
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

yeah i will :D, i have started now
User avatar
Timitry
Transport Coordinator
Transport Coordinator
Posts: 313
Joined: 01 Oct 2004 15:28
Contact:

Re: Suggestion: Disable closure and opening of Industries

Post by Timitry »

That's lovely to hear, please provide us with information about the progress, and a patch as soon as you have it :)
You probably already have done that, but if you're new to coding for OTTD, you should have a look at the coding guidelines, so your patch will be standard-conform ;)

Regards,
Tim
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

Timitry wrote:That's lovely to hear, please provide us with information about the progress, and a patch as soon as you have it :)
You probably already have done that, but if you're new to coding for OTTD, you should have a look at the coding guidelines, so your patch will be standard-conform ;)

Regards,
Tim
yeah im new but it is not my first attempt though i have hit a problem which can be found in the problems section hehe its probably where i am almost asleep trying to do anything today.
Yeah i will keep you up to date with everything that happens hopefully in about a week there should be the first version done.
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

Ok attached is a version which needs bug testing at the moment it only disables and enables closure of industries, the option is set as
[<] and [>] since it will be easier to add Only Primary etc into them without much more effort.

I hope so far this is ok and can i get feedback plus bugs please.
I will open a thread in the Dev Block for this also so please look there from now on for news and releases.
Attachments
OTTD.zip
Enable/Disable Closure of industries R14469
(2.87 MiB) Downloaded 165 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Suggestion: Disable closure and opening of Industries

Post by DaleStan »

Source code?
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
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

DaleStan wrote:Source code?
At the moment im tidying it as i was rushing through and the strings are messed around atm the
_OPENABLE says :What industries are allowed to close so when i have fixed that i will attach the patch for it :D
Attachments
industry_open_close.patch
Patch File
(5.37 KiB) Downloaded 159 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Suggestion: Disable closure and opening of Industries

Post by DaleStan »

burty wrote:At the moment im tidying it
No. No No No.

You post the source code that corresponds to the executable. You don't post the executable and then pretty up, bug, and/or debug the source.
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
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

DaleStan wrote:
burty wrote:At the moment im tidying it
No. No No No.

You post the source code that corresponds to the executable. You don't post the executable and then pretty up, bug, and/or debug the source.
Oh, sorry ill redo the zip then as i knew the untidyness was there i just wanted to get a binary out for people to see it.
And my code never has bugs it only has unplanned features.
Attachments
industry_open_close.patch
Tidyed up code.
(5.37 KiB) Downloaded 186 times
OTTD.zip
Re-compiled binary with no changes at all except i tidyed my code up
(2.81 MiB) Downloaded 178 times
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

One thing i did change is that i put it under Construction tab not Economy as it seemed to make just as much sense to me.
User avatar
Timitry
Transport Coordinator
Transport Coordinator
Posts: 313
Joined: 01 Oct 2004 15:28
Contact:

Re: Suggestion: Disable closure and opening of Industries

Post by Timitry »

Thanks for the work, i'll test it as soon as i can :) It's very much appreciated!
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: Suggestion: Disable closure and opening of Industries

Post by burty »

Your welcome :D, there is a post in the developement section now so please move any discussion to there please.
fafler
Engineer
Engineer
Posts: 5
Joined: 10 Feb 2007 14:39

Re: Suggestion: Disable closure and opening of Industries

Post by fafler »

Sorry for digging up such a old thread, but why did this patch not make it into the sources?
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Suggestion: Disable closure and opening of Industries

Post by Lord Aro »

among other reasons, (like the devs not really wanting it) the coding style is rubbish.
wouldn't be too hard to bump to trunk though...
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 26 guests