Industry closures/openings
Moderator: OpenTTD Developers
Industry closures/openings
Hi,
I have created a scenario with a very very low industry densty, (between 10 and 15 of each type on a 2048x2048 map), and I couldn't really tune the scenario as much as I wanted and make it stable in the long run.
First I tried to set the industry density to minimal, thinking it would be enough. But quickly, ingame, I had many many industries creations (number of industries easily tripled, even on minimal setting ! ). So I switched to "funding only", and finally, the game stopped creating industries.
The bad side of this is that some of them are still closing in the early stages of the game, because no players is using them.
I was thinking of two ideas:
- the easiest of the two, is to have the game compute a density for each industry type at the start, and keep this density. A new option would be "maintain original density". This way, when we create a scenario, if would keep coherent throughout the whole game.
- now for the "game changer": could we introduce a way to affect zones of the map to a particular type of industry ? The industry creation probability would be computed using the number of tiles allocated to each type, that would have two consequences:
+ creating larger zones would mechanically allow a larger number of an particular type of industry
+ we could drive the placement of industries and have more realistic scenarios. For example farms in large flat lands, mines in hilly sectors, electric stations near rivers, etc...
I have created a scenario with a very very low industry densty, (between 10 and 15 of each type on a 2048x2048 map), and I couldn't really tune the scenario as much as I wanted and make it stable in the long run.
First I tried to set the industry density to minimal, thinking it would be enough. But quickly, ingame, I had many many industries creations (number of industries easily tripled, even on minimal setting ! ). So I switched to "funding only", and finally, the game stopped creating industries.
The bad side of this is that some of them are still closing in the early stages of the game, because no players is using them.
I was thinking of two ideas:
- the easiest of the two, is to have the game compute a density for each industry type at the start, and keep this density. A new option would be "maintain original density". This way, when we create a scenario, if would keep coherent throughout the whole game.
- now for the "game changer": could we introduce a way to affect zones of the map to a particular type of industry ? The industry creation probability would be computed using the number of tiles allocated to each type, that would have two consequences:
+ creating larger zones would mechanically allow a larger number of an particular type of industry
+ we could drive the placement of industries and have more realistic scenarios. For example farms in large flat lands, mines in hilly sectors, electric stations near rivers, etc...
Re: Industry closures/openings
One possibility is to use a NewGRF like "OpenGFX+ Industries" which overrides the default industries, and allows you to customize the rules for opening and closing. I believe OpenGFX+ Industries lets you make industries never shut down from disuse.
Another possibility is to use a Game Script that controls industry production changes. Some years ago I added features to let Game Script set "control flags" on industries, that disallow production increases, decreases, and closures. I'm not sure if any scripts were actually written to use that feature.
There have been a few proposals to add "biomes" or "regions" or similar to the game, but none have gotten much further than the idea stage.
Another possibility is to use a Game Script that controls industry production changes. Some years ago I added features to let Game Script set "control flags" on industries, that disallow production increases, decreases, and closures. I'm not sure if any scripts were actually written to use that feature.
There have been a few proposals to add "biomes" or "regions" or similar to the game, but none have gotten much further than the idea stage.
Re: Industry closures/openings
After some time spent in the code, I realized that the Industry density option has no effect during game, only when creating a map, except for the "Funding only" choice, which is taken into account during the game.
I'm wondering why ? Is it the required behavior ? I would seem much more logical to try to keep the same density after the game is launched.
I'll try to implement the first suggestion I made in the opening post, by adding an extra parameter "Keep industry density", i'm wondering if the best way to do it is simply to lock the target_count variable in IndustryTypeBuildData to the amount when the map was created or to change the GetIndustryGamePlayProbability function and return 0 when the required amount of industry has been met ?
I'm wondering why ? Is it the required behavior ? I would seem much more logical to try to keep the same density after the game is launched.
I'll try to implement the first suggestion I made in the opening post, by adding an extra parameter "Keep industry density", i'm wondering if the best way to do it is simply to lock the target_count variable in IndustryTypeBuildData to the amount when the map was created or to change the GetIndustryGamePlayProbability function and return 0 when the required amount of industry has been met ?
Re: Industry closures/openings
Welcome to OpenTTD ... semi-kidding ...
There is no 'why' except for someone willing to spend time finetuning the behaviours .. only "does this add something of value?" and "is this code maintainable in the long run and bug free-ish?" ...
Also ... anything that can be done by NewGRF (or script) should be done by NewGRF (or script) as that is allready possible ...
^^^ opinions may differ but yeah
ps: It's peeps like you who push things forwards .. keep pushing and questioning and coding... plenty of room for improvement but very few peeps with time to do so ...
Maybe industries should not close as fast as they do now ... it's a recurring complaint by (mostly) new players.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Industry closures/openings
Digging into the industry_cmd files, i've come across some weird stuff that i'm discussing here:
viewtopic.php?p=1255647#p1255647
viewtopic.php?p=1255647#p1255647
Re: Industry closures/openings
maybe add mapsize into the mix? most of that code was written when larger maps (4k by 4k ...even 2k by 2k) was not a thing?zifox wrote: ↑09 Oct 2022 16:48 Digging into the industry_cmd files, i've come across some weird stuff that i'm discussing here:
viewtopic.php?p=1255647#p1255647
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Industry closures/openings
although that is just postponing closure ... you can only serve that much in that amount of time ...
replied here as I have not touched that code much if ever ...
replied here as I have not touched that code much if ever ...
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Industry closures/openings
i'm fairly sure that the industry management code was reworked when big maps were already a thing, but that focused more on the opening part rather than the closing.
i always wished for areas of the map to be in sort of a "frozen" state when nobody ever built there (i.e. the nearest town has never had a company rating)
i always wished for areas of the map to be in sort of a "frozen" state when nobody ever built there (i.e. the nearest town has never had a company rating)
Re: Industry closures/openings
That would be a nice fix indeed for vanilla games. (read: without using a no closure NewGRF)
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Industry closures/openings
What do you mean by frozen ? Industry output not going down when the industry never had service ?Eddi wrote: ↑10 Oct 2022 16:33 i'm fairly sure that the industry management code was reworked when big maps were already a thing, but that focused more on the opening part rather than the closing.
i always wished for areas of the map to be in sort of a "frozen" state when nobody ever built there (i.e. the nearest town has never had a company rating)
Re: Industry closures/openings
No ...more like ...zifox wrote: ↑10 Oct 2022 21:41What do you mean by frozen ? Industry output not going down when the industry never had service ?Eddi wrote: ↑10 Oct 2022 16:33 i'm fairly sure that the industry management code was reworked when big maps were already a thing, but that focused more on the opening part rather than the closing.
i always wished for areas of the map to be in sort of a "frozen" state when nobody ever built there (i.e. the nearest town has never had a company rating)
When the town/city 'this' industry belongs to never had service, and thus has no rating yet (the town/city that is), do not consider 'this' industry for closure while the closure code does its thing. aka. 'frozen'
Industries, as well as stations, get named after the closest town/city when spawned/created ... not sure if they actually belong to it ... but yeah that ^^^
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Industry closures/openings
As mentionned in the development section, i'm starting to implement a new way to compute the number of industry we should have on the map, and i'm considering taking the overall population into account, to reflect the fact that more people means more demand, so more industries.
What do you think ?
What do you think ?
Re: Industry closures/openings
I don't have a real opinion on it ... I do not understand most of that code as I tought myself programming and my knowledge has gaping holes.zifox wrote: ↑11 Oct 2022 21:19 As mentionned in the development section, i'm starting to implement a new way to compute the number of industry we should have on the map, and i'm considering taking the overall population into account, to reflect the fact that more people means more demand, so more industries.
What do you think ?
However I think that if you can make industries close less fast, or nor at all when they have never been serviced, as suggested above ... the spawning of new ones issue, so you have enough of them in the long run, may (partially) vanish but itself?
I do like Eddi's suggestion a lot.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.
Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Re: Industry closures/openings
I could add a new option to choose between closure behaviors:
- Original
- Never close an industry which has never been serviced
- Never close an industry in an unserviced area (Eddi's suggestion to check the master town and see if it has service)
It should be possible, though one question already comes to my mind for the last option: what happens if a player bankrupts, and therefore disappears from the cities ratings ?
- Original
- Never close an industry which has never been serviced
- Never close an industry in an unserviced area (Eddi's suggestion to check the master town and see if it has service)
It should be possible, though one question already comes to my mind for the last option: what happens if a player bankrupts, and therefore disappears from the cities ratings ?
Re: Industry closures/openings
How feasable would it be to add an additional function to the town authority window to keep an industry with the same town name open for a period of time by paying the town authority a fee for doing so.
eg keep industry xyz open for an additional 12 months will cost some fee, for 24 months much more .
There would have to be a limit on how long this could be done for .
This is to address the issue of an industry for which a subsidy is offered closing just after a player gets the subsidy.
eg keep industry xyz open for an additional 12 months will cost some fee, for 24 months much more .
There would have to be a limit on how long this could be done for .
This is to address the issue of an industry for which a subsidy is offered closing just after a player gets the subsidy.
Re: Industry closures/openings
This could easily be addressed by prevent the closure of an industry which has a subsidy. I'll look into it.mauried wrote: ↑23 Oct 2022 06:46 How feasable would it be to add an additional function to the town authority window to keep an industry with the same town name open for a period of time by paying the town authority a fee for doing so.
eg keep industry xyz open for an additional 12 months will cost some fee, for 24 months much more .
There would have to be a limit on how long this could be done for .
This is to address the issue of an industry for which a subsidy is offered closing just after a player gets the subsidy.
Re: Industry closures/openings
Thanks.
This sounds like the simplest solution.
I had a look at the subsidy code to see if there is a check made as to whether a particular industry has flagged closure within the subsidy period, but its not obvious.
I dont know where the code is thats involved in the closing of industries but just keeping them open solves the problem.
This sounds like the simplest solution.
I had a look at the subsidy code to see if there is a check made as to whether a particular industry has flagged closure within the subsidy period, but its not obvious.
I dont know where the code is thats involved in the closing of industries but just keeping them open solves the problem.
Re: Industry closures/openings
industry_cmd.cppmauried wrote: ↑26 Oct 2022 03:16 Thanks.
This sounds like the simplest solution.
I had a look at the subsidy code to see if there is a check made as to whether a particular industry has flagged closure within the subsidy period, but its not obvious.
I dont know where the code is thats involved in the closing of industries but just keeping them open solves the problem.
Re: Industry closures/openings
It's in the code handling production, a "close" flag is added to the industry when production is below a given level. I've already added some checks to prevent closure (addition of the closure behavior mentionned earlier), i'll add an extra check to prevent closure if a subsidy exists.mauried wrote: ↑26 Oct 2022 03:16 Thanks.
This sounds like the simplest solution.
I had a look at the subsidy code to see if there is a check made as to whether a particular industry has flagged closure within the subsidy period, but its not obvious.
I dont know where the code is thats involved in the closing of industries but just keeping them open solves the problem.
I'm wondering if I should link it to another option, reuse the "closure behavior" I just added, or make it the standard ?
Who is online
Users browsing this forum: No registered users and 4 guests