Page 1 of 1

How to edit GRFs?

Posted: 10 Sep 2016 12:49
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.

Re: How to edit GRFs?

Posted: 10 Sep 2016 13:56
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?

Re: How to edit GRFs?

Posted: 10 Sep 2016 14:06
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 :)

Re: How to edit GRFs?

Posted: 10 Sep 2016 14:54
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).