Page 1 of 2

Adding new vehicle graphics

Posted: 14 Dec 2002 07:30
by Patchman
TOPIC BROKEN: New topic is here. Please lock and unstick this.

----------------------------------------

** Updated January 14 2003 **

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 also possible for trains, road vehicles and planes.

Unlike simply changing the existing graphics, adding new ones is a bit more complicated.

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:
  1. 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.
  2. Paste these into a new .NFO file; perhaps a copy of one of the example .NFO files attached here.
  3. Add the first special sprites, don't worry about the numbers yet
  4. Add an action 0 to at least set that vehicle's sprite to FD for trains or FF for everything else
  5. Add an action 1, after which you paste the copied .NFO strings from trg1.nfo
  6. Add one or more action 2 entries
  7. Add one action 3 entry for each different vehicle
  8. Run renum.pl on it, or count the sprites yourself
  9. Encode it with GRFCodec
  10. Copy it to the newgrf folder in your TTD directory
  11. add the line "newgrf/yourfile.grf" to newgrf.txt, where "yourfile" is your .grf file name
  12. Try it! Hopefully it works...
Oh, and you also need to turn on "newtrains" (-T), "newrvs" (-XR) and/or "newplanes" (-XP) to enable new graphics for these vehicle types.

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.

Oh and could someone please fix this topic? I can't write replies (topic_notify error), only edit this existing post.

Re: Adding new vehicle graphics

Posted: 19 Dec 2002 14:39
by Nem
Hi,
I've some problems creating a new Goods Wagon. My purpose is to add, not replace, a second goods wagon (Train) with a new graphic.
As I said there are some problems, but the most important are:

1) Perl remove my 13th line (action 4 - new name of the wagon) from the generated .nfo file

2) The TTDpatch crash using that .NFO files

Of course there will be some other errors, but I'd like to fix this 2 first.
If someone could help me that would be a great Xmas gift.
I'm not asking a complete debug, just a couple of hints.

Here you can read my .NFO file and the .NFO file generated by Perl

---------------------------------------------------------------------
My original .NFO file
---------------------------------------------------------------------

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 4)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel

0 * 4 0E 00 00 00

1 * 8 00 12 FD 14 80 15 15 05

// Action 0
// 00 - Train
// 12 FD - 12 is the sprite ID for train (new graphic)
// 14 80 - Capacity
// 15 05 - Goods
// 16 ?? - weight - removed
// 17 ?? - cost factor - removed

2 * 3 00 02 04

// Action 1
// 00 - Train
// 02 - number of set of sprites (2, empty & full)
// 04 - number of images for each set (4 because the wagon is simmetric)

3 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 738 584 01 18 8 -3 -10
4 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 754 584 09 16 22 -15 -7
5 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 786 584 01 12 28 -14 -6
6 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 818 584 09 16 22 -5 -8
7 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 1410 584 01 18 8 -3 -10
8 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 1426 584 09 15 22 -15 -6
9 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 1458 584 01 12 28 -14 -6
10 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 1490 584 09 16 22 -5 -8

11 * 4 00 00 02 02

// Action 2
// 00 - Train
// 00 - Cargo ID
// 02 - Number of images while the cargo is in movement (2, empty & full)
// 02 - Number of images while the cargo loading (2, empty & full)

12 * 5 00 01 01 05 00

// Action 3
// 00 - Train
// 01 - This definition is for only one Wagon
// 01 - First vehicle using the definition
// 05 - goods
// 00 - cargo ID

13 * 14 00 01 01 Nem Goods Wagon0

// Action 4
// 00 - Train
// 01 - only one vehicle take this name
// 01 - First Vehicle using the given name
// Nem Goods Wagon0 - name
---------------------------------------------------------------------------

Using Perl the result is:

---------------------------------------------------------------------------
// Automatically generated by GRFCODEC. Do not modify!
// (Info version 4)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
0 * 4 17 00 00 00
1 * 8 00 12 FD 14 80 15 15 05
2 * 3 00 02 04
3 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 738 584 01 18 8 -3 -10
4 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 754 584 09 16 22 -15 -7
5 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 786 584 01 12 28 -14 -6
6 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 818 584 09 16 22 -5 -8
7 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 1410 584 01 18 8 -3 -10
8 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 1426 584 09 15 22 -15 -6
9 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 1458 584 01 12 28 -14 -6
10 C:\Giochi\TTWin95\SPRITES\trg1r004.PCX 1490 584 09 16 22 -5 -8
11 * 4 00 00 02 02
12 * 5 00 01 01 05 00

---------------------------------------------------------------------------

As you can see action 4 (13th line) was missing.

Thanks in advance and Merry Christmas
Bye

Re: Adding new vehicle graphics

Posted: 21 Dec 2002 16:17
by Patchman
Here are some comments on your .nfo file:
Nem wrote: 0 * 4 0E 00 00 00
This line is correct.
1 * 8 00 12 FD 14 80 15 15 05
Here you're missing the actual action number. The action number is not determined by sprite sprite number; you have to specify it explicitly. Also you need to specify the number of properties and vehicles you're changing. Please read newgrf.txt again :)
Format: <action> <veh-type> <num-props> <num-vehs> <first-veh> <prop-data>

Code: Select all

1 * 9   00 00 03 01 00 12 FD 14 80 15 15
2 * 3 00 02 04
Again missing the action number; should be 2 * 4 01 00 02 04

The lines for the PCX files seem to be correct.
11 * 4 00 00 02 02
Again missing the action number, as well as the actual sprite numbers. Format should be <action> <veh-type> <cargo-id> <num-loadtypes> <num-loadingtypes> <loadtypes...>:

