NFO meta-data problem

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

Moderator: Graphics Moderators

Post Reply
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

NFO meta-data problem

Post by stefino_cz »

Hi all
I'm new in NFO coding, cause I know code in nml. But some things like stations I have to code in NFO. I found soume tutorial here. Tried to make some station tile and it gives to me error in grfcodec. What happened?
bug.JPG
(190.5 KiB) Not downloaded yet
And the second question. In line 7, there are information about tiles itself. It has two parts - background and foreground. But what, if I have only background? How to write it? Code in tutorial seems like this. Two tiles with background and foreground.

Code: Select all

 7 * 62    00 04 02 01 00 08 "TUT0" 09 02 F4 03 00 00 00 00 00 10 05 03 2D 84 00 00 00 00 00 10 10 7A 2E 84 00 00 80 F3 03 00 00 00 00 00
 05 10 03 2F 84 00 00 00 00 00 10 10 7A 30 84 00 00 80
Thanks :)
Image
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NFO meta-data problem

Post by Quast65 »

What version of GRFcodec are you using?
Looks to me like an older version... (as it refers to a pcxfile in the format description)

I use version 603 (more recent versions may be available) that has this format for the graphicssprites:

Code: Select all

// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags
The code for my sprites look like this then (note: I dont use a zoomlevel, the 32bpp sprite is for all zoomlevels, If I am correct "normal" in the 32bpp sprite should then be changed to the zoomlevel you want):

Code: Select all

   11 c:/grfcodec603/dstatadd_part3/gfx/zwolle/zwolle_frontview_8bpp_EMPTY.png  8bpp   10  40   64  122  -31  -91 normal chunked
    | c:/grfcodec603/dstatadd_part3/gfx/zwolle/zwolle_frontview_32bpp.png  32bpp   10    40   64  122  -31  -91 normal chunked
   12 c:/grfcodec603/dstatadd_part3/gfx/zwolle/zwolle_frontview_8bpp_EMPTY.png  8bpp   90  40   64  122  -0  -0 normal chunked
    | c:/grfcodec603/dstatadd_part3/gfx/zwolle/zwolle_frontview_32bpp.png  32bpp    90   40   64  122  -0  -0 normal chunked
And the second question. In line 7, there are information about tiles itself. It has two parts - background and foreground. But what, if I have only background? How to write it? Code in tutorial seems like this. Two tiles with background and foreground.
A stationtile is built up from two graphicssprites, one for in front of the track and the other for the back of the track (logical, as a train can pass between them and you want the backpart be obstructed from view by the train and you want the train be obstructed from view by structures on the frontpart)
Keep the code as is (so code for a foreground and background), but leave the part you want "empty" as transparent blue box in the 8bpp graphics and transparent in the 32bpp graphics.
Thats how you get the single-sided platforms. So do that graphically, not via the code.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NFO meta-data problem

Post by stefino_cz »

I have version 6.0.5 of grfcodec. If I for example decode some existing grf, sprite-line looks like this (witn my edit due 32bit. But it works corectly)

Code: Select all

1594 sprites/total_bridges_NAR00.png  8bpp  130 4184   50   39  -25   -6 normal chunked
    | sprites/MOSTY_CZ.png 	32bpp 0 200 256 173 -128 -79 zi4 chunked nocrop
But if I tried copy it in my new grf and rewrite numbers/paths - it gives to me the error like in post above.

Second question is OK. I had the same idea, to made it transparent but I didn't sure. And maybe one more question about it. If I will have for example 10 station tiles like a group, I code them in NFO like a group too? I mean - I will take my code above and add 6*2 sprites and to line 7 add next 6 codes, ok? Here is my next question. I take for example the foreground like this

Code: Select all

00 00 00 00 00 10 05 03 2D 84
behind sprite data - 10 05 03 there is 2D 84 bits. 84 is somethink like separation bit (I think) and what is the 2D bit? In next part of code it is 2E, in next 2F, 30,...
Thanks :)
Image
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: NFO meta-data problem

Post by michael blunck »

Quast65 wrote: A stationtile is built up from two graphicssprites [...]
A station tile might consist of more than two graphics sprites.
Quast65 wrote: Keep the code as is (so code for a foreground and background), but leave the part you want "empty" as transparent blue [...] So do that graphically, not via the code.
This is pointless. You might only provide the needed graphics sprites in the code.
stefino_cz wrote:

Code: Select all

00 00 00 00 00 10 05 03 2D 84
behind sprite data - 10 05 03 there is 2D 84 bits. 84 is somethink like separation bit (I think) and what is the 2D bit? In next part of code it is 2E, in next 2F, 30,...
These are sprites numbers from an action1 sprite block, 0x42D being the first sprite, 0x42E being the second one, etc. 0x842D ("2D 84") meaning to draw the sprite in company colour translation.

The m4nfo user manual includes tutorials for station coding and other explanations w/r to coding stations, which might be more helpful than the raw specs.

