GRF file no longer works with recent OpenTTD releases.

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
AndyLandy
Engineer
Engineer
Posts: 30
Joined: 10 Sep 2008 20:09

GRF file no longer works with recent OpenTTD releases.

Post by AndyLandy »

Hi guys, I'm hoping someone can give me some advice on debugging a GRF file I have.

A few years ago, I knocked up some pretty rudimentary and basic GRF files for use on OpenTTD 0.7. I did a train set and an aircraft set. Nothing overly clever, just some vehicles with properties. Although they're not quite as game-balanced as I'd hoped, there were no technical issues--they worked great.

Times changed and I stopped playing OpenTTD so much, but a few years later, I fancied playing again. Dug up my GRFs, blew off the dust and dropped them into the Data folder of OpenTTD 1.2.2 (and now 1.2.3). Result: The trains GRF still works just as good as it always did. The planes GRF does nothing. As far as OpenTTD is concerned, there are no aircraft available all game, you can't even build airports with the GRF loaded.

So, it's been a very long time since I wrote these and I remember very little about writing NFO files. So, I'm hoping that someone smart on here might be able to give me some pointers as to how to go about how I'd fix my GRF, or even what debugging tools might exist to point me on the right track.

The only 'clever' things I did with the GRF were to change the base running-cost multiplier and add some text labels to state whether aircraft are small or large ones.

The most likely culprits are therefore these lines

Code: Select all

    2 * 7        00 08 01 01 2D 08 0B  // Crank up aircraft running-cost multiplier by 8.
                                 
    3 * 80   04 03 81 03  00 D0  98 "Aircraft Type: " 8A "Helicopter" 00  // D0 00
                                 98 "Aircraft Type: " 8A "Small" 00       // D0 01  
                                 98 "Aircraft Type: " 8A "Large" 00       // D0 02  
Thanks in advance, any advice greatly appreciated!
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: GRF file no longer works with recent OpenTTD releases.

Post by planetmaker »

Judging what a NewGRF does, how it interacts with other NewGRFs by a few lines cut from their source code is not really something which usually will prove very fruitful but rather resembles poking with a long stick in a murky pool in the hope to find the one ring.

Thus: provide the NewGRFs, possibly their sources and possibly also provide a savegame which shows your issue.

Unless the NewGRF does not conform to the NewGRF specs, it will continue to work. Earlier OpenTTD versions were much more relaxed with tolerating bugs in NewGRFs - which could lead to all kind of strange things, up to crashes and hard-to-track desyncs in multiplayer.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: GRF file no longer works with recent OpenTTD releases.

Post by Rubidium »

I reckon the GRF version is invalid. This was previously ignored, but since 1.1.0 it has become more strict about the validity of the GRF version.
AndyLandy
Engineer
Engineer
Posts: 30
Joined: 10 Sep 2008 20:09

Re: GRF file no longer works with recent OpenTTD releases.

Post by AndyLandy »

planetmaker wrote:Judging what a NewGRF does, how it interacts with other NewGRFs by a few lines cut from their source code is not really something which usually will prove very fruitful but rather resembles poking with a long stick in a murky pool in the hope to find the one ring.

Thus: provide the NewGRFs, possibly their sources and possibly also provide a savegame which shows your issue.

Unless the NewGRF does not conform to the NewGRF specs, it will continue to work. Earlier OpenTTD versions were much more relaxed with tolerating bugs in NewGRFs - which could lead to all kind of strange things, up to crashes and hard-to-track desyncs in multiplayer.
I'm reluctant to post the GRF publically, but I guess I'm happy to share it with someone who doesn't mind having a look at it. It doesn't work, even as the sole GRF and the effect is evident right from the start of a new game.
Rubidium wrote:I reckon the GRF version is invalid. This was previously ignored, but since 1.1.0 it has become more strict about the validity of the GRF version.
GRF version? Is that line near the top that contains things like the GRF description? That actually shows up correctly in the OpenTTD GRF selection window.

Thanks for your answers so far, it's appreciated. :)
AndyLandy
Engineer
Engineer
Posts: 30
Joined: 10 Sep 2008 20:09

Re: GRF file no longer works with recent OpenTTD releases.

Post by AndyLandy »

