png--> grf

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

Post Reply
User avatar
RSpeed tycoonfreak
Transport Coordinator
Transport Coordinator
Posts: 349
Joined: 02 Feb 2006 13:17
Location: Azewijn The netherlands
Contact:

png--> grf

Post by RSpeed tycoonfreak »

Hello,
I just drawed my first building (new hq stage 4).
It's now in png and I want it in my game!
I read somewhere that I have to make a nfo file too but I also don't know how to do that.
Could anyone tell me what I have to do?
User avatar
Purno
Tycoon
Tycoon
Posts: 16659
Joined: 30 Mar 2004 12:30
Location: Almere, The Netherlands

Post by Purno »

It's very complicated, I can tell you that. You can look at http://wiki.ttdpatch.net/tiki-index.php ... phicsSpecs for some info...
Contributor to the The 2cc Set and Dutch Trainset. Inventor of the Metro concept. Retired Graphics Artist.
Image Image
Download TT | Latest TTDPatch | OpenTTD | OpenTTDCoop | BaNaNaS: OpenTTD content system | 2048² OTTD scenario of the Netherlands
GRF Codec | GRF Crawler | GRF Maker | Usefull graphics & tools sites | NML Documentation Wiki | NFO Documentation Wiki
All my graphics are licensed under GPL. "Always remember you're unique, just like everyone else."
User avatar
Benbo
Transport Coordinator
Transport Coordinator
Posts: 380
Joined: 09 Jan 2006 18:51
Location: UK

Post by Benbo »

Basically, it's a long process, which takes a long time to learn. I'm kind of learning, but the Wiki is the right place to start. I haven't found another tutorial in NFO creating anyway.
User avatar
Villem
Tycoon
Tycoon
Posts: 3310
Joined: 28 Aug 2003 09:38

Post by Villem »

Uhhh the basics at max take 1 day, i wouldn't define that as long time..
Not to mention he just wants to replace the HQ building, wich should be very easy..
User avatar
ISA
Tycoon
Tycoon
Posts: 3384
Joined: 17 Oct 2005 20:56
Location: Estonia

Post by ISA »

Uhhh the basics at max take 1 day
It depens how good is your english.... Basics is easy to understand, but when you are going on, then the English is going harder imo.(more specific words :wink: )
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7596
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

Akalamanaia wrote:Uhhh the basics at max take 1 day, i wouldn't define that as long time..
Not to mention he just wants to replace the HQ building, wich should be very easy..
Yes, you could do with with tools entirely using action A.
Image
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

For just doing that, using grfdiff and the grd2grf converter are probably the easiest to use.
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
webfreakz.nl
Director
Director
Posts: 627
Joined: 11 Aug 2005 08:22
Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
Contact:

Post by webfreakz.nl »

Isn't it possible to use another system instead of newgrf files?
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

You can use grfdiff to create a win32 binary that will modify your ttd grf files.
You can use grfdiff to create a grd file that will tell grfmerge how to modify your ttd grf files.
Somehow, I don't think that those are improvements.

But it's the output from grd2grf is an action A grf. Those should not be able to cause desyncs.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
RSpeed tycoonfreak
Transport Coordinator
Transport Coordinator
Posts: 349
Joined: 02 Feb 2006 13:17
Location: Azewijn The netherlands
Contact:

Post by RSpeed tycoonfreak »

This is what someone told me to do if I want to make my own graphics:
PNG -> PCX
PCX + NFO + Grfcodec -e -> GRF

Well I have a PCX file now and my question is: what to do?
I know I need an NFO File but how do I make one?
I took a look at the wiki page but thats about trains, but how about buildings?

I have these programs:

-Grf wizard 1.9.0.1
-Grdtogrf,
-Grfcodec,
-And Nfo Editor. 1.1.0.6
Are there any programs that I need to have?
Visit The Fake Airport Website
Image
Hobbys: being 18 years old, soccer, go karting, and transport tycoon.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

It's 5am, I have nothing better to do, so quick and dirty guide to replacing the HQ sprites using an action A.
RSpeed tycoonfreak wrote: -Grf wizard 1.9.0.1
-Grdtogrf,
-Grfcodec,
-And Nfo Editor. 1.1.0.6
You won't need anything on that list except grfcodec, and you will also need nforenum.

1) decode trg1r.grf, if you haven't already. Open the pcx file and find the HQ sprites (2603 to 2631).

