Difference between revisions of "Preliminaries"

From TTWiki
Jump to navigationJump to search
m (11 revisions)
 
m (update link to grfcodec)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
  +
{{NFOTutorial}}
 
'''''What you need to know and do when making new graphics'''''
 
   
 
'''NOTE TO AUTHORS''': Read the LocalStyleGuide, otherwise the page may be rolled back to the last well-commented edit. (This applies everywhere, not just on the pages that mention it.)
 
'''NOTE TO AUTHORS''': Read the LocalStyleGuide, otherwise the page may be rolled back to the last well-commented edit. (This applies everywhere, not just on the pages that mention it.)
Line 6: Line 5:
 
To write:
 
To write:
   
- explain GRFCodec / GRFWizard
+
* explain GRFCodec / GRFWizard
 
* explain hex codes: specific examples using Windows calculator, ideally with screenshots
 
* maybe: explain DOS/Windows version and how to convert between them
 
* other things?
   
 
==What's a .GRF file?==
- explain hex codes: specific examples using Windows calculator, ideally with screenshots
 
 
- maybe: explain DOS/Windows version and how to convert between them
 
 
- other things?
 
 
-=What's a .GRF file?=-
 
   
 
As you probably already found out ttd can load new graphics files with help of the patch. These files have the extension .grf and are located in the newgrf folder.
 
As you probably already found out ttd can load new graphics files with help of the patch. These files have the extension .grf and are located in the newgrf folder.
   