Code: Select all

11 * 9   02 00 00 02 02 00 00 01 00 00 00 01 00
02=action; 00=trains; 00=cargo ID 0; 02 02=two different load statusses each for moving and loading; 00 00 and 01 00 = sprite sets 0 and 1 are the sprites to use
12 * 5 00 01 01 05 00
Again missing the action number. Here you're setting the new cargo ID to be used for train vehicle "1", where you were setting the new sprite to FD for train vehicle "0" above in action 0. That doesn't match... it should be:

Code: Select all

12 * 7     03 00 01 00 00 00 00
03=action; 00=trains; 01=one train vehicle; 00=train vehicle "0"; 00=no cargo-specific sprites, only default; 00 00=use cargo ID 0 as default
13 * 14 00 01 01 Nem Goods Wagon0
Aside from not specifying the sprite number, you can't give the name as actual text, you have to use the ASCII codes in hexadecimal, e.g. "A"=41 in hex, and "f"=66 in hex.

Hope that helps...

And I haven't actually tested any of this because I'm on vacation :)

Posted: 21 Dec 2002 17:06
by iSteve
Hopefully somebody will make a lamah-friendly client for that, too :oops: :lol: :lol: :oops:

Re: Adding new vehicle graphics

Posted: 21 Dec 2002 17:26
by spaceman-spiff
Patchman wrote:And I haven't actually tested any of this because I'm on vacation :)
Diagnostic: I think you're sick :cry:
Cure: play some TTD :D

Re: Adding new vehicle graphics

Posted: 22 Dec 2002 00:41
by Nem
Patchman wrote:Here are some comments on your .nfo file .......
:D Thank you very much for the explanation, in the next days I'll try to fix my .NFO file.

Merry Christmas to everyone.

Nem

Posted: 22 Dec 2002 04:24
by Mad Dog McKill
Err...what must I do after I changed the graphics in the pcx for that chimera in the trntest to make it a grf again? I am not very good with these kinds of things...could you please you explain it to me...It should be easier to do then to create a new train or smth...

Posted: 22 Dec 2002 07:06
by Raichase
Is that what i'm doing wrong? I'm changing the .pcx file, but not changing the .NFO file...

Oh nvm, i think i'll leave it up to the experts :P

Posted: 25 Dec 2002 10:49
by spacy
Thank patchman, i used your maglev example,
and got some help from Michael

i created the most used diesel/passenger engine we use here in the Netherlands, and our powerful electric loc 1800

download it here: http://members.home.nl/rolandj/ttd/

below a screenshot of a first version of that DM'90 Buffel diesel engine,
not it already looks better ;)

a little problem

Posted: 29 Dec 2002 21:00
by cmd_srui
Hi!

I tried to make a loco of my own... problem is, when I go to a raildepot, I do not have any locomotive for buying. Neither the one I have done, nor the default ones... What could be wrong?

Posted: 29 Dec 2002 21:03
by cmd_srui
Sorry :( it just keept giving me an error message. I thought it did not post the message.... until I gave up and saw this

sorry guys.

Posted: 30 Dec 2002 00:57
by Nem
cmd_srui wrote:Sorry :( it just keept giving me an error message. I thought it did not post the message....
Hi,
if you want you can remove your posts using the EDIT button (near the QUOTE button). Except the original one, of course.
Bye

Posted: 30 Dec 2002 08:01
by spaceman-spiff
I removed them, but now strangely enough, your postcount is 0 :cry:

Btw. i got this error: Could not find email template file topic_notify
If you get this one, just ignore it , your post has been done

Re: a little problem

Posted: 30 Dec 2002 13:03
by spacy
cmd_srui wrote:Hi!

I tried to make a loco of my own... problem is, when I go to a raildepot, I do not have any locomotive for buying. Neither the one I have done, nor the default ones... What could be wrong?
upload or post your created grf file somewhere so we can look to it.

Posted: 30 Dec 2002 13:06
by spacy
spaceman-spiff wrote:I removed them, but now strangely enough, your postcount is 0 :cry:

Btw. i got this error: Could not find email template file topic_notify
If you get this one, just ignore it , your post has been done
me to, i guess josef or some other turned the option notify my with email if somebody react on this topic on,
so i guess the admin of this forum should look if there isnt some file missing orso

Posted: 31 Dec 2002 00:32
by heavyjoost
spacy wrote:Thank patchman, i used your maglev example,
and got some help from Michael

i created the most used diesel/passenger engine we use here in the Netherlands, and our powerful electric loc 1800

download it here: http://members.home.nl/rolandj/ttd/

below a screenshot of a first version of that DM'90 Buffel diesel engine,
not it already looks better ;)
cool train!! those ones are here too :D (Groningen, Winschoten)

My PCX File

Posted: 01 Jan 2003 23:45
by cmd_srui
This is the Locomotive graphics I want to add...

some doubts...

Posted: 02 Jan 2003 00:00
by cmd_srui
I believe that although i have been through all txt files and expalnation, i am just not understanding anything about creating new graphics...

I really wanted to create all the locomotives , cars and wagons of my national railway companie, whitout having to substitute the original the original graphics... :( it seems I am not going to be able to do it now can't I?

I s it possible to have all rolling stock of my country in one huge pcx file?

Posted: 09 Jan 2003 21:19
by SHADOW-XIII
Micheal Blunck released new graphics on his page ... take a look, it's beautifull: http://www.patagonia.de.vu/ttd

Posted: 09 Jan 2003 22:46
by Katana
how do you activate the new trains, i dont no :oops:
patchman said "newtrains (-T). i'd just make a new line in the ttdpatchw.cfg, but it did not work :(