Change code in the *.grf

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
vPhoeniXv
Engineer
Engineer
Posts: 4
Joined: 25 Apr 2016 19:49

Change code in the *.grf

Post by vPhoeniXv »

How I can change code in the *.grf (file NewGRF)?
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: Change code in the *.grf

Post by Sylf »

If you have the source code for it (inherited the code from someone, found some rogue code, or get it from its official source repositories such as github or this), then you just have to find a way to compile the code. How to compile it depends on how it was written - nfo format, m4nfo, nml etc.

If you only have access to the grf file itself, then things are much harder.
You can use GRF Codec to decode it. It will give you the source code in nfo format. It is not an easy code to read or edit, but it is possible to hack your way through it.

Further discussion is more appropriate in this forum.
vPhoeniXv
Engineer
Engineer
Posts: 4
Joined: 25 Apr 2016 19:49

Re: Change code in the *.grf

Post by vPhoeniXv »

Thanks
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4766
Joined: 09 Sep 2007 05:03
Location: home

Re: Change code in the *.grf

Post by Alberth »

If you make changes, please also change the GRF-ID and the name, so your changed version is really different from the "real" one. It avoids a lot of potential problems.

Also, most grfs are licensed with the requirement that you must publish the changes if you publish the newgrf (so others can build on your work in the future, like you can build on previous work). Please keep that in mind when giving your changed newgrf to someone else.
Being a retired OpenTTD developer does not mean I know what I am doing.
Transportman
Tycoon
Tycoon
Posts: 2792
Joined: 22 Feb 2011 18:34

Re: Change code in the *.grf

Post by Transportman »

Alberth wrote:If you make changes, please also change the GRF-ID and the name, so your changed version is really different from the "real" one. It avoids a lot of potential problems.

Also, most grfs are licensed with the requirement that you must publish the changes if you publish the newgrf (so others can build on your work in the future, like you can build on previous work). Please keep that in mind when giving your changed newgrf to someone else.
If it has such a license, the source is most of the times also available.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4766
Joined: 09 Sep 2007 05:03
Location: home

Re: Change code in the *.grf

Post by Alberth »

Transportman wrote:
Alberth wrote:If you make changes, please also change the GRF-ID and the name, so your changed version is really different from the "real" one. It avoids a lot of potential problems.

Also, most grfs are licensed with the requirement that you must publish the changes if you publish the newgrf (so others can build on your work in the future, like you can build on previous work). Please keep that in mind when giving your changed newgrf to someone else.
If it has such a license, the source is most of the times also available.
I was talking about the modified grf. Eg GPL license requires that you publish your changes when you publish (or give away) your modified newgrf.
Being a retired OpenTTD developer does not mean I know what I am doing.
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 10 guests