These .grf files are made by [http://www.ttdpatch.net/tools.html#grfcodec|the GRFcodec], this program merges a [[DrawingSprites|.pcx]] file and a .nfo file. <span style='color:#808080'>(links to george his tut now, but I think on top of that page should be an explanation about pcx files and their pallete )</span> In this tutorial we won't look at those 2 file types yet, at first we shall try to explain the basics.
+
These .grf files are made by [http://dev.openttdcoop.org/projects/grfcodec GRFcodec], this program merges a [[DrawingSprites|.pcx]] file and a .nfo file. <span style='color:#808080'>(links to george his tut now, but I think on top of that page should be an explanation about pcx files and their palette)</span> In this tutorial we won't look at those 2 file types yet, at first we shall try to explain the basics.
   
-= The GRFCodec and the GRFWizard=-
+
== The GRFCodec and the GRFWizard ==
   
 
Like said before a .grf file is a file made by the GRFCodec. The codec is a package of 3 programs:
 
Like said before a .grf file is a file made by the GRFCodec. The codec is a package of 3 programs:
   
&nbsp; 1. GRFCodec: Convert a GRF into an editable PCX file and vice versa
+
# GRFCodec: Convert a GRF into an editable PCX file and vice versa
 
# GRFDiff: Compare two GRF files for differences, and write only the differences to a GRD file
 
# GRFMerge: Take a GRD file and merge it back into the GRF file
   
 
In this tutorial we will only use the first program, if you want more info about the other programs look [http://www.ttdpatch.net/grfcodec/grfcodec.html here].
&nbsp; 2. GRFDiff: Compare two GRF files for differences, and write only the differences to a GRD file
 
   
 
The GRFCodec is a command line program. This means it's option are only been set in the command line, there is no nice user interface. For the nice interface you can download the [http://www.divxland.org/ttd/ttdsolutions.htm GRFWizard] This program is really helpful. Be warned though for the GRFWizard to work you need the GRFCodec too.
&nbsp; 3. GRFMerge: Take a GRD file and merge it back into the GRF file
 
 
In this tutorial we will only use the first program, if you want more info about the other programs look [http://www.ttdpatch.net/grfcodec/grfcodec.html|here].
 
 
The GRFCodec is a command line program. This means it's option are only been set in the command line, there is no nice user interface. For the nice interface you can download the [http://www.divxland.org/ttd/ttdsolutions.htm|GRFWizard] This program is really helpful. Be warned though for the GRFWizard to work you need the GRFCodec too.
 
   
 
When you run the GRFWizard for the first time you have to point it to the codec, when you have done this everything is really straight forward, you can encode your homemade sprites (sprites are the little drawings that represent one side of a building/vehicle) or you can decode a grf from someone else.
 
When you run the GRFWizard for the first time you have to point it to the codec, when you have done this everything is really straight forward, you can encode your homemade sprites (sprites are the little drawings that represent one side of a building/vehicle) or you can decode a grf from someone else.
Line 38: Line 32:
 
When you want to encode graphics you have to point the wizard which grf file you want to encode the 2nd step is to tell it in which you placed the NFO and PCX. All these file should have the same name.
 
When you want to encode graphics you have to point the wizard which grf file you want to encode the 2nd step is to tell it in which you placed the NFO and PCX. All these file should have the same name.
   
If you want to encode totally new graphics you have to make a &quot;fake&quot; grf. Just make a new txt file and rename it to the grf you want to encode.
+
If you want to encode totally new graphics you have to make a "fake" grf. Just make a new txt file and rename it to the grf you want to encode.
   
 
If you choose to decode a grf, the nfo and pcx will be extracted to a map called sprites in the in the folder where you placed the grfcodec in.
 
If you choose to decode a grf, the nfo and pcx will be extracted to a map called sprites in the in the folder where you placed the grfcodec in.
   
-=Hex=-
+
==Hex==
   
 
'''Unless noted clearly (yes, there are a very few exceptions), assume that all the code on these pages is in hex.'''
 
'''Unless noted clearly (yes, there are a very few exceptions), assume that all the code on these pages is in hex.'''
   
  +
hex <nowiki>[heks]</nowiki>
hex [heks] 1. verb - to bewitch; practice witchcraft on
+
# verb - to bewitch; practice witchcraft on
 
2. adjective - of or pertaining to a numbering system that uses 16 as the radix, employing the numerals 0 through 9 and representing digits greater than 9 with the letters A through F.
+
# adjective - of or pertaining to a numbering system that uses 16 as the radix, employing the numerals 0 through 9 and representing digits greater than 9 with the letters A through F.
 
# adjective - relating to or encoded in a hexadecimal system, esp. for use by a digital computer.
 
3. adjective - relating to or encoded in a hexadecimal system, esp. for use by a digital computer.
 
   
 
The guts of your computer consist of a bunch of circuits connecting processor chips, memory chips and a bunch of other stuff.
 
The guts of your computer consist of a bunch of circuits connecting processor chips, memory chips and a bunch of other stuff.
Line 56: Line 49:
 
Each chip consists of a bunch of switches that are off (0) or on (1). A series of switches would look something like this: 1001 0001 1110 0101. This is called binary code. A program that you run on your PC reads and/or writes this code. Unless you are a computer genius, mathematician or a nerd, you would probably need definition 1 above to make this work. Consequently, several people from the aforementioned group devised a way for chips to understand a more manageable numbering system called hex (Definitions 2 and 3 above). They called it Assembly Language, probably because it assembles something called a program. TTDX and TTDPatch are programs. They are written in Assembly Language. This is why you need hex to code an nfo code for your new graphics.
 
Each chip consists of a bunch of switches that are off (0) or on (1). A series of switches would look something like this: 1001 0001 1110 0101. This is called binary code. A program that you run on your PC reads and/or writes this code. Unless you are a computer genius, mathematician or a nerd, you would probably need definition 1 above to make this work. Consequently, several people from the aforementioned group devised a way for chips to understand a more manageable numbering system called hex (Definitions 2 and 3 above). They called it Assembly Language, probably because it assembles something called a program. TTDX and TTDPatch are programs. They are written in Assembly Language. This is why you need hex to code an nfo code for your new graphics.
   
HEX is a way of counting. You normally count from 1 till 9 and then go to 10,11 etc. In HEX it works a bit differently: you count from 0 till 9 but then you go one with A, B,C,D,E,F. So 1 till 9 is just 1 till 9, but then it gets funky A=10, B=11, C=12 and so one till F= 15. when you reach F you just do like you would do normally, you start at 0 again but now with a 1 in front thus 10 (gee thats almost like normal counting! :P) so 10=16 If you want a better understandable explanation visit [http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tutorial/bin_dec_hex.html|this] link.
+
HEX is a way of counting. You normally count from 1 till 9 and then go to 10,11 etc. In HEX it works a bit differently: you count from 0 till 9 but then you go one with A, B,C,D,E,F. So 1 till 9 is just 1 till 9, but then it gets funky A=10, B=11, C=12 and so one till F= 15. when you reach F you just do like you would do normally, you start at 0 again but now with a 1 in front thus 10 (gee that's almost like normal counting! :P) so 10=16 If you want a better understandable explanation visit [http://oss.oetiker.ch/rrdtool/tut/bin_dec_hex.en.html this] link.
   
 
Now it would be rather uneasy if you have to count it all by yourself (or at least for me being of the lazy generation) so you can use the windows calculator for that.
 
Now it would be rather uneasy if you have to count it all by yourself (or at least for me being of the lazy generation) so you can use the windows calculator for that.
   
If you open it &nbsp;it take any hex, so you have to go to scientific. Just open view and click on scientific mode.
+
If you open it it take any hex, so you have to go to scientific. Just open view and click on scientific mode.
   
 
If you did it correctly it will look like this:
 
If you did it correctly it will look like this:
Line 66: Line 59:
 
(sorry I had to eat, I will see this page later on again)
 
(sorry I had to eat, I will see this page later on again)
   
(He's been out to lunch since last modification: Monday 24 of October, 2005 [20:31:32] by dmccoy.(:eek:) Meanwhile I have added a reason why you need hex to the hex section.(:cool:))
+
(He's been out to lunch since last modification: Monday 24 of October, 2005 [20:31:32] by dmccoy. [[File:icon_eek.gif]] Meanwhile I have added a reason why you need hex to the hex section. [[File:icon_cool.gif]])
   
 
Hopefully the document on these pages will help you to avoid resorting to hex definition 1 too often.
 
Hopefully the document on these pages will help you to avoid resorting to hex definition 1 too often.
  +
[[Category:Tutorials]][[Category:GRF Tutorial]]

Latest revision as of 11:08, 14 June 2012

NOTE TO AUTHORS: Read the LocalStyleGuide, otherwise the page may be rolled back to the last well-commented edit. (This applies everywhere, not just on the pages that mention it.)

To write:

  • explain GRFCodec / GRFWizard
  • explain hex codes: specific examples using Windows calculator, ideally with screenshots
  • maybe: explain DOS/Windows version and how to convert between them
  • other things?

What's a .GRF file?

As you probably already found out ttd can load new graphics files with help of the patch. These files have the extension .grf and are located in the newgrf folder.

These .grf files are made by GRFcodec, this program merges a .pcx file and a .nfo file. (links to george his tut now, but I think on top of that page should be an explanation about pcx files and their palette) In this tutorial we won't look at those 2 file types yet, at first we shall try to explain the basics.

The GRFCodec and the GRFWizard

Like said before a .grf file is a file made by the GRFCodec. The codec is a package of 3 programs:

  1. GRFCodec: Convert a GRF into an editable PCX file and vice versa
  2. GRFDiff: Compare two GRF files for differences, and write only the differences to a GRD file
  3. GRFMerge: Take a GRD file and merge it back into the GRF file

In this tutorial we will only use the first program, if you want more info about the other programs look here.

The GRFCodec is a command line program. This means it's option are only been set in the command line, there is no nice user interface. For the nice interface you can download the GRFWizard This program is really helpful. Be warned though for the GRFWizard to work you need the GRFCodec too.

When you run the GRFWizard for the first time you have to point it to the codec, when you have done this everything is really straight forward, you can encode your homemade sprites (sprites are the little drawings that represent one side of a building/vehicle) or you can decode a grf from someone else.

When you want to encode graphics you have to point the wizard which grf file you want to encode the 2nd step is to tell it in which you placed the NFO and PCX. All these file should have the same name.

If you want to encode totally new graphics you have to make a "fake" grf. Just make a new txt file and rename it to the grf you want to encode.

If you choose to decode a grf, the nfo and pcx will be extracted to a map called sprites in the in the folder where you placed the grfcodec in.

Hex

Unless noted clearly (yes, there are a very few exceptions), assume that all the code on these pages is in hex.

hex [heks]

  1. verb - to bewitch; practice witchcraft on
  2. adjective - of or pertaining to a numbering system that uses 16 as the radix, employing the numerals 0 through 9 and representing digits greater than 9 with the letters A through F.
  3. adjective - relating to or encoded in a hexadecimal system, esp. for use by a digital computer.

The guts of your computer consist of a bunch of circuits connecting processor chips, memory chips and a bunch of other stuff.

Each chip consists of a bunch of switches that are off (0) or on (1). A series of switches would look something like this: 1001 0001 1110 0101. This is called binary code. A program that you run on your PC reads and/or writes this code. Unless you are a computer genius, mathematician or a nerd, you would probably need definition 1 above to make this work. Consequently, several people from the aforementioned group devised a way for chips to understand a more manageable numbering system called hex (Definitions 2 and 3 above). They called it Assembly Language, probably because it assembles something called a program. TTDX and TTDPatch are programs. They are written in Assembly Language. This is why you need hex to code an nfo code for your new graphics.

HEX is a way of counting. You normally count from 1 till 9 and then go to 10,11 etc. In HEX it works a bit differently: you count from 0 till 9 but then you go one with A, B,C,D,E,F. So 1 till 9 is just 1 till 9, but then it gets funky A=10, B=11, C=12 and so one till F= 15. when you reach F you just do like you would do normally, you start at 0 again but now with a 1 in front thus 10 (gee that's almost like normal counting! :P) so 10=16 If you want a better understandable explanation visit this link.

Now it would be rather uneasy if you have to count it all by yourself (or at least for me being of the lazy generation) so you can use the windows calculator for that.

If you open it it take any hex, so you have to go to scientific. Just open view and click on scientific mode.

If you did it correctly it will look like this:

(sorry I had to eat, I will see this page later on again)

(He's been out to lunch since last modification: Monday 24 of October, 2005 [20:31:32] by dmccoy. Icon eek.gif Meanwhile I have added a reason why you need hex to the hex section. Icon cool.gif)

Hopefully the document on these pages will help you to avoid resorting to hex definition 1 too often.