Difference between revisions of "PalettesAndCoordinates"
(7 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
Since TTD is a palette-based game, you have to be careful that the graphics program you use can deal with that properly. Also, TTD uses some palette entries for palette cycling to do some colour-animation, don't use these as regular colours. These entries are often called "action colours". |
Since TTD is a palette-based game, you have to be careful that the graphics program you use can deal with that properly. Also, TTD uses some palette entries for palette cycling to do some colour-animation, don't use these as regular colours. These entries are often called "action colours". |
||
− | Palette files for a number of graphics programmes |
+ | Palette files for a number of graphics programmes that were available on the [http://dev.openttdcoop.org/documents/1 DevZone] |
+ | are now at https://www.tt-forums.net/viewtopic.php?t=91568 from https://web.archive.org/web/20121115112036/https://dev.openttdcoop.org/documents/1 as .zip. |
||
− | Below is an explanation by Oskar Eisemuth of the various colour ranges in the DOS and Windows palettes. Both palettes work similarly, but some of the colours are in different places. Do use the DOS palette as it contains |
+ | Below is an explanation by Oskar Eisemuth of the various colour ranges in the DOS and Windows palettes. Both palettes work similarly, but some of the colours are in different places. Do use the DOS palette as it contains some additional colours and is easier to work with (all grays in one line). |
⚫ | |||
[[File:dospal.png]] |
[[File:dospal.png]] |
||
⚫ | |||
Info on the image: The colors you '''can use normally''' are marked in '''green'''. The colors which '''have special purposes/are color cycles''' are marked '''yellow'''. '''Don't use''' the '''pink''' colours like the ones marked "WinAPI" in the Windows palette. |
Info on the image: The colors you '''can use normally''' are marked in '''green'''. The colors which '''have special purposes/are color cycles''' are marked '''yellow'''. '''Don't use''' the '''pink''' colours like the ones marked "WinAPI" in the Windows palette. |
||
− | The '''Pure White''' at the bottom right of each palette is a palette colour, but you shouldn't use it in graphics; instead use the "almost white" from index 0x0F instead (colour code #FCFCFC). Use pure white for the background of your sprite sheet; [ |
+ | The '''Pure White''' at the bottom right of each palette is a palette colour, but you shouldn't use it in graphics; instead use the "almost white" from index 0x0F instead (colour code #FCFCFC). Use pure white for the background of your sprite sheet; [http://dev.openttdcoop.org/projects/grfcodec GRFCodec] and [[NML:Main|NML]] will issue a warning if a sprite containes pure white pixels. This warning is useful as it lets you know that the code referencing a sprite has the wrong position or size defined, but not so useful if your sprite actually contains pure white pixels. |
The colours in the "company" range are often (but not always) changed to the current player colours. In some instances, they may be changed to colours specified by the .grf file, or random colours, or not changed at all. |
The colours in the "company" range are often (but not always) changed to the current player colours. In some instances, they may be changed to colours specified by the .grf file, or random colours, or not changed at all. |
||
Line 22: | Line 23: | ||
The palette cycling ranges listed are the water cycle (used for the blinking dots in the water), the block cycle, fire cycle, exchange red (better called crossing red; used for the flashing crossing lights), and the yellow cycle (used for lights in the runway of the large airport). |
The palette cycling ranges listed are the water cycle (used for the blinking dots in the water), the block cycle, fire cycle, exchange red (better called crossing red; used for the flashing crossing lights), and the yellow cycle (used for lights in the runway of the large airport). |
||
+ | |||
+ | [[File:block_cycle.gif]] |
||
+ | |||
+ | [[File:fire_cycle.gif]] |
||
+ | |||
+ | [[File:red_cycle.gif]] |
||
+ | |||
+ | [[File:yellow_cycle.gif]] |
||
+ | |||
+ | [[File:water_cycle_1.gif]] |
||
+ | |||
+ | [[File:water_cycle_2.gif]] |
||
+ | |||
The following table presents more detailed info on differences between DOS and Windows colours and colour indices: |
The following table presents more detailed info on differences between DOS and Windows colours and colour indices: |
||
[[File:TTD_Palettes.png]] |
[[File:TTD_Palettes.png]] |
||
+ | |||
+ | At https://www.tt-forums.net/viewtopic.php?t=91568 are various palettes from https://web.archive.org/web/20121115112036/https://dev.openttdcoop.org/documents/1 as .zip. |
||
== Coordinates == |
== Coordinates == |
Latest revision as of 09:11, 7 August 2024
Palettes
Since TTD is a palette-based game, you have to be careful that the graphics program you use can deal with that properly. Also, TTD uses some palette entries for palette cycling to do some colour-animation, don't use these as regular colours. These entries are often called "action colours".
Palette files for a number of graphics programmes that were available on the DevZone are now at https://www.tt-forums.net/viewtopic.php?t=91568 from https://web.archive.org/web/20121115112036/https://dev.openttdcoop.org/documents/1 as .zip.
Below is an explanation by Oskar Eisemuth of the various colour ranges in the DOS and Windows palettes. Both palettes work similarly, but some of the colours are in different places. Do use the DOS palette as it contains some additional colours and is easier to work with (all grays in one line).
Info on the image: The colors you can use normally are marked in green. The colors which have special purposes/are color cycles are marked yellow. Don't use the pink colours like the ones marked "WinAPI" in the Windows palette. The Pure White at the bottom right of each palette is a palette colour, but you shouldn't use it in graphics; instead use the "almost white" from index 0x0F instead (colour code #FCFCFC). Use pure white for the background of your sprite sheet; GRFCodec and NML will issue a warning if a sprite containes pure white pixels. This warning is useful as it lets you know that the code referencing a sprite has the wrong position or size defined, but not so useful if your sprite actually contains pure white pixels.
The colours in the "company" range are often (but not always) changed to the current player colours. In some instances, they may be changed to colours specified by the .grf file, or random colours, or not changed at all.
Here is a list, provided by George, of the shades of player colours that will be used:
The "Company 2" range is normally not a special colour range, but since TTDPatch 2.0.1 alpha 67 it is possible to activate it as a second company colour for vehicles and town houses.
The palette cycling ranges listed are the water cycle (used for the blinking dots in the water), the block cycle, fire cycle, exchange red (better called crossing red; used for the flashing crossing lights), and the yellow cycle (used for lights in the runway of the large airport).
The following table presents more detailed info on differences between DOS and Windows colours and colour indices:
At https://www.tt-forums.net/viewtopic.php?t=91568 are various palettes from https://web.archive.org/web/20121115112036/https://dev.openttdcoop.org/documents/1 as .zip.
Coordinates
TTD internally uses a pseudo-3D or 2.5D engine, which uses an isometric projection to display graphics on a 2D screen. The graphics engine uses so-called "bounding boxes" for each sprite, which are sorted by the sprite sorter to get drawn in (what it thinks is) the right order.
To get a certain sprite drawn at the right place, it needs to have a proper bounding box (which is provided by the game for the most part), and the correct 2D offsets, here called "xofs" and "yofs" (see RealSprites for more information). The following picture by Oskar Eisemuth should help in figuring out how the 3D and 2D coordinates relate to each other:
For 3D coordinates, X goes from top right to bottom left, Y goes from top left to bottom right, and Z (height) from down to up. For 2D coordinates, X goes from left to right, and Y from top to bottom. Usually, the top side of the screen is referred to as "north", and thus "east", "south" and "west" are the right, bottom and left side of the screen.
For vehicles, the center of the bounding box (shown with a red dot in the yellow boxframe) is the reference point from which the xofs and yofs are counted. This means that in most cases, xofs and yofs need to be negative to get the sprite to fit on the box. Normally, as indicated above, this means xofs is approximately the negative value of half the sprite width, and yofs is approximately the negative value of half the sprite height.
For all other sprites, the reference point is the furthest corner of the box, at its lowest X, Y and Z coordinates, i.e. the lower northernmost corner. In the image above, it is indicated by the crossing point of the blue lines. The xofs and yofs work from this point, instead of the center of the box as for vehicles.