Editing FIRS to make a North American Industry Set

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Editing FIRS to make a North American Industry Set

Post by NekoMaster »

So while making a version of my USA 4K scenario using FIRS, I thought maybe I should try making my own version of FIRS to make a North American Industry Set that will include industries and cargos from North America.

I know a couple of people have made their own industry GRF's using FIRS, so if anyone has any experience with making your own industry GRF using FIRS source code I would appreciate if you could help me make my own.

In the end I would like to have something that I can upload so that others can download the GRF seperate from FIRS (and so it'll be available for download with my USA 4K scenario when I make a FIRS/NAIS version)
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Editing FIRS to make a North American Industry Set

Post by wallyweb »

I haven't done any Industry set work so can't be much help here, but have you looked into GarryG's Australian Industry stuff?

Something I miss when using FIRS ... Gold mines ... Lot's of those here in Canada. Suggested chain:

(mining supplies) Gold Mine (gold ore)
(gold ore) Metal Refiner (gold ingots)
(gold ingots) Mint (gold coins)
(gold ingots) Electronics Industry (goods)
(gold coins) Bank
(gold coins) Coin Shop
User avatar
jimbob
Engineer
Engineer
Posts: 87
Joined: 24 Nov 2014 21:13
Location: At a desk
Contact:

Re: Editing FIRS to make a North American Industry Set

Post by jimbob »

Good luck firs is great to tweak. Make sure you do add in graphviz and the make file will generate the docs with the cargo flow graphs. Very useful for quick debugging! :)

I do want to make another variant of FERNZ with fewer industries, that's the hard part
Image
Real life transport planner
My projects:Link to my UK Scenario|Scenario Builder GS
Do check out my 3D unity transport game: transporter
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Editing FIRS to make a North American Industry Set

Post by andythenorth »

jimbob wrote:I do want to make another variant of FERNZ with fewer industries, that's the hard part
Reducing is harder than adding :)

The 'basic' economies take the same time to make as bigger ones, for less total stuff :P

Neko: hopefully someone will explain how to add a new economy in src/economies + the lang strings for it

After that it's easy to turn existing cargos on or off, and industries.

Adding new cargos and industries is a whole level up mind ;)
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Editing FIRS to make a North American Industry Set

Post by NekoMaster »

For now I mostly wanted to use the stuff thats already available in FIRS to make my North american Industry set, and I dont really want to make crazy long industry chains.

If I where to bring back the gold or valueables chain, it'd simply be Gold to the Bank (or maybe a Mint or Gold Reserve that can be built anywhere)

I also wanted to Bring copper ore and copper into the north american economy and perhaps have a Factory where Steel, Copper, and Manufacturing Supplies can come together to make goods.

I guess if anything I probably should hit up GarryG and see if they can help me out with making my own economy (which may also involve changing up what some of the industries accept and produce)
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Editing FIRS to make a North American Industry Set

Post by andythenorth »

NekoMaster wrote:I guess if anything I probably should hit up GarryG and see if they can help me out with making my own economy (which may also involve changing up what some of the industries accept and produce)
Garry edits the raw nml for FIRS as far as I know. That's fine, but loses all the benefits of the python compile, and it's a *lot* more editing in the long run.

It's pretty easy to see where the cargos are defined for an economy:
https://dev.openttdcoop.org/projects/fi ... _arctic.py

Cargos have string IDs. The ID should be the same as the filenames in src/cargos.
The ID itself is defined in each cargo file https://dev.openttdcoop.org/projects/fi ... os/acid.py
User avatar
jimbob
Engineer
Engineer
Posts: 87
Joined: 24 Nov 2014 21:13
Location: At a desk
Contact:

Re: Editing FIRS to make a North American Industry Set

Post by jimbob »

I've yet to try it but on the technical discussion forum I was given a snippet of nml which should be able to restore the bank to FIRS.

Could have a bank and gold reserve, there are far more industry slots than cargo slots. (Until the extra cargos patches get merged to trunk)
Image
Real life transport planner
My projects:Link to my UK Scenario|Scenario Builder GS
Do check out my 3D unity transport game: transporter
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Editing FIRS to make a North American Industry Set

Post by NekoMaster »

So I got stuff to compile, with my own GRF Name and GRF ID for now.

