Coding Troubles, Test GRF of the train has been released

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Coding Troubles, Test GRF of the train has been released

Post by Villem »

Alright i read the .nfo coding tutorials and i tried to code a vehicle i had drawn, but i hit a snag.

after i encoded the file, TTDPatch says the file has more sprites than specified.. But i have 1 set of sprites that consists of 8 sprites, and so is specified in the nfo file(ignore the offsets for now, i haven't touched them yeat).

What exactly is wrong with the code, besides the obivius wrong offsets?

[EDIT]See http://www.tt-forums.net/viewtopic.php?p=388922#388922 for the GRF.
Attachments
2te10u.zip
the pcx file & nfo
(2.19 KiB) Downloaded 118 times
Last edited by Villem on 30 Dec 2005 17:01, edited 1 time in total.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

It means more sprites than specified in sprite 0 (you have specified 0 sprites).

Try running the nfo through nforenum. :)
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

Ah yes, that worked. Thanks Pikka.
Now i need to sort out the palette problem my graphics seem to be having..

[edit]ok i sorted out palette problems.
User avatar
jvassie
Tycoon
Tycoon
Posts: 3421
Joined: 18 Dec 2002 18:00
Location: High Wycombe, England
Contact:

Post by jvassie »

success then? screenies! :D

James
(British) Modular Stations Set - Thread: | Website:
Swiss Set - Thread: | Website:
Route Map Creator
My Screenshot Thread
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

First view with correct offsets, though the train is going the wrong way..
and i still need to make it doubleheaded..
The Train is the Russian 2TE10U(usually its doubleheaded but the 2 head's can be seperated). Its quite a monster at pulling heavy freight trains. :)

[edit] im gona proceed and bang my head on the table cause i don't get what is wrong with my speed & power action 0's, but according to nforenum and ttdpatch theres something wrong with them

//!!Warning (99): Offset 8: No more data was expected.
14 * 11 00 00 01 01 13 09 31 30 30 12 FD
//!!Warning (99): Offset 8: No more data was expected.
15 * 12 00 00 01 01 13 0B 35 39 30 30 12 FD
Attachments
Image1.png
Image1.png (1.77 KiB) Viewed 4039 times
Flamelord
Chief Executive
Chief Executive
Posts: 731
Joined: 24 Mar 2005 22:29
Location: Oregon

Post by Flamelord »

I had the same problem awhile ago. I think that you've only told it to change one property, then tried to change more than one. I bet if you review the beginning of those action 0s you'll find that this is true.
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

They both are told to change one property, and they only change one property.

Line 14 defines speed, while line 15 defines power. Neither do define anything else.
Last edited by Villem on 29 Dec 2005 21:56, edited 1 time in total.
Flamelord
Chief Executive
Chief Executive
Posts: 731
Joined: 24 Mar 2005 22:29
Location: Oregon

Post by Flamelord »

Then I must be very confused. Sorry about that; my inexperience coding NFOs is showing through again. :oops:
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

Ok i fixed the no more data was expected, but now it complains about invalid property 30..

and in this case, number 30 is part of the value in speed & power adjustments, i don't know why nforenum thinks its a property.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Post by OzTrans »

Why make it complicated ...

a) change all properties for 1 vehicle in the same sprite :

Code: Select all

-1 * 11     00 00 03 01 13 09 31 0B 35 39 12 FD
b) now what else was wrong :

. there is no property 30, at least until today.
. power is a word, i.e. it is 2 bytes long, unless that 30 30 was that new property.
Last edited by OzTrans on 29 Dec 2005 22:09, edited 1 time in total.
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

well, str2hex brings 100 in hex as 31 30 30
and 5900 in hex as 35 39 30 30

But your solution fixed it, thanks.
Though, now my train can go 3,614mp/h and has 14,645hp of power :O

and i changed them seperately so i don't get confused with the code, im only starting out.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Post by OzTrans »

Well, 100 km/h is 64h and 5900 hp is 0Ch 17h (in little endian).

If you want to define those properties seperately, that's ok; but now your code should then look as follows :

Code: Select all

-1 * 7      00 00 01 01 13 12 FD
-1 * 8      00 00 01 01 13 09 64 00
-1 * 8      00 00 01 01 13 0B 0C 17
Just keep going and you'll soon get the hang of it.

