How to edit GRFs?

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

Post Reply
User avatar
DerekCZ
Engineer
Engineer
Posts: 105
Joined: 29 Jul 2014 18:08
Location: Czech Republic

How to edit GRFs?

Post by DerekCZ »

Okay, so; I red many tutorials and stuff, then I gave up, then I red them again and I still don!t get the compiling part of NewGRFs. Maybe I am just dumb af, but everytime I try to compile GRF that I downloaded and edited, nothing happend, just... nothing. Only thing I want to do is to edit some prices in one aircraft grf to match prices of another one.
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: How to edit GRFs?

Post by Transportman »

Can you describe more precise which steps you have taken? Which NewGRF are you editing, where did you download the source of that NewGRF, which program(s) are you using to compile the NewGRF? At which step does "nothing" happen?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: How to edit GRFs?

Post by Alberth »

Let's take a few steps back, and explain "compile" first.

Suppose you want to have dinner. You go to the super market, and buy lots of tasty ingredients. Raw meat, uncut vegetables, some uncooked potatoes, or unboiled rice, etc.
Do you eat all those ingredients as you bought them from the super market?

No, you don't (at least Ii hope so :) ).
There is a process called "cooking" that transforms tasty ingredients to a meal known as "dinner".


Compiling is a similar process. Computers are bad at reading text, and good at reading numbers. We are good at reading text, and bad at reading numbers. To bridge that gap from humans to computers, there is a process called "compiling". It transforms the text describing the GRF contents to a form known as NewGRF, which the computer (game) understands.

Like cooking, compiling is a one-way transformation. You can't get back to the original ingredients from the cooked meal. You can't get back from the NewGRF to the original text. The latter is not entirely true, there is a process called "decompiling" that does produce text from the NewGRF. Technically, it is text, but it's not very readable, you need a lot of study to understand what it says.


Now, back to your problem. What does "download a grf" means exactly? What are you downloading? The "NewGRF" file (ie the transformed result aimed at use by a computer), or its source code (the text describing the grf, aimed at editing by humans)?

In cases like this, it helps if you show us every step of the way, in such a detailed way, that we can replicate the exact same steps, hopefully getting the exact same result that you get. At that level of detail, we can literally try to do the same thing you did, and then find where it doesn't work, or where you forget a small but crucial detail.
This goes as far as what file you downloaded, which tool you used to unpack it, the command line parameters that you used, the file that you edited, the exact line you changed (with "before" and "after", so we can see the exact change), the command to compile, the response of the system, and since you say "nothing happens", probably also an indication of what you expect to happen at some point, but doesn't.

Edit: Ninja-ed by Transportman about the last part :)
Being a retired OpenTTD developer does not mean I know what I am doing.
luxtram
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 10 May 2016 19:09

Re: How to edit GRFs?

Post by luxtram »

Also feel free to ask more questions if anything from above replies were not understandable.

Edit: just trying to be proactive here and making a guess:
SPolygon wrote:Maybe I am just dumb af, but
Do not hold your hopes up. Everyone has such moments. ;)
SPolygon wrote:everytime I try to compile GRF that I downloaded and edited, nothing happend, just... nothing. Only thing I want to do is to edit some prices in one aircraft grf to match prices of another one.
Assuming that nothing happened means prices did not change, and you are compiling from downloaded the source of some newgrf:

if the compiling finished then did you copy the resulting grf file into the place game is expecting it (under Linux it is in the ~/.openttd/newgrf folder, I have to check the Windows later on if somebody else does not jump in).
California City Sets viewtopic.php?t=76786
1000 building set viewtopic.php?t=75250
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Bing [Bot] and 8 guests