regards
Michael
Image
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NFO meta-data problem

Post by Quast65 »

EDIT:
Just read Michaels responce while typing this.
First I should write this:
*DISCLAIMER*
There are many ways (and probably better ways) to draw, code and compile a stationGRF, I do NOT claim that my way is the best or simplest or tidiest, but it works for me. ;-)
*/DISCLAIMER*

Secondly, as you said that you understand NML, then going with Michaels m4nfo is a better way to go....



Ok, my post before Michaels responce ;-)


But if I tried copy it in my new grf and rewrite numbers/paths - it gives to me the error like in post above.
Hmmmm.....

I'm guessing now a bit...
But how do the first lines of your code look like (those that start with "//" ), does it look like this:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 32)
// Escapes: 2+ 2- 2< 2> 2u< 2u> 2/ 2% 2u/ 2u% 2* 2& 2| 2^ 2sto = 2s 2rst = 2r 2psto 2ror = 2rot 2cmp 2ucmp 2<< 2u>> 2>>
// Escapes: 71 70 7= 7! 7< 7> 7G 7g 7gG 7GG 7gg 7c 7C
// Escapes: D= = DR D+ = DF D- = DC Du* = DM D* = DnF Du<< = DnC D<< = DO D& D| Du/ D/ Du% D%
// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags
If not, try this or the one you got when decoding with version 605.
If I will have for example 10 station tiles like a group, I code them in NFO like a group too?
Yes.
But you need to specify in the Action-0 (line 7 in your example) what the lay-out will be (2x5 or 5x2, note that the max size of a station that can be built as a complete "block/group" is 7x7, so for example 1x10 is not possible without using drag&drop).
And you need Action-2s to specify what tile goes where in the lay-out!!
I mean - I will take my code above and add 6*2 sprites
No.
For a 10-tile station you will need 40 regular sprites (8bpp) (10 for foreground direction-1, 10 for background direction-1, 10 for foreground direction-2 and 10 for background direction-2) and this is multiplied by the number of 32bpp zoomlevels you have (with that "|" in front of it)
and to line 7 add next 6 codes, ok
Line 7 will then have 20 lines (10 for the first direction and 10 for the other direction), so the number of tiles used by the station ingame x2.
But for multitile stations you will also need to add purchase-menu sprites (2, for each direction), these sprites you will also have to add into the graphics-block of your code offcourse.
behind sprite data - 10 05 03 there is 2D 84 bits. 84 is somethink like separation bit (I think) and what is the 2D bit? In next part of code it is 2E, in next 2F, 30,...
2D 84 00 00 is the spritenumber that refers to the sprites in your Action-1 block (the graphicsblock) Actually the number is 0000842D (its HexaDecimal, reversed bite order), 33837 in Decimals.
The next numbers then are 0000842E, 0000842F, 00008430, 00008431,...,...,..., 00008439, 0000843A, 0000843B,...,...,..., 0000843F, 00008440, 00008441, etc etc.
ALWAYS START WITH 2D FOR YOUR FIRST SPRITENUMBER!!!
This has something to do with that you are adding new graphics to the game, 33837 (in decimals) is some kind of "magic" number ;-) Dont ask me why, it just is ;-)
EDIT: The "magic" number is offcourse 2D 04 00 00 (the first number used for regular sprites, see later on in this post) so 1069 in Decimal.
EDIT2: Just checked the above, 1069 is the spritenumber for the first stationsprite in the Base Graphics, probably not a coincidence ;-)
These numbers add up only for that single station. So the next station-code can start again with 2D 84 00 00

Furthermore, in this case the 84 means that the sprite has companycolors and those should be displayed accordingly to the companycolors of the player, when the tile is placed ingame.
Regular sprites have 04 (so 2D 04 00 00) and sprites that have the see-thru glass effect have 44 22 03 (so 2D 44 22 03)

Have you checked out the NFO-wiki? As that gives a lot of information:
https://newgrf-specs.tt-wiki.net/wiki/Main_Page
Furthermore, this site can be handy for converting decimals into hexadecimals:
http://www.statman.info/conversions/hexadecimal.html
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NFO meta-data problem

Post by stefino_cz »

Thanks, Michael, but I think that I will try to understand basic nfo :)

Quast65: I made some changes. The main problem was in first // lines. I had it wrong. Now it is ok. But I have the next problem at last lines atm.
bug.JPG
(187.76 KiB) Not downloaded yet
I decoded your Dutchsets addons and it looks like the same but grfcodec gives this error due filename :?
Image
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NFO meta-data problem

Post by Quast65 »

I assume you are following the tutorial I wrote 5 years ago:
viewtopic.php?f=26&t=62069

Have you read the last two posts in that thread?
Try that first. As that is how it should be done.

At the time I used code-examples from decoded GRFs and didnt know what the "Å" and "Ä" symbols did and meant in the last lines of the code...
For some silly reason I kept using those (well it worked... :oops: ), even now... :oops:

