Latest document describing new vehicle .grf files is now available here:
http://www.ttdpatch.net/src/newgrf.txt
Update on July 16 2003:
Note: In 2.0, it is required to use a correct action 8 entry in your graphics files. It also must be grf version 2, or it will not be accepted. Please update your graphics files or they won't load under 2.0, beta or not.
Also, it is no longer possible to override vehicle names using ttdpttxt.dat. The new mechanism to do this is explained here: http://www.tt-forums.net/viewtopic.php?p=88377#88377
Older information
Since TTDPatch 1.9.1 alpha 6, it is possible to add new vehicle graphics to the game, similar to the new ships by Michael Blunck, but now this is also possible for trains, road vehicles and planes.
Unlike simply changing the existing graphics, adding new ones is a bit more complicated, however.
I wrote a very technical explanation which is part of the source code .zip file, and I'll also attach the current version here.
I'm attaching three example files as well, one for each vehicle type, which you can decode with GRFCodec, and try to understand how they work after reading the newgrf.txt file.
Here's a very brief summary:
- Copy the lines from the TRG1.NFO file for the vehicle type you want to modify. Pick a vehicle that's closest in size and shape to what you want to add.
- Paste these into a new .NFO file; perhaps a copy of one of the example .NFO files attached here.
- Add the first special sprites, don't worry about the numbers yet
- Add an action 0 to at least set that vehicle's sprite to FD for trains or FF for everything else
- Add an action 1, after which you paste the copied .NFO strings from trg1.nfo
- Add one or more action 2 entries
- Add one action 3 entry for each different vehicle
- Run renum.pl on it, or count the sprites yourself
- Encode it with GRFCodec
- Copy it to the newgrf folder in your TTD directory
- add the line "newgrf/yourfile.grf" to newgrf.txt, where "yourfile" is your .grf file name
- Try it! Hopefully it works...
Update on January 13 2003:
I have changed the format of the new graphics files slightly, to allow for random graphics and variational graphics (which are like random graphics but deterministic). These changes apply to alpha 13 and higher. In alpha 12, the format of action 0 changed slightly; for trains, a missing property has been inserted ( 18 ), which changed the numbers for properties for sound/graphics effect type to 19, and sorting to 1A.
Please read the changes in action 2 and 3 if you want to use randomized or variational graphics, as well as wagon overrides.
Randomized graphics means a wagon for example will have several different graphics set, and one set will be chosen randomly. At your option, the graphics will be randomized again when the wagon is receives the next load and/or enters a depot.
Variational graphics are graphics that depend on variables, such as current date/year or the vehicle age or speed. These are a set of different graphics like random graphics, but they aren't chosen randomly, and instead determined by the variables.
Finally, wagon override means that you can specify graphics for certain wagons, which will only be used when attached to a specific engine. For example, you could make an ICE engine that forces the regular passenger wagon to look like an ICE wagon, but only when actually connected to the ICE engine.
Please have a look at the attached files to see how all of this works.
Update on January 14 2003:
I had to change the definition of random cargo ID lists, please insert one byte, according to the updated newgrf.txt.
Update on January 23 2003:
In alpha 16, the format of actions 4 and 6 changed slightly.
For action 4, I introduced an additional byte that allows you to specify the language of the name. That way, you can have several action 4 entries for each vehicle, one for each language (or several languages, if you so choose).
Action 6 now has a different terminator byte. Instead of 00, the last byte must now be FF, so as to allow the use of parameter number 0 more than once. Currently, this action is backward compatible (i.e. "00" will work too), but I will remove the compatibility soon, so please update your graphics files and change the final byte of all action 6 entries to "FF".
Update on February 2 2003:
In alpha 21, I've changed the meanings of some properties of the road vehicles, and added a few new ones.
Prop. 12 is now the setting of the sound effect, can have values 17, 19 or 1A for regular vehicles and 3C or 3E for toyland vehicles.
This moved the former prop. 12 and 13 down one slot. So prop. 13 is now the power, and prop. 14 is the weight.
Prop. 15 is new, and sets the top speed if "rvpower on" is used. This value is given in units of mph*0.8, and can thus go to 320 mph or 511 km/h. If unset, the value of the regular top speed, prop. 08 is used. Always set prop. 08 too if you change prop. 15
Prop. 16 is also new, and works like prop. 10 for the ships. It allows you to make road vehicles refittable, and choose the cargo types that the vehicle can be refitted to. The refitting works similar to the trains (i.e. the refit button replaces the "reverse" button), but the road vehicles use the ship refitting mechanism instead of the planes. To enable this, there is no new switch, just "newrvs on" is enough.
Update on February 24 2003:
Alpha 28 adds action 8, which specifies a unique ID for each GRF file. It will be mandatory to specify this in one of the coming alpha versions. This ID will be used to identify .grf files and allow the game to only load the graphics that were active when a game was saved.
Additionally, action 7 is now more versatile, because it can also check the climate, as well as skipping the rest of the file without you having to count all the remaining sprites. See the updated sprites.txt for more info.
Update on February 27 2003:
Removed the attachment here, instead I'll just link to the latest version on the source code page. That'll always be the most up-to-date document.