EDIT: corrected that property 09 code.
Last edited by OzTrans on 29 Dec 2005 22:41, edited 1 time in total.
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

ah so, str2hex gives incorrect numbers, thanks for the help. :]
but nforenum doesn't like that you gave only 64 for the value in speed, it would want 1 more byte set(so i added 00 after it and it accepted it and values are right ingame)..
Last edited by Villem on 30 Dec 2005 11:07, edited 1 time in total.
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Post by OzTrans »

You can use 'str2hex' only to translate text strings, like vehicle names; with values that works differently. Having a calculator that does this is a real bonus.

EDIT: Sorry about that, property 09 (speed) is of course also a word, so it's got to be 09 64 00.
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

Alright i want to make the train multihead by default, but i can't find the wiki page in ttdpatch wiki that tells about coding multihead trains.

Also i tried implementing the misc.switch that makes the train 2 company coloured, but after i added it what i think was correct it still wasn't 2 cc(and i had drawn in the proper 2cc colour too).

Code: Select all

15 * 12	 00 00 02 01 13 0B 0C 17 02 00
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

You should get NFORenum (see DaleStan's sig for a link) to check your NFO files.

Broken down, your sprite does this:
00 = action 0
00 = feature 0 (trains)
02 = two properties are set
01 = for one vehicle
13 = vehicle ID 13
0B = property 0B, power
0C 17 = power value, 170C hex = 5900 HP
02 = property 02, reliability decay speed
00 = no reliability decay

Instead of setting property 02 to 00, you probably want to set property 27 (misc flags) to 02 (bit 1 set = uses 2CC). And to make it multiheaded, set property 13 to 01.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

Yeah im using nforenum, the wiki just confused me.

Thanks patchman.

now, ill try fix this problem with that both heads are facing wrong ways..
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

Alright, with most(i hope)of the bugs squished, i need some help to squish out the remaining of them.

Thus i release the GRF, note the intorduction date is not correct, i have not yeat changed it. it should come out at 1958-1959 range, Arctics/Tropics only.


Known Bugs However Are:

1). The Train clips with its name in the depot buylist, i have no idea how to fix it thus far.
2). The Train clips with TTD's wagons in the buylist & ingame, and TTD wagons generally look out of place with it. i will try to fix this in near future.


And these are the following persons who i want to thank for helping me code this grf, and teaching me how to draw the train in it.

Patchman, the one who helped me to make this train multihead and use 2 company colour support.

Pikkabird, pointed me to nforenum that got me to my first beta.

Flamelord, he was right afterall, the lines did change more than 1 property!

OzTransLtd, helped me to get the power & speed action0's to work.

Purno, without your drawing tutorials that train would not have graphics.

DaleStan, without your nforenum tool this grf would not be here.

eis_os, your ingame sprite aligning tool was invaluable, without it, this grf probably would not be here.

and those who made all that nfo coding info at the ttdpatch wiki avaible, you provided my first steps to nfo.
Attachments
2te10u.grf
Please use Alpha 69 when using this grf. 2 Company Colours are supported.
(1.66 KiB) Downloaded 117 times
User avatar
Killer 11
Tycoon
Tycoon
Posts: 2463
Joined: 06 Jan 2004 18:38
Location: Kaunas, Lithuania
Contact:

Post by Killer 11 »

that's very nice!
could you help me with the coding of Lithuania set?
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1714
Joined: 04 Mar 2005 01:07

Post by OzTrans »

It is somewhat a dangerous practice to only define a few vehicle properties; whatever you have not defined will be copied from a vehicle with the same ID as yours from another trainset that happens to be activated; thus giving you unpredictable results. As far as alignment goes, you need to further work on that. Best is to put some box cars between the 2 heads and make adjustments against their alignment.

In the purchase list, there is only room for about 56 pixels; in order to make your engine fit, you need to provide another set of sprites with shorter horizontal views (cut out 4 pixel columns each) and then reference that in action-3 as follows (you'll need another action-2, of course) :

Code: Select all

12 * 10     03 00 01 13 01 FF xx 00 00 00
xx = the set ID, probably 01 in your case.
BTW, FF is the cargo ID for the purchase list entry.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 31 guests