Everything looks fine, no errors but no industries appear even though I just reused the FIRS Extreme economy and renamed it "North America"

I tried starting a game in 1950 and 2018 with a low amount of industries but nothing spawns, and nothing appears in the Fund/Place Industry menu as if no Industries are coded.
Aside from disabling the other econemies and the switch in the industry files for alternate stuff bsaed on the economy setting, everything should still be setup to work with FIRS extreme unless those switches needed to be there (and not commented out)

EDIT

Never Mind I got things back by putting the switch/line of code for "Alternate Industries" for my North American economy Back.

Now I just have to figure out how to get the exact industries and cargos I want.

I wonder how one can enable the Bauxite Mine and Aluminium plant instead of a bulk terminal for Bauxite (or maybe have both?)

Another thing I'd like to have is the copper chain since copper is a thing thats mined in North america in various places of the USA and Canada
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Editing FIRS to make a North American Industry Set

Post by andythenorth »

NekoMaster wrote:I wonder how one can enable the Bauxite Mine and Aluminium plant instead of a bulk terminal for Bauxite (or maybe have both?)
See lines 16, 17 here https://dev.openttdcoop.org/projects/fi ... t_plant.py
You set the ID for the economy, and 'True'.
If you don't want the industry in an economy, you don't need to set 'False', you just drop the whole line.
Another thing I'd like to have is the copper chain since copper is a thing thats mined in North america in various places of the USA and Canada
Copper is in Tropic Basic and other economies. Just turn on the industries and industries :)

You'll need chemicals or acid too for copper refinery.
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Editing FIRS to make a North American Industry Set

Post by NekoMaster »

andythenorth wrote:
NekoMaster wrote:I wonder how one can enable the Bauxite Mine and Aluminium plant instead of a bulk terminal for Bauxite (or maybe have both?)
See lines 16, 17 here https://dev.openttdcoop.org/projects/fi ... t_plant.py
You set the ID for the economy, and 'True'.
If you don't want the industry in an economy, you don't need to set 'False', you just drop the whole line.
Another thing I'd like to have is the copper chain since copper is a thing thats mined in North america in various places of the USA and Canada
Copper is in Tropic Basic and other economies. Just turn on the industries and industries :)

You'll need chemicals or acid too for copper refinery.
I at least managed to get the copper chain in the game (producing metal to make things simple)

I've disabled Chemicals/Acid's for now, though considering the Steel mill requires Coal and Steel, I might make chemicals a requirement/accepted cargo as well as scrap metal.

Though I'm having a bit of an issue right now. I tried repurposing the Phosphate mine as a open pit Bauxite Mine, and while the code works, the compiler keeps saying the graphics are invalid/it couldn't open it.
It works fine when I use the original graphics you drew, but when I put it through gimp to turn the mine red and remove the water and save it, despite being a Indexed 8bpp image using the OpenTTD DOS pallet it still complains that it can't open phosphate_mine_1.png

I dunno whats going on there, because I did get a modified Nitrates Mine to work but then I switched to using the Phosphate mine since i wanted an open pit look.

Also I noticed the graphics you made are 16.2KB for the phosphate_mine_1.png, but when I save it before and after editing as a 8bpp image, gimp makes the PNG 22.0 KB large.

EDIT

This is what it says exactly despite the mentioned sprite sheet being an 8 bit image using the OpenTTD DOS pallet

Code: Select all

nmlc ERROR: Image file "src/graphics/industries/phosphate_mine_1_snow.png": cannot identify image file '/mnt/d/USERS/MATTHEW/Dropbox/~ OpenTTD Projects ~/[GRF] North American Industry Set/src/graphics/industries/phosphate_mine_1_snow.png'
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Editing FIRS to make a North American Industry Set

Post by NekoMaster »

This is the sprite thats misbehaving.

Though I realize now looking on google for Bauxite Mines in North America that we dont have any, at least none that are operating now or in the past. North America imports our Bauxite from overseas.

Though that brings up another question, how do I enable Ports, Bulk Terminals and Fishing Harbours to be placed on River/Lake tiles? My USA 4K Scenario has the great lakes as they should be, above sea level, which means the great lakes are made of river tiles. I noticed you can't place any marine industries on river tiles (even if you place the port on a hill/bank next to the river tile).

Is there a way to enable placing them on lakes made of river tiles?
Attachments
phosphate_mine_1.png
phosphate_mine_1.png (22.04 KiB) Viewed 544 times
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
PNDA_
Engineer
Engineer
Posts: 62
Joined: 18 Jul 2018 17:26
Location: Germany

Re: Editing FIRS to make a North American Industry Set

Post by PNDA_ »

Hey,

I had that issue some time ago aswell.
I couldn't fix it, but when copy & pasting a .png which works, and pasting the contents of the misbehaving one into the new one, and use the new one in your code, it should work again.
It could be the palette, but i think that should be an easy fix for now :D
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Editing FIRS to make a North American Industry Set

Post by NekoMaster »

Just to be safe, what is the Max number of Cargos and Industries allowed in Vanilla OpenTTD (bar any updates int he future that will add support for more cargos/industries)

From what I remember theres a max of 32 Cargos and 64 Industries in Game
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
Captain Rand
Traffic Manager
Traffic Manager
Posts: 192
Joined: 28 Jan 2012 07:35

Re: Editing FIRS to make a North American Industry Set

Post by Captain Rand »

Maximum of 240 industries, with a limit of 128 per GRF.
Cargo limit is due to go up very soon, if it hasn't already done so.
32 cargos, going up to 64.

Pete.
There's nothing like a deadline to hone the concentration.

Good manners cost nothing, but earn respect.

" 'Impossible' is not in our vocabulary." Jack Chrichton, Farscape
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Editing FIRS to make a North American Industry Set

Post by NekoMaster »

So I'm trying to add my first industry into the game and already the compiler hates it.

I have no idea what its complaining about or how to fix it.

Code: Select all

.
[RENDER GRAPHICS] (not currently used)
[RENDER DOCS] render docs
Traceback (most recent call last):
  File "src/render_docs.py", line 48, in <module>
    import firs
  File "/mnt/d/USERS/MATTHEW/Dropbox/~ OpenTTD Projects ~/[GRF] North American Industry Set/src/firs.py", line 48, in <module>
    for cargo_label, ratio in industry.get_prod_cargo_types(economy):
AttributeError: 'int' object has no attribute 'get_prod_cargo_types'
Makefile:78: recipe for target 'docs' failed
make: *** [docs] Error 1
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Editing FIRS to make a North American Industry Set

Post by NekoMaster »

andythenorth wrote:Paste your new code here, or in https://paste.openttdcoop.org/
here you go

https://paste.openttdcoop.org/pzy0u3gud
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Editing FIRS to make a North American Industry Set

Post by andythenorth »

It's not the industry file. I've tested it, with the economy switched back to EXTREME, and that compiles.

While we're there though
- you don't need to declare ENSP is accepted, FIRS will add that for you for primary extractive industries
- watch your spaces, python will barf on you

So
- what python version do you have? ('python --version' in a shell tells you)
- how did you configure the new economy? (Paste that maybe)
- do you have any other changes anywhere?
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Editing FIRS to make a North American Industry Set

Post by NekoMaster »

andythenorth wrote:It's not the industry file. I've tested it, with the economy switched back to EXTREME, and that compiles.

While we're there though
- you don't need to declare ENSP is accepted, FIRS will add that for you for primary extractive industries
- watch your spaces, python will barf on you

So
- what python version do you have? ('python --version' in a shell tells you)
- how did you configure the new economy? (Paste that maybe)
- do you have any other changes anywhere?
I dunno how thats not the industry file as when I try to add that to the ___init___.py file and have it in my "industry" folder the compiler throws me that error.

Also, I'm using Python 3.5.2, if it needs to be updated I dont know how I would do that (unless theres a simple linux command for that like sudo apt get update or something like that)

As for how I configured the economy I removed everything from extreme, changed the name of it and the files related to it to North_America and added the cargos one by one that I wanted, which involved making some new ones or renaming stuff (though I tried to stick with cargo labels from the newgrf-specs wiki)

Before i added the pyrite_mine I tried an aluminium plant and that worked, though now when I try to add anything I get that error. I haven't changed anything with the aluminium plant or the firs.py file so I dunno why its freaking out.

Heres a link to my project folder on DropBox : https://www.dropbox.com/sh/jodxklljlomj ... e9ola?dl=0
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 30 guests