OGFX-industries --> question about compiling

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
Frisius
Engineer
Engineer
Posts: 5
Joined: 03 Jun 2022 19:47

OGFX-industries --> question about compiling

Post by Frisius »

I would like to know how to compile OGFX-industries.

I'm currently busy building/re-shaping a scenario of the British Isles and pre-placing industries. I use (the excellent!) OGFX-industries because in that way I can also use logging camps/lumber mills, copper mines and food processing plants. Placing the industries goes fine, but when I playtest the scenario the secondary and tertiary industries are rapidly closing. For instance in the first years a couple of steel mills, food processing plants, energy plants and factories are closing. With such a speed the scenario is not really that much fun to play.

I checked the NML file (via http://bundles.openttdcoop.org/ogfx-industries/) and found out that there is a counter active that is increased every month an industry is not supplied with cargo. The counter is reset to zero when an industry receives cargo. When the counter reaches 61, it will close. I think this is the culprit? This counter is of no problem when a map starts empty and industries need to be build, but with pre-placed industries they will start closing down before the player or the AI can supply them with cargo.

Ideally I would like to add a parameter where a player can increase or decrease the counter to their likening. However, I just started digging into GRF-coding so for the moment this is too complex for me. I therefore simply increased the counter in "src/templates_industries.pnml" to 9999. I reckon this will work? and that this would be time enough to supply the industry. :wink:

I'm reading into NML (https://www.tt-wiki.net/wiki/NMLTutorial/Installation), have it installed and tried a command line, incorporating "-l <lang> -l <src>" but it did not work.. I'm probably missing a lot since it is a complex structure of files.:(

Anyway, if somebody could help me out, I would be most grateful!
Attachments
ogfx-industries-MB-source.rar
The source with my adjustments in SRC\templates_industries.pnml
(234.02 KiB) Downloaded 59 times
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: OGFX-industries --> question about compiling

Post by Eddi »

i think you're trying to solve the wrong problem. yes, unserviced industries closing after 5 years (=60 months) is a rather crude gameplay feature, but your main problem is that there is a hidden economy simulation that sets a target number of industries on the whole map (this number is based on the "industry density" setting). if you place industries manually, you can easily exceed this number, and so after the initial 5 years the simulation will rapidly cut down the number of industries.
Frisius
Engineer
Engineer
Posts: 5
Joined: 03 Jun 2022 19:47

Re: OGFX-industries --> question about compiling

Post by Frisius »

Thanks for you reaction! I checked the map and have some numbers. Would you and other readers mind letting your thoughts go over the following.

Scenario stats

map size: 2048 x 2048 (British Isles, so al lot of water)

Industry density setting = HIGH

number of towns: about 200

Primary industries (N=201):
- 5 oil wells
- 6 copper mines
- 21 iron mines
- 23 coal mines
- 24 forests/lumber mills
- 122 farms

Secondary and tertiary industries (N=67):
- 5 oil refineries
- 8 factories
- 8 saw mills
- 9 energy plants
- 9 banks
- 13 steel mills
- 15 food processing plants

---

I ran the scenario two times on high speed for two years. One without any spell script and one with a script which has a setting to keep number of industries at level (script: Think globaly, act locally)

First run (without script)

Closing date:
5 months: steel mill
13 months: factory
17 months: steel mill
24 months: factory, saw mill
28 months: iron mine
32 months: factory

Seven industries closed in two years of time

Second run (with script: Think globaly, act locally)

Closing date:
6 months: steel mill, steel mill
7 month factory, steel mill, sawmill
12 months: food processing plant, factory
24 months: factory,
28 months: food processing plant

Nine industries closed in two years of time

---

My questions:

1. Do I perhaps have too many industries?
2. What is a reasonable number of industries on a big map with the industry density setting on HIGH?
2. Or am I somewhat overreacting and is the number of closures reasonable? :?

Thanks in advance!
Last edited by Frisius on 04 Jun 2022 19:33, edited 1 time in total.
Frisius
Engineer
Engineer
Posts: 5
Joined: 03 Jun 2022 19:47

Re: OGFX-industries --> question about compiling

Post by Frisius »

It is very strange. I did a further test by first removing all industries and then I let the algorithm of the scenario builder place industries (with density settings high). It placed a lot of industries all over the British Isles. I guess over 600.

Then I did play test. In the first two years 15 lumber mills/forests started, one farm and one iron mine. No industries closed!

I have no idea what is going on, but when I pre-place industries my self they close, and when they are panted by the scen. builder they don't... :?:
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: OGFX-industries --> question about compiling

Post by Eddi »

two things you might also be missing:
  1. aside of balancing the total number of industries according to the industry density, the economy simulation also tries to balance the ratio of industries (based on a table of appearance chances). the random industries will probably be much closer to this desired ratio, wheras manually placed industries will probably have big outliers.
  2. despite the date not moving, time actually does pass in the scenario editor, which might make your manually placed industries be well into the 5 year grace period, whereas your deleted and randomly generated industries start with a fresh counter. so you won't see any industry closures until way further into your test game.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: OGFX-industries --> question about compiling

Post by jfs »

Eddi wrote: 05 Jun 2022 14:37 [*]despite the date not moving, time actually does pass in the scenario editor, which might make your manually placed industries be well into the 5 year grace period, whereas your deleted and randomly generated industries start with a fresh counter. so you won't see any industry closures until way further into your test game.[/list]
I considered this too, but on the other hand I'm pretty sure the check for industries is based on date of last pickup/delivery rather than number of days or ticks passed. Regardless, I think it would be reasonable to reset any of that kind of counters for all industries when a scenario game is started.


Edit: Yes, what the game keeps track of is "year which the industry last produced anything", for each cargo it can produce.


Edit 2: Verified rules for original industries.
Primary industries (mines, farms, forests, etc.) close when their production is at the lowest possible level and they decrease production further. So for a mine/farm/etc to remain on the map for a long time after scenario start, it has to have a high initial production level.
Secondary industries (factories etc. that take input and make output) might close if it's been more than 5 years since they produced anything
Tertiary industries (power plants and others that accept something and produce nothing) can't close.


Edit 3: If you change the scenario starting date in the editor after placing secondary industries, then their "last production year" might be long before the current date at game start, and they can start closing down immediately. I'll see if we can classify that as a bug!
Frisius
Engineer
Engineer
Posts: 5
Joined: 03 Jun 2022 19:47

Re: OGFX-industries --> question about compiling

Post by Frisius »

jfs wrote: 05 Jun 2022 15:37
Eddi wrote: 05 Jun 2022 14:37 Edit 3: If you change the scenario starting date in the editor after placing secondary industries, then their "last production year" might be long before the current date at game start, and they can start closing down immediately. I'll see if we can classify that as a bug!
This could be the reason for the quick closures. The original scenario I used was "United Kingdom 1860-2100" and even though I turned the starting time of the current scenario to 1930. It could be very well that I pre-placed industries during 1900 or 1920.. This would explain why they start closing so quickly after starting a new game with this scenario loaded.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: OGFX-industries --> question about compiling

Post by jfs »

The bug has been fixed and the fix should be in the next released version of OpenTTD :)
Now the "last production year" statistic for industries is reset to the starting year when you start a new game from a scenario.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests