Have I missed something?
Moderator: Graphics Moderators
Have I missed something?
Hello. The only help and advice how to edit grf files was the GRFcodec dos app download. Okay, I have extracted one existing grf file to see whats hidden inside. I have obtained one very nice image messed up with textures (which killed my hope to edit GRF in msPaint and Irfan) and one .nfo file messed up with names and values.
Should I edit this in PSpad? I don't think so.
So, where is the app to get images separated and values human readable? I don't want too much from you, anyway.
Should I edit this in PSpad? I don't think so.
So, where is the app to get images separated and values human readable? I don't want too much from you, anyway.
Hacking is like sex - you get in, you get out. And then you hope that you didn't leave inside anything to track you.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Have I missed something?
You did not miss anything except maybe the documentation on the NFO specs.
NewGRFs are a piece of software, not just a fancy collection of stats for the single vehicles; thus what you got is de-compiled code which is not very pretty. NFO files can be edited by any plain text editor, png or pcx files modified by any graphics programme which understands the concept of palettes.
NewGRFs are a piece of software, not just a fancy collection of stats for the single vehicles; thus what you got is de-compiled code which is not very pretty. NFO files can be edited by any plain text editor, png or pcx files modified by any graphics programme which understands the concept of palettes.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
-
- Tycoon
- Posts: 1660
- Joined: 16 Dec 2007 22:24
- Location: Idaho, USA
Re: Have I missed something?
Attempting to make sense of a decompiled .grf is, unfortunately, not very easy IMO. It is entirely within the realm of possibility, however. The most helpful resource for that endeavor is the NewGRF specs wiki.
Creating a new grf from scratch, however, is easier thanks to NML. If the .grf you want to look at/edit is written in NML and hosted on, say, the OTTD Devzone, then things are even easier. Even if it is written in NFO, I reckon the authors' comments on their sources are much easier to deal with than raw decompiled code.
Creating a new grf from scratch, however, is easier thanks to NML. If the .grf you want to look at/edit is written in NML and hosted on, say, the OTTD Devzone, then things are even easier. Even if it is written in NFO, I reckon the authors' comments on their sources are much easier to deal with than raw decompiled code.
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects
"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
Re: Have I missed something?
You've missed how to write a descriptive thread topic, for one thing.
If you want to create your own grfs, starting from a decompiled grf is not a good idea, because you'll just be faced with an uncommented block of code. It's a much better idea to start from scratch and from example code provided by experienced coders. If what you want to do is alter something in an existing grf, that's quite possible, but very hard unless you're an experienced grf author and know what you're looking for in that block of code.
I don't know what "messed up with textures" means, but I'm guessing you decompiled with the wrong palette.

If you want to create your own grfs, starting from a decompiled grf is not a good idea, because you'll just be faced with an uncommented block of code. It's a much better idea to start from scratch and from example code provided by experienced coders. If what you want to do is alter something in an existing grf, that's quite possible, but very hard unless you're an experienced grf author and know what you're looking for in that block of code.
I don't know what "messed up with textures" means, but I'm guessing you decompiled with the wrong palette.
Re: Have I missed something?
I suspect he was probably missing a "-p 2" somewhere on the end of his command line.
Re: Have I missed something?
This is the post I have attempted to send yesterday, and which isn't so actual today.
So i have decompiled (decoded or what ever) the vactrain.grf, got the mentioned two files - image, and some plain-text crap.
What I can see:
Seems like multi language data. But I can't believe someone has written it like this...
I can only guess that the offset +4 (third number twin) represents language name, coz its different within languages. Where the author gor the correct value for the corresponding language?
This:
seems to represent pixel coordinates of image parts. I am farely sure this was generated with decoder and cold be genereted as varions files instead.
A have recoloured tunell (or whatever it was) to yellow, and did a pretty more changes, but it did'nt have any effect. Even if I hac deleted the original vactrain tar file, OpenTTD worked with vacum tube like nothing happened.
Where the data are really stored...?
And now the todays post:
I have tryed to use -p 2 parameter, but the result was same. I have uploaded the image with sprites.
So i have decompiled (decoded or what ever) the vactrain.grf, got the mentioned two files - image, and some plain-text crap.
What I can see:
Code: Select all
209 * 34 04 00 7F 01 FF 75 00 "VACT-0002 \"Airline Killer\"" 00
210 * 35 04 00 02 01 FF 75 00 "VACT-0002 \"Flugzeug-Killer\"" 00
I can only guess that the offset +4 (third number twin) represents language name, coz its different within languages. Where the author gor the correct value for the corresponding language?
This:
Code: Select all
147 * 6 01 00 02 FF 08 00
148 sprites/vactrain.pcx 66 552 01 26 10 -5 -12
149 sprites/vactrain.pcx 82 552 01 17 22 -14 -9
150 sprites/vactrain.pcx 114 552 01 12 32 -16 -8
151 sprites/vactrain.pcx 162 552 01 17 22 -6 -9
152 sprites/vactrain.pcx 194 552 01 26 10 -5 -12
153 sprites/vactrain.pcx 210 552 01 17 22 -14 -9
A have recoloured tunell (or whatever it was) to yellow, and did a pretty more changes, but it did'nt have any effect. Even if I hac deleted the original vactrain tar file, OpenTTD worked with vacum tube like nothing happened.
Where the data are really stored...?
And now the todays post:
I have tryed to use -p 2 parameter, but the result was same. I have uploaded the image with sprites.
- Attachments
-
- The sprites.
- vactrain.jpg (48.2 KiB) Viewed 3515 times
Hacking is like sex - you get in, you get out. And then you hope that you didn't leave inside anything to track you.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Have I missed something?
You should probably visit the vactrain topic, look where the author posted the source code and read that...
Shouldn't that be the first thing to do? Look for the proper source than trying to de-compile anything?
Shouldn't that be the first thing to do? Look for the proper source than trying to de-compile anything?
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Have I missed something?
Someone has written it exactly like that. Maybe with some added comments, but writing it any other way will just plain not work (or use NML instead, but that will ultimately convert it to exactly that). What each line means is explained here: http://newgrf-specs.tt-wiki.net/wiki/Action4Darker wrote:But I can't believe someone has written it like this...
Correct, and explained here: http://newgrf-specs.tt-wiki.net/wiki/RealSpritesDarker wrote:...seems to represent pixel coordinates of image parts.
The original source could very well have used multiple image files, but since this information is not stored in the grf (there's no need for the game to know that information), there's also no way for grfcodec to output the graphics into multiple files. How should it know what graphic to put in what file? Therefore it gives everything in one file and therefore it's far more useful to obtain the original source instead (but that may not always be available).
As for why your changes did not work:
You did encode the changes into a new grf file? You checked that the timestamp of the grf file indeed indicated it being a new version? And you made sure that the grf file is in one of OpenTTD's search paths?
I also noticed that the image you uploaded is a jpg image. Is this the one you made changes to? If so, you must know that grfcodec doesn't understand jpg images and that the NFO source still references the decoded pcx file. So you need to save the changes to this pcx file, maintaining it's palette, for the changes to be actually encoded back into a grf file.
Re: Have I missed something?
planetmaker:
I haven't a clue that theres some "vactrain topic", so I'll search for it.
FooBar:
I didn't obtain any errors while encoding file back.
I didn't obtain eny errors when decoding it again.
I haven't a clue that theres some "vactrain topic", so I'll search for it.
FooBar:
Once it could create image from sprites (and gave them numbers), it cold export each sprite in diferent file (and give it a number as it did for sprites in large PCX) and this can be, thearotically, aditionall seting.FooBar wrote:The original source could very well have used multiple image files [...]
What else you expected me to do?FooBar wrote:You did encode the changes into a new grf file?
I did it now. The tar files timestamp is very sure later then the time I've downloaded the original graphic file.FooBar wrote:You checked that the timestamp of the grf file indeed indicated it being a new version?
And this is what?FooBar wrote:And you made sure that the grf file is in one of OpenTTD's search paths?
I've resized the original PCX to faster upload.FooBar wrote:I also noticed that the image you uploaded is a jpg image.
I didn't obtain any errors while encoding file back.
I didn't obtain eny errors when decoding it again.
Hacking is like sex - you get in, you get out. And then you hope that you didn't leave inside anything to track you.
Re: Have I missed something?
it'd be more useful to create one file per spritegroup, not per sprite, though.Darker wrote:Once it could create image from sprites (and gave them numbers), it cold export each sprite in diferent file (and give it a number as it did for sprites in large PCX) and this can be, thearotically, aditionall seting.FooBar wrote:The original source could very well have used multiple image files [...]
Re: Have I missed something?
I didn't know sprites are grouped.
Hacking is like sex - you get in, you get out. And then you hope that you didn't leave inside anything to track you.
Re: Have I missed something?
You don't really need to tar a grf. The timestamp of a tar doesn't say much really, as it could very well contain old files.Darker wrote:tar
These are the directories where OpenTTD looks for grf files. The OpenTTD readme will tell you which these are for your operating system.Darker wrote:And this is what? [search paths]
I expect nothing. I'm just troubleshooting hereDarker wrote:What else you expected me to do?

Ok, just checking to make sure you didn't save your edits to jpg.Darker wrote:I've resized the original PCX to faster upload.
Re: Have I missed something?
I just made it to look like i have copyed it. (from C:\Documents and Settings\user\Dokumenty\OpenTTD\content_download)FooBar wrote:You don't really need to tar a grf.
Ok then, but there is no from the downloaded GRFs... I want to replace Vac Train which is already instaled.FooBar wrote:These are the directories where OpenTTD looks for grf files.
Now I'm gonna try to put the vactrain.grf into D:\hry\ttd\data and see if something happens.
EDIT:I've put it there and, thank you, it works. Now I only wondwr, why red pixels blink (i've put there few to see that it works)
EDIT2:Is there a way to update graphic without restarting game?
Hacking is like sex - you get in, you get out. And then you hope that you didn't leave inside anything to track you.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Have I missed something?
use reload_newgrfs in the console
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Have I missed something?
Most likely you have used the red that is part of the "red cycle". These are intended for the railway crossing lights, but blink in other places as well. See http://newgrf-specs.tt-wiki.net/wiki/Pa ... s#Palettes for details. There are more special colours in the palette that you normally shouldn't use.Darker wrote:Now I only wondwr, why red pixels blink
Re: Have I missed something?
Unfortunally it returned this:planetmaker wrote:use reload_newgrfs in the console
Shouldn't I write something before the command?OTTD console wrote:ERROR: command not found
FooBar:
Yes seems you are absolutelly right. I guessed something like this, thank you for the link. And is it OK when I create tracks which blinks? (what about CPU...?)
And why the company color didn't work for tracks? (I mean: Is it possible to differ tracks with colors some other way?)
And, if you use some good freeware editor (better than Irfan or MSpaint) please recomend it to me

Hacking is like sex - you get in, you get out. And then you hope that you didn't leave inside anything to track you.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Have I missed something?
reload_newgrfs is only available when the newgrf developer tools are turned on.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Have I missed something?
planetmaker:
Thank you, works perfectly.
FooBar:
Thank you for GRF specs link, helped me to translate vehicle name.
One thing is confusing me a bit. When the train has 22 306 horse powers the file must contain something like 5722, 2257, 00002257 or what ever. I failed to find 22 near 57 anyway. And I am not sure, if cost I see can help me to finde the train, even if I disabled inflaction.
Second thing: is there any trick to renumerate all lines once I add/remove one (i mean editor) or I must have app for this. (doesn't the conventer check for correnc numbers itself?)
Thank you, works perfectly.
FooBar:
Thank you for GRF specs link, helped me to translate vehicle name.
One thing is confusing me a bit. When the train has 22 306 horse powers the file must contain something like 5722, 2257, 00002257 or what ever. I failed to find 22 near 57 anyway. And I am not sure, if cost I see can help me to finde the train, even if I disabled inflaction.
Second thing: is there any trick to renumerate all lines once I add/remove one (i mean editor) or I must have app for this. (doesn't the conventer check for correnc numbers itself?)
Last edited by Darker on 18 Aug 2011 15:52, edited 1 time in total.
Hacking is like sex - you get in, you get out. And then you hope that you didn't leave inside anything to track you.
Re: Have I missed something?
If you like blinking tracks, it's fine to create them. Don't worry about CPU, unless you have a really old computer. For slow computers the game has an option to disable "full detail", which also disables these blinking things.Darker wrote:And is it OK when I create tracks which blinks? (what about CPU...?)
And why the company color didn't work for tracks? (I mean: Is it possible to differ tracks with colors some other way?)
And, if you use some good freeware editor (better than Irfan or MSpaint) please recomend it to me
Tracks don't support company colours, only depots (and stations, fences) do. If you really need it, you can always request it as a feature.
Myself I use Photoshop for drawing sprites. It's massive overkill, but I'm used to it and it has all the tools you could want. It's also massively expensive.
A free alternative is GIMP, probably also massive overkill, but at least it can handle palettes properly.
Who is online
Users browsing this forum: No registered users and 18 guests