2) Paste your new HQ sprites into trg1r.pcx, over the existing ones. Hopefully they are the same size - if not, you will have to adjust the sizes and offsets later on. Save the pcx file.

3) Create a new text document. This will be your NFO file. Name it <whatever>.nfo, where <whatever> is what you'll want the grf file to be called.

4) Paste the following into the nfo file:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 6)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 00 00 00 00
This is the header which all NFO files must have, and your sprite 0.

5) Add the action 8 psuedosprite. eg:

Code: Select all

1 * 1	08 06 55 55 01 01 "My HQ" 00 "By Me" 00
See the action 8 wiki page for exactly how the action 8 works.

6) Add the action A psuedosprite. This will look something like this:

Code: Select all

 1 * 1	 0A 01 1D 2B 0A
where 1D is the number of sprites to replace (29 = 1D in hex), and 2B 0A is the sprite number to start replacing from (2603 = A2B in hex, which with the bytes in little-endian order becomes 2B 0A). If you don't want to replace all the HQ sprites, adjust these numbers so it's replacing the sprites you want to replace.

7) open trg1r.nfo, find the lines for the sprites you have replaced (the sprite numbers are the same as appear in the pcx), and copy and paste them into your nfo file after the action A sprite. If your sprites aren't exactly the same size as the defaults, you'll have to adjust the sizes and offsets at the end of the lines - the format is given in the NFO header. But don't worry about this until you've got the grf file working - you can always go back and adjust later.

Your nfo file should now look something like this:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 6)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
    0 * 4	 00 00 00 00
1 * 1	08 06 55 55 01 01 "My HQ" 00 "By Me" 00
1 * 1	 0A 01 1D 2B 0A
 2603 sprites/trg1r.pcx 114 9640 09 31 64 -31 0
 2604 sprites/trg1r.pcx 194 9640 09 31 64 -31 0
 2605 sprites/trg1r.pcx 274 9640 09 31 64 -31 0
 2606 sprites/trg1r.pcx 354 9640 09 31 64 -31 0
 2607 sprites/trg1r.pcx 434 9640 09 31 64 -31 0
 2608 sprites/trg1r.pcx 514 9640 09 31 64 -31 0
 2609 sprites/trg1r.pcx 594 9640 09 31 64 -31 0
 2610 sprites/trg1r.pcx 674 9640 09 31 64 -31 0
 2611 sprites/trg1r.pcx 2 9752 09 31 64 -31 0
 2612 sprites/trg1r.pcx 82 9752 09 15 59 -26 0
 2613 sprites/trg1r.pcx 146 9752 09 31 64 -31 0
 2614 sprites/trg1r.pcx 226 9752 09 18 32 1 -3
 2615 sprites/trg1r.pcx 274 9752 09 31 64 -31 0
 2616 sprites/trg1r.pcx 354 9752 09 5 4 -31 12
 2617 sprites/trg1r.pcx 370 9752 09 31 64 -31 0
 2618 sprites/trg1r.pcx 450 9752 09 31 64 -31 0
 2619 sprites/trg1r.pcx 530 9752 09 53 64 -31 -22
 2620 sprites/trg1r.pcx 610 9752 09 31 64 -31 0
 2621 sprites/trg1r.pcx 690 9752 09 42 63 -30 -24
 2622 sprites/trg1r.pcx 2 9816 09 31 64 -31 0
 2623 sprites/trg1r.pcx 82 9816 09 21 32 -31 -6
 2624 sprites/trg1r.pcx 130 9816 09 31 64 -31 0
 2625 sprites/trg1r.pcx 210 9816 09 31 64 -31 0
 2626 sprites/trg1r.pcx 290 9816 09 73 64 -31 -44
 2627 sprites/trg1r.pcx 370 9816 09 31 64 -31 0
 2628 sprites/trg1r.pcx 450 9816 09 21 32 1 -6
 2629 sprites/trg1r.pcx 498 9816 09 31 64 -31 0
 2630 sprites/trg1r.pcx 578 9816 09 69 64 -31 -48
 2631 sprites/trg1r.pcx 658 9816 09 31 64 -31 0
8) Save the nfo file and run it through nforenum. This should fix up the sprite numbers and tell you if you've got any errors.

9) if you don't have any errors, encode with grfcodec, and you should have a working grf file.