OK, so I've generated a basic NFO file which exhibits this problem, which I'm including in this reply. I'm sure I'm doing something obviously dumb, but I'm just not seeing it. I can provide this as an actual GRF if that would help.

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 11 00 00 00
    1 * 42	 08 06 41 50 4C 30 // GRFID
              "Simple aeroplane test" 00
              "A simple test" 00

    2 * 7	 00 08 01 01 2D 08 0B  // Crank up aircraft running-cost multiplier by 8.

    3 * 80	 04 03 81 03  00 D0  98 "Aircraft Type: " 8A "Helicopter" 00  // D0 00
         	                     98 "Aircraft Type: " 8A "Small" 00       // D0 01
         	                     98 "Aircraft Type: " 8A "Large" 00       // D0 02

    4 * 4	 01 03 01 08
    5 sprites/OSP_v1.pcx 242 104 09 20 39 -17 -7
    6 sprites/OSP_v1.pcx 290 104 09 16 35 -14 -5
    7 sprites/OSP_v1.pcx 338 104 09 22 31 -14 -9
    8 sprites/OSP_v1.pcx 386 104 09 22 36 -19 -10
    9 sprites/OSP_v1.pcx 434 104 09 26 39 -17 -14
   10 sprites/OSP_v1.pcx 482 104 09 22 33 -11 -11
   11 sprites/OSP_v1.pcx 530 104 01 22 31 -9 -9
   12 sprites/OSP_v1.pcx 578 104 09 16 34 -13 -5
   13 * 9	 02 03 00 01 01 00 00 00 00
   14 * 14	 02 03 01 81 0C 00 FF 01 01 // 00=helicopter, 01=small, 02=large
         	 80 23 23 00 00 
   15 * 10	 03 03 01 00 01 FF 01 00 01 00
   16 * 17	 04 03 7F 01 00 "Small Plane" 00
   17 * 44	 00 03 10 01 00          // Model no
         	          03 0E          // Vehicle Life
         	          04 0A          // Model Life
         	          06 0F          // Climate
         	          08 FF          // New Gfx
         	          09 02          // 02=plane, 00=helicopter
         	          0A 00          // 00=small, 01=large
         	          0B 0C          // Cost
         	          0C 13          // Speed (*8)
         	          0D 7F          // Acceleration
         	          0E 08          // Running Cost (*~?337) (default *~?42)
         	          0F 0C 00       // Passenger Capacity
         	          11 06          // Mail Capacity
         	          12 06          // 06,45=Prop; 07,3D,46=Jet; 3B=SST.
         	          13 00 00 00 00 // Refittable cargo mask
         	          15 01          // Refit cost
         	          1A 30 B9 0A 00 // Date of introduction
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: GRF file no longer works with recent OpenTTD releases.

Post by Eddi »

as a wild guess i'd suspect the refit-mask. if it results in "no cargo type" then the vehicle is removed from the purchase list. it should read "passengers only" or something. furthermore, you shouldn't use the refitmask property, but the refitable cargo classes and refitable cargo lists instead. (plus a cargo translation table)

unrelated: for things like introduction date you should probably use escapes for better readability :)
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: GRF file no longer works with recent OpenTTD releases.

Post by Supercheese »

If the NFO gets too confusing for you, you could look into NML, which IMO is far superior w.r.t. readability and ease of coding.
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: GRF file no longer works with recent OpenTTD releases.

Post by PikkaBird »

Eddi wrote:as a wild guess i'd suspect the refit-mask. if it results in "no cargo type" then the vehicle is removed from the purchase list.
Removing (or fixing) the refit mask makes the aircraft appear, indeed.

Edit: Aircraft don't have a "default cargo" property; I suspect what has changed in OpenTTD is that the default cargo used to be passengers, whereas it now it is the first refittable.
AndyLandy
Engineer
Engineer
Posts: 30
Joined: 10 Sep 2008 20:09

Re: GRF file no longer works with recent OpenTTD releases.

Post by AndyLandy »

PikkaBird wrote:
Eddi wrote:as a wild guess i'd suspect the refit-mask. if it results in "no cargo type" then the vehicle is removed from the purchase list.
Removing (or fixing) the refit mask makes the aircraft appear, indeed.

Edit: Aircraft don't have a "default cargo" property; I suspect what has changed in OpenTTD is that the default cargo used to be passengers, whereas it now it is the first refittable.
That's fantastic, I've just recompiled my test plane without the cargo mask and it worked. Many thanks for all the advice received here, it's greatly appreciated.

NML does indeed look like a neat idea, I will look into that. At the time I started, I don't think anything like that existed, but things have come quite a long way in the last four years. Wonderful to know this great little game is still as popular as ever.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: GRF file no longer works with recent OpenTTD releases.

Post by wallyweb »

AndyLandy wrote:NML does indeed look like a neat idea, I will look into that.
Another option with a similar concept is Michael Blunck's m4nfo.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: GRF file no longer works with recent OpenTTD releases.

Post by michael blunck »

wallyweb wrote:
AndyLandy wrote:NML does indeed look like a neat idea, I will look into that.
Another option with a similar concept is Michael Blunck's m4nfo.
It doesn´t support aircraft (nor airports).

O/c, I could easily set up a module in case there´s any need. :cool:

regards
Michael
Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 9 guests