Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Tue Oct 16, 2018 7:00 am

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue May 01, 2018 3:50 pm 
Offline
Engineer
Engineer

Joined: Wed Mar 14, 2018 3:05 pm
Posts: 12
Location: Germany
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?

_________________
Image


Top
   
PostPosted: Tue May 01, 2018 4:50 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Mar 31, 2007 2:23 pm
Posts: 4684
Location: Lost in Music
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.

_________________
FIRS Industry Replacement Set (Released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (Finished)
Squid Ate FISH (ships) (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, released)


Top
   
PostPosted: Tue May 01, 2018 4:59 pm 
Offline
Engineer
Engineer

Joined: Wed Mar 14, 2018 3:05 pm
Posts: 12
Location: Germany
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.


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++?
(Info: Im trying to make a Industry GRF, and want to use python for that, im not copying FIRS)

_________________
Image


Top
   
PostPosted: Tue May 01, 2018 5:22 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Mar 31, 2007 2:23 pm
Posts: 4684
Location: Lost in Music
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++?


'make' is GNU Make which consumes a makefile. https://www.gnu.org/software/make/

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+newgrf+templating

_________________
FIRS Industry Replacement Set (Released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (Finished)
Squid Ate FISH (ships) (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, released)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Psistorm and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.