Good luck, have fun...
User avatar
RSpeed tycoonfreak
Transport Coordinator
Transport Coordinator
Posts: 349
Joined: 02 Feb 2006 13:17
Location: Azewijn The netherlands
Contact:

Post by RSpeed tycoonfreak »

thank's ,I'll try


btw, Here in the netherlands It's 25th Februari 21:00 (9PM)
Visit The Fake Airport Website
Image
Hobbys: being 18 years old, soccer, go karting, and transport tycoon.
User avatar
RSpeed tycoonfreak
Transport Coordinator
Transport Coordinator
Posts: 349
Joined: 02 Feb 2006 13:17
Location: Azewijn The netherlands
Contact:

Post by RSpeed tycoonfreak »

ehm, How do I decode it? :oops:
Visit The Fake Airport Website
Image
Hobbys: being 18 years old, soccer, go karting, and transport tycoon.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

RSpeed tycoonfreak wrote:ehm, How do I decode it? :oops:
Using grfcodec.

The readme should contain all the information you need.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
RSpeed tycoonfreak
Transport Coordinator
Transport Coordinator
Posts: 349
Joined: 02 Feb 2006 13:17
Location: Azewijn The netherlands
Contact:

Post by RSpeed tycoonfreak »

It doesn't work.
If I use grf wizard and i select the path to grfcodec I get this: (error1)
And how do I use grfcodec?
Do I have to drag the trg1r.grf on the grf codec.exe?
because if I do that nothing is happening.
Do I have to open the grfcodec.exe?
because if I do that I get a dos screen for about 0,1 sec. and then it's gone.

Please help even if i sound completely stupid now,
because my english is not that good. :? :? :?
Attachments
error1.PNG
error1.PNG (9.36 KiB) Viewed 4494 times
Visit The Fake Airport Website
Image
Hobbys: being 18 years old, soccer, go karting, and transport tycoon.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5631
Joined: 13 Sep 2004 13:21
Location: The Moon

Post by PikkaBird »

Okay,

1) create a new shortcut in the directory where you have put grfcodec. In "type the location of the item", type cmd.exe, click next, click finish.

2) right click on the shortcut and select properties. In 'Start in', it will probably have "%windir%". Delete this so the 'Start in' dialogue is empty, click okay.

3) copy trg1r.grf to the directory.

4) run the shortcut. You will get a DOS prompt. Type:

Code: Select all

grfcodec -d trg1r.grf
This will create a SPRITES subdirectory, and put the pcx and nfo files in it. This subdirectory is where you will want to create your new nfo file. You can use this same shortcut for decoding and encoding grf files in the future.

I should warn you, I'm not going to be this helpful for much longer...
User avatar
RSpeed tycoonfreak
Transport Coordinator
Transport Coordinator
Posts: 349
Joined: 02 Feb 2006 13:17
Location: Azewijn The netherlands
Contact:

Post by RSpeed tycoonfreak »

Thanks you're very helpful but I think I need youre help one more time:
If i type grfcodec -d trg1r.grf

it says:

grfcodec are not recognised as an internal or external task, programme or batchfile.

(It's maybe not exactly what it suppose to be but I translated it with a translator)

If you or anybody else solve this problem I think i don't need help anymore. :oops:
Attachments
error2.PNG
error2.PNG (10.12 KiB) Viewed 4466 times
Visit The Fake Airport Website
Image
Hobbys: being 18 years old, soccer, go karting, and transport tycoon.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

RSpeed tycoonfreak wrote:If I use grf wizard...
Interesting. I wasn't aware that program was broken too. But it fits; all the rest of the software that person wrote is broken. (grfcodec works just fine from directories containing whitespace; I just checked.)


EDIT: Re-read Pikka's instructions. You forgot a step.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Actually, there's another option too: You moved the shortcut to a directory other than the one containing grfcodec.

If that's the case, change #2 to "Enter the directory containing grfcodec and the grf files in the 'Start in' dialogue".
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

RSpeed tycoonfreak wrote: PNG -> PCX
would probably work for a normal GRF, but not for OTTDs 34bpp, for a start, the 32bpp base image is, 32 bit, including RGB+Alpha. PCX is only 24bit, RGB only. so, the alpha is already gone out of the windows, and we havn't even looked at the 2bit CC overlay yet.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Killer 11 and 32 guests