Some questions on limits of industry NewGRF
Moderator: Graphics Moderators
Some questions on limits of industry NewGRF
After mostly playing OTTD and a scenario released, I recently went on to explore some ideas I have about an industry NewGRF and was pleased to find that nmlc works as a stand-alone tool on Windows without the need for any further compiler or development environment.
I mostly analyzed OTIS version 5 for inspiration, since I like the idea to have only one tile for each industry and then build the rest around it based on another graphics-only NewGRF.
However, there are some questions I did not manage to answer from looking at the above *.nml file and the available documentation:
Industry IDs can be in the range of 0 to 127 but do the IDs have to be continuous, or can there be "gaps"?
Cargo IDs can be in the range of 0 to 63 but it is mentioned that IDs 0 to 11 are for "standard cargos"
- Can I still re-define these without detrimental effects?
- Is there a list of what these IDs are normally assigned?
As far as I understand, industries can somehow "sense" the environment in which they are supposed to be built, like only on water.
- Is it also possible to "sense" if there is a certain type of station or "track" tile nearby?
- For example, I want a certain industry to be only built close to an airport or a railway track - is this possible?
I mostly analyzed OTIS version 5 for inspiration, since I like the idea to have only one tile for each industry and then build the rest around it based on another graphics-only NewGRF.
However, there are some questions I did not manage to answer from looking at the above *.nml file and the available documentation:
Industry IDs can be in the range of 0 to 127 but do the IDs have to be continuous, or can there be "gaps"?
Cargo IDs can be in the range of 0 to 63 but it is mentioned that IDs 0 to 11 are for "standard cargos"
- Can I still re-define these without detrimental effects?
- Is there a list of what these IDs are normally assigned?
As far as I understand, industries can somehow "sense" the environment in which they are supposed to be built, like only on water.
- Is it also possible to "sense" if there is a certain type of station or "track" tile nearby?
- For example, I want a certain industry to be only built close to an airport or a railway track - is this possible?
Re: Some questions on limits of industry NewGRF
You can use any ID you want, as the spec says. Gaps are fine.
The default cargo properties are here. Getting rid of (or substantially modifying) passengers, mail, food or goods is probably not a good idea.
Yes, it's possible to an extent - you can check the class of nearby tiles with a location_check callback. Although obviously an industry which requires nearby player-built infrastructure will be ungeneratable at game start.
The default cargo properties are here. Getting rid of (or substantially modifying) passengers, mail, food or goods is probably not a good idea.
Yes, it's possible to an extent - you can check the class of nearby tiles with a location_check callback. Although obviously an industry which requires nearby player-built infrastructure will be ungeneratable at game start.
Re: Some questions on limits of industry NewGRF
Thank you very much for your very valuable comments.
Two more questions:
You mentioned that one should best not modify the PASS, MAIL, FOOD, and GOOD cargos. Does that statement also apply to the cargo IDs (PASS 00, MAIL 02, GOOD 05, and FOOD 0B)? Asking because I would like to arrange (and group) the cargoes either by alphabet on name or label for easier finding in long tables. Would it be ok to change MAIL ID to 01 and GOOD to 02, for example?
Is there a way to split a *.nml file and load parts of it from another one "at compile time" as it is done with the include <file> statement in C or import <module> in Python? As I plan to use all of the cargo IDs and have about 70-80 industries, it would be nice if one could put all of the industry definitions into separate files, one for each industry, and then only "merge" when running nmlc. If not, no worries, then I will write a Python script to read in separate files and automatically generate one final *.nml
I have a very vague memory that somebody reported a similar organization for their NewGRF source code but really cannot figure out anymore who, when, or where
-
- Tycoon
- Posts: 1210
- Joined: 16 Oct 2018 08:31
- Location: Heart of the Highlands. Not Scottish. Czech.
Re: Some questions on limits of industry NewGRF
Pikkabird wrote that he would not even recommend modification. As I understand it, there could also be a problem with what IDs the building sets expect for these cargos.
It could well be that houses in subarctic or tropical climates will not accept food and goods.
I have no doubt that if it were possible, some industry set would already have it alphabetically, but it doesn't. Not even XIS or AXIS.
It could well be that houses in subarctic or tropical climates will not accept food and goods.
I have no doubt that if it were possible, some industry set would already have it alphabetically, but it doesn't. Not even XIS or AXIS.
Re: Some questions on limits of industry NewGRF
Do not have the nml code of XIS or AXIS ready, but at least can confirm the latter for OTIS, which has PASS as 0 and the other three standard cargoes also as indicated.Argus wrote: ↑15 Sep 2023 17:51 Pikkabird wrote that he would not even recommend modification. As I understand it, there could also be a problem with what IDs the building sets expect for these cargos.
It could well be that houses in subarctic or tropical climates will not accept food and goods.
I have no doubt that if it were possible, some industry set would already have it alphabetically, but it doesn't. Not even XIS or AXIS.
Personally, I'd consider it a bug if a building or other set refers to the cargo ID number instead of the cargo label, since the latter symbolic references are usually meant to make things more independent and easier to clearly assign - but that might be lack of insight or sloppyness of developers Or ID numbers even came before symbolic cargo labels?
-
- Tycoon
- Posts: 1210
- Joined: 16 Oct 2018 08:31
- Location: Heart of the Highlands. Not Scottish. Czech.
Re: Some questions on limits of industry NewGRF
Honestly, I'm no expert, just going by my layman's understanding of newgrf behavior. Maybe I'm wrong.
Re: Some questions on limits of industry NewGRF
Actually, if you have a bit of programming experience, reading and understanding the NML language code isn't that terribly difficult - most of it is close to regular English language plus a few "control statements" close to standard programming languages.
I'd really suggest to take a look at such an *.nml file if you have time and want to dig a bit deeper into the technical aspects Personally, also thought for a long time that it is actually more complicated than it turned out in the end
My experience is a bit of Python for science applications, so far from an expert developer here.
But regardless of background - may I recruit you as a "beta tester" for the planned industry set, much like with the Hamburg scenario?
Re: Some questions on limits of industry NewGRF
Before you get too deep in the weeds on this, let me point out that in most (all?) cases, cargos are already listed alphabetically in the game, with the exception of PASS and MAIL being at the top.
- andythenorth
- Tycoon
- Posts: 5664
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Some questions on limits of industry NewGRF
FIRS packages cargos and industries as python modules. https://github.com/andythenorth/firsebla71 wrote: ↑15 Sep 2023 17:29 Is there a way to split a *.nml file and load parts of it from another one "at compile time" as it is done with the include <file> statement in C or import <module> in Python? As I plan to use all of the cargo IDs and have about 70-80 industries, it would be nice if one could put all of the industry definitions into separate files, one for each industry, and then only "merge" when running nmlc. If not, no worries, then I will write a Python script to read in separate files and automatically generate one final *.nml
I didn't intend FIRS to be a general purpose framework for industry grf authors, but it has been forked to make 5 or 6 other grfs that I'm aware of.
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: Some questions on limits of industry NewGRF
historically, the cargo labels are a newer addition.ebla71 wrote: ↑15 Sep 2023 18:19 Personally, I'd consider it a bug if a building or other set refers to the cargo ID number instead of the cargo label, since the latter symbolic references are usually meant to make things more independent and easier to clearly assign - but that might be lack of insight or sloppyness of developers Or ID numbers even came before symbolic cargo labels?
in a game as old as this, you'll find lots of these "heritage" "features"
-
- Tycoon
- Posts: 1210
- Joined: 16 Oct 2018 08:31
- Location: Heart of the Highlands. Not Scottish. Czech.
Re: Some questions on limits of industry NewGRF
That's right, I forgot about that.
Passengers and mail are the only ones out of alphabetical order, perhaps for ease of access, in quite a few cases transporting them is the absolute start of the game unless more lucrative shipping routes can be created right away.
Re: Some questions on limits of industry NewGRF
Thank you very much for pointing this out - I'm pretty sure that was the example I had in mind.andythenorth wrote: ↑16 Sep 2023 07:12 FIRS packages cargos and industries as python modules. https://github.com/andythenorth/firs
Re: Some questions on limits of industry NewGRF
Re: Some questions on limits of industry NewGRF
Don't do that. Leave MAIL as 0x02, because aircraft do NOT carry MAIL in the mail compartment, they carry cargo ID 0x02, whatever it is. There may be other implications, if you change PASS and MAIL.
I use 00-PASS, 01-TOUR, 02-MAIL ...
Re: Some questions on limits of industry NewGRF
"aircraft do NOT carry MAIL in the mail compartment, they carry cargo ID 0x02, whatever it is"
Thank you very much - that's an extremely important hint that most people are not aware off, I guess.
Finally explains why it was reported somewhere that aircraft carry "strange" cargo. Also vaguely remember from one of my own games a plane fit for manganese or something like that.
Re: Some questions on limits of industry NewGRF
Well, if you are closely familiar with the inner mode of operation of nmlc, possibly yes.
If not - like me - one could consider the *.nml file as sequential information where - when read into a "classical" array or Python list data structure - order of appearance in the file does indeed matter.
But by further analyzing the *.nml files available to me, I have now learnt that indeed the IDs of the cargos and industries are assigned independent of order by
anditem(FEAT_CARGOS, mail, 2) {
property {
number: 2;
The only thing that still confuses me is why in the cargo definition, the ID number appears twice, once in the item() "instruction" and once as the number "variable"?!?item(FEAT_INDUSTRIES, Shopping_Centres, 106) {
Re: Some questions on limits of industry NewGRF
I actually found one instance where the order is not by alphabet but by industry ID as defined in
item(FEAT_INDUSTRIES, Shopping_Centres, 106)
and this is the graphical display of the industry chain.
In the first picture below the industry IDs are 20 for Sheep Farm, 21 for Cow Farm, and 22 for Arable Farm but for the second picture, I changed the industry ID for the cow farm to 107 which makes it appear last while in the "Fund new industry" window on the left, the alphabetical order is maintained.
Is this the intended behaviour?!?
- Attachments
-
- Industry Chain 1.png
- (239.05 KiB) Not downloaded yet
-
- Industry Chain 2.png
- (241.9 KiB) Not downloaded yet
Re: Some questions on limits of industry NewGRF
Just found another example where order is not by alphabet but appearance in code:
If there were alpahbetical ordering by either cargo name or cargo four-letter "code", AORE = bauxite should be first:cargo_types: [accept_cargo("BOOM"),produce_cargo("COAL",16),produce_cargo("CORE",12),produce_cargo("IORE",8),produce_cargo("ZORE",8),produce_cargo("AORE",8)];
- Attachments
-
- Industry Chain 3.png
- (365.53 KiB) Not downloaded yet
Re: Some questions on limits of industry NewGRF
The "number" property is an obsolete remnant of an older spec. Just set it to the same value as the ID number and don't worry about it.
By all means report it as a bug.Just found another example where order is not by alphabet but appearance in code
Who is online
Users browsing this forum: No registered users and 5 guests