Are you actualy using the "Å" symbol in codeline 12 (so capital A with a little circle above it)? As your picture is a bit unclear (looks more like a small stripe, then a little circle).
Placing the actual code here would be better, rather than a picture of it.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NFO meta-data problem

Post by stefino_cz »

Mmm...I read it but still doesn't work

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 32)
// Escapes: 2+ 2- 2< 2> 2u< 2u> 2/ 2% 2u/ 2u% 2* 2& 2| 2^ 2sto = 2s 2rst = 2r 2psto 2ror = 2rot 2cmp 2ucmp 2<< 2u>> 2>>
// Escapes: 71 70 7= 7! 7< 7> 7G 7g 7gG 7GG 7gg 7c 7C
// Escapes: D= = DR D+ = DF D- = DC Du* = DM D* = DnF Du<< = DnC D<< = DO D& D| Du/ D/ Du% D%
// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags
    0 * 4    0D 00 00 00 
    1 * 16	 14 "CSSTATIONS" 01 00 57 00 00
    2 * 127	 08 07 "MI" 01 08 "CS Stations Addition Set "
	 "v1" 00 "Doplnujici set pro Cesko-Slovenske stanice." 0D 0D 0D "By stefno_cz" 0D "This "
	 "set includes station addons " 00
    3 * 6    01 04 01 FF 04 00 						
    4  sprites/PLACEHOLDER.png  8bpp  0 0 32 32 0 0  normal chunked
 	   |  sprites/vyhybky_1.png 	32bpp 0 0 256 128 -128 0 zi4 chunked nocrop
    5 sprites/PLACEHOLDER.png   8bpp  0 0 32 32 0 0 normal chunked
 	   |  sprites/vyhybky_1.png 	32bpp 256 0 256 128 -128 0 zi4 chunked nocrop
    6 sprites/PLACEHOLDER.png   8bpp  0 0 32 32 0 0 normal chunked
 	   |  sprites/vyhybky_1.png 	32bpp 512 0 256 128 -128 0 zi4 chunked nocrop
    7 sprites/PLACEHOLDER.png   8bpp  0 0 32 32 0 0 normal chunked
    |  sprites/vyhybky_1.png 	    32bpp 768 0 256 128 -128 0 zi4 chunked nocrop
 8 * 62    00 04 02 01 00 08 "VYH0" 09 02 
 F4 03 00 00 00 00 00 10 05 03 2D 84 00 00 00 00 00 10 10 7A 2E 84 00 00 80 
 F3 03 00 00 00 00 00 05 10 03 2F 84 00 00 00 00 00 10 10 7A 30 84 00 00 80
   9 * 7    02 04 00 00 01 00 00    
   10 * 7    02 04 01 00 01 00 00   
   11 * 10    03 04 01 00 01 FE 01 00 00 00
   12 * 25    04 48 FF 01 00 C5"Vyhybka rucni 1" 00
   13 * 16    04 48 FF 01 00 C4"Vyhybky" 00
Image
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NFO meta-data problem

Post by Quast65 »

there has to be a space between C5 "text" and C4 "text"
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: NFO meta-data problem

Post by michael blunck »

stefino_cz wrote: Thanks, Michael, but I think that I will try to understand basic nfo :)
It´s always a good thing to *understand* plain nfo, but you won´t like to code in it. :p
You might believe me (or not), I´ve been coding in plain nfo for years.

But anyway, at least then there won´t be questions. :cool:

regards
Michael
Image
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NFO meta-data problem

Post by Quast65 »

But anyway, at least then there won´t be questions.
Lucky you.... :wink:
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NFO meta-data problem

Post by Quast65 »

stefino_cz wrote:Mmm...I read it but still doesn't work
There is something else that may not be correct.

Change the Action-14 in codeline 1 from:

Code: Select all

    1 * 16    14 "CSSTATIONS" 01 00 57 00 00
to:

Code: Select all

    1 * 24	 14 "C" "INFO" "B" "PALS" \w1 "D" "B" "BLTR" \w1 "3" 00 00
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NFO meta-data problem

Post by stefino_cz »

Problem was in note in 8th line. I delete it and it is OK now :) So thanks ^_^
Image
User avatar
Quast65
Tycoon
Tycoon
Posts: 2654
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NFO meta-data problem

Post by Quast65 »

it is OK now
Good!!!
DarkSideForce.jpg
DarkSideForce.jpg (141.75 KiB) Viewed 4081 times
You have now joined the Dark Side of the OpenTTD-Force called Station-coding....
Unlimited options and possibilities are now at your feet, providing a hunger for more and more that can never be satisfied!!!
Muhahahahahaha!!! ;-)
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NFO meta-data problem

Post by stefino_cz »

Yes yes...and a lot of work ahead of me (us) :lol: We are two and still searching for new members what will help us with graphics. You can see it in grf develop section in my topic :)
Nové Sedliště Transport, 6. úno 2002.jpg
(1000.61 KiB) Not downloaded yet
Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 3 guests