Hi,
I noticed in the source code of FIRS, that 91% of the newgrf is .py and 3% .js.
So how is this GRF getting compiled?
Which Compiler gets used to compile .py to .grf?
Moderator: OpenTTD Developers
- andythenorth
- Tycoon
- Posts: 5658
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Which Compiler gets used to compile .py to .grf?
TL;DR
python -> generated nml code -> nmlc compiler -> grf
More detail:
make -> python 'render_nml' entry point -> industry and cargo classes -> chameleon templates -> nmlc files -> combined nmlc file
make -> python 'render_lang' entry point -> lang files
make -> nmlc file + lang files -> nmlc compiler -> grf
make -> python 'render_docs' entry point -> chameleon templates -> html -> docs dir; filesystem operations -> js, css, img -> docs dir
grf + docs -> tar for distribution
There's also a python graphics pipeline, but it's mostly unused in FIRS.
python -> generated nml code -> nmlc compiler -> grf
More detail:
make -> python 'render_nml' entry point -> industry and cargo classes -> chameleon templates -> nmlc files -> combined nmlc file
make -> python 'render_lang' entry point -> lang files
make -> nmlc file + lang files -> nmlc compiler -> grf
make -> python 'render_docs' entry point -> chameleon templates -> html -> docs dir; filesystem operations -> js, css, img -> docs dir
grf + docs -> tar for distribution
There's also a python graphics pipeline, but it's mostly unused in FIRS.
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: Which Compiler gets used to compile .py to .grf?
Thanks, i only dont really understand were I can perform the action "make". Is there a special program for python or is it possible in for example Notepad++?andythenorth wrote: python -> generated nml code -> nmlc compiler -> grf
More detail:
make -> python 'render_nml' entry point -> industry and cargo classes -> chameleon templates -> nmlc files -> combined nmlc file
make -> python 'render_lang' entry point -> lang files
make -> nmlc file + lang files -> nmlc compiler -> grf
make -> python 'render_docs' entry point -> chameleon templates -> html -> docs dir; filesystem operations -> js, css, img -> docs dir
grf + docs -> tar for distribution
There's also a python graphics pipeline, but it's mostly unused in FIRS.
(Info: Im trying to make a Industry GRF, and want to use python for that, im not copying FIRS)
- andythenorth
- Tycoon
- Posts: 5658
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Which Compiler gets used to compile .py to .grf?
'make' is GNU Make which consumes a makefile. https://www.gnu.org/software/make/PandaCode wrote:Thanks, i only dont really understand were I can perform the action "make". Is there a special program for python or is it possible in for example Notepad++?
The makefile specifies rules for triggering python scripts, also nmlc, and other scripts like shell (which creates the tar and zip archives).
Make is used for convenience, but you don't need it.
The absolute simplest way to make the grf is to just write nml code in a program like Notepad++ or any text editor. This is then compiled with the nmlc compiler from https://newgrf-specs.tt-wiki.net/wiki/NML:Main
Adding python templating is convenient for making the nml easier to work with when programming. I wrote a guide with a simplified approach
viewtopic.php?f=68&t=58390&hilit=python ... templating
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)
Who is online
Users browsing this forum: No registered users and 51 guests