v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Graphics"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(Moved how to's and references to token page from Graphics token)
(→‎Palettes: 18-colors per palette)
 
(28 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Quality|Unrated}}{{av}}
+
{{Quality|Superior}}{{av}}
 +
[[File:graphics_v50_preview.png|209px|right]]
 
:{{for/see|a list of all Premium graphics tokens and basic usage|[[Graphics token]]}}
 
:{{for/see|a list of all Premium graphics tokens and basic usage|[[Graphics token]]}}
 
:{{for/see|a repository of all Classic tilesets used in DF|[[Tileset repository]]}}
 
:{{for/see|a repository of all Classic tilesets used in DF|[[Tileset repository]]}}
 
:{{for/see|details on creating Classic tilesets|[[Tileset repository]]}}
 
:{{for/see|details on creating Classic tilesets|[[Tileset repository]]}}
  
 
+
The '''graphics''' system in v50 is still being reverse engineered. It is a custom solution which appears to involve compositing graphics sets directly in C++ before texmapping them to SDL. This blitting approach is software rendered and so largely doesn't use hardware acceleration on graphics cards. This system means that despite graphics sets supporting rudimentary animation, there is no traditional sprite mapping, which places extensive limits on the types of graphics that are possible.  While the number of user editable graphics sets has increased significantly in v50, many game elements are still hard coded graphics sets, or using a tileset over the older style graphics from classic DF.
The new graphics system in v50 is still being reverse engineered. It is a custom solution which appears to involve compositing graphics sets directly in C++ before texmapping them to SDL. This blitting approach is software rendered and so largely doesn't use hardware acceleration on graphics cards. This system means that despite graphics sets supporting rudimentary animation, there is no traditional sprite mapping, which places extensive limits on the types of graphics that are possible.  While the number of user editable graphics sets has increased significantly in v50, many game elements are still hard coded graphics sets, or using a tileset over the older style graphics from classic DF.
 
  
 
= Premium Graphics =
 
= Premium Graphics =
Line 42: Line 42:
  
 
Known issues:
 
Known issues:
* Currently it is only recommended to use <code>[TILE_DIM:32:32]</code> as only the upper left 32x32 pixels are displayed on tiles defined larger, and smaller tiles are displayed starting from the upper left of each in-game square (individually by tile with large graphics) rather than centered and bottom justified as might be expected.
+
* Currently it is only recommended to use <code>[TILE_DIM:32:32]</code> as only the upper left 32×32 pixels are displayed on tiles defined larger, and smaller tiles are displayed starting from the upper left of each in-game square (individually by tile with large graphics) rather than centered and bottom justified as might be expected.
 
* It is important that the <code>[PAGE_DIM_PIXELS:<x dim>:<y dim>]</code> matches the size of the referenced image exactly - as the game will stretch tile pages with a dimension larger than the actual image by inserting blank lines, and a tile page smaller than the image will cause a crash to desktop.
 
* It is important that the <code>[PAGE_DIM_PIXELS:<x dim>:<y dim>]</code> matches the size of the referenced image exactly - as the game will stretch tile pages with a dimension larger than the actual image by inserting blank lines, and a tile page smaller than the image will cause a crash to desktop.
 
  
 
== Creature Graphics ==
 
== Creature Graphics ==
 +
{{for/see|a list of all known creature graphics tokens|[[Graphics token#Creature Graphics]]}}.
 
Creature graphics are found within graphics_creature_x files (such as graphics_creature_domestic or graphics_creature_layered).  All graphics files must begin with the file name, followed by the <code>[OBJECT:GRAPHICS]</code> token that tells the game that the file contains graphics definitions.
 
Creature graphics are found within graphics_creature_x files (such as graphics_creature_domestic or graphics_creature_layered).  All graphics files must begin with the file name, followed by the <code>[OBJECT:GRAPHICS]</code> token that tells the game that the file contains graphics definitions.
  
 
=== Basic Graphics ===
 
=== Basic Graphics ===
 +
[[File:Graphics_template_xy_positions.png|thumb|320px|right|An example of how X and Y positions are read, starting from the top left.]]
 
The most basic form of creature graphics is a single tile, defined below:
 
The most basic form of creature graphics is a single tile, defined below:
 
  [CREATURE_GRAPHICS:<creature id>]
 
  [CREATURE_GRAPHICS:<creature id>]
Line 57: Line 58:
 
* ''creature id'': The [[Creature token|Creature ID]] of the creature the graphics represent.
 
* ''creature id'': The [[Creature token|Creature ID]] of the creature the graphics represent.
 
* ''[[#Tile Page|tile page identifier]]'': The Internal ID of the image defined in the Tile Page.
 
* ''[[#Tile Page|tile page identifier]]'': The Internal ID of the image defined in the Tile Page.
* ''x position'': The x position of the graphic to be displayed in tiles counting from 0 (left&rarr;right).
+
* ''x position'': The x position of the graphic to be displayed in tiles counting from 0 (left→right).
* ''y position'': The y position of the graphic to be displayed in tiles counting from 0 (top&rarr;bottom).
+
* ''y position'': The y position of the graphic to be displayed in tiles counting from 0 (top→bottom).
 
* ''color type'': (optional) Uncertain function, frequently replaced with <code>AS_IS</code> in vanilla [[Raw|RAW]]s. ColorTypeEnum{{cite|DF language server|https://gitlab.com/df-modding-tools/df-raw-language-server/-/blob/dev/df_ls_structure/src/objects/graphics.rs}}
 
* ''color type'': (optional) Uncertain function, frequently replaced with <code>AS_IS</code> in vanilla [[Raw|RAW]]s. ColorTypeEnum{{cite|DF language server|https://gitlab.com/df-modding-tools/df-raw-language-server/-/blob/dev/df_ls_structure/src/objects/graphics.rs}}
 
* ''[[Graphics_token#Basic_Conditions|secondary condition]]'': (optional) An additional condition that must be satisfied for the image to be displayed.
 
* ''[[Graphics_token#Basic_Conditions|secondary condition]]'': (optional) An additional condition that must be satisfied for the image to be displayed.
Line 65: Line 66:
  
 
:'''Basic Conditions'''
 
:'''Basic Conditions'''
Different graphics can be defined for the same creature based on some properties about it. Below is a list of the most common creature conditions tokens. Here is the full list of known creature condition tokens.
+
Different graphics can be defined for the same creature based on some properties about it. Below is a list of the most common creature conditions tokens.  
  
 
{| {{prettytable}}
 
{| {{prettytable}}
Line 88: Line 89:
  
 
|}
 
|}
 
  
 
=== Caste Graphics ===
 
=== Caste Graphics ===
Creature caste graphics allow a simple alternative to [[#Layered Graphics|Layered Graphics]] to represent males and females of a creature with different images.
+
Creature caste graphics allow a simple alternative to [[#Layered Graphics|Layered Graphics]] to represent males and females (or other castes) of a creature with different images.
 
  [CREATURE_CASTE_GRAPHICS:<creature id>:<caste id>]
 
  [CREATURE_CASTE_GRAPHICS:<creature id>:<caste id>]
 
     [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
 
     [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
Line 97: Line 97:
 
* ''caste id'': The [[Caste|Caste ID]] of the caste whose graphics are being defined.
 
* ''caste id'': The [[Caste|Caste ID]] of the caste whose graphics are being defined.
 
* All other parameters are identical to [[#Basic Graphics|basic graphics]].
 
* All other parameters are identical to [[#Basic Graphics|basic graphics]].
 
Creature caste graphics only accept <code>MALE</code> and <code>FEMALE</code> as caste id's even in creatures that have more than two castes.
 
 
  
 
=== Large Graphics ===
 
=== Large Graphics ===
 +
[[File:Graphics_template_large_3x2.png|right|thumb|A 3x2 large image is rendered in the top center, with the central tile in red.]]
 +
[[File:Graphics_template_large_2x1.png|right|thumb|A 2x1 large image is left-justified.]]
 
The only difference between graphics for large creatures and small creatures is the addition of <code>LARGE_IMAGE</code> and additional coordinates to the line below:
 
The only difference between graphics for large creatures and small creatures is the addition of <code>LARGE_IMAGE</code> and additional coordinates to the line below:
 
     [<condition>:<tile page identifier>:LARGE_IMAGE:<x1>:<y1>:<x2>:<y2>:<color type>:<secondary condition>]
 
     [<condition>:<tile page identifier>:LARGE_IMAGE:<x1>:<y1>:<x2>:<y2>:<color type>:<secondary condition>]
Line 113: Line 112:
  
 
Large images and small images can be used within the same <code>CREATURE_GRAPHICS</code> or <code>CREATURE_CASTE_GRAPHICS</code> definition, and in fact it is often useful to include a single tile image to act as a {{token|LIST_ICON|g}} for menus.
 
Large images and small images can be used within the same <code>CREATURE_GRAPHICS</code> or <code>CREATURE_CASTE_GRAPHICS</code> definition, and in fact it is often useful to include a single tile image to act as a {{token|LIST_ICON|g}} for menus.
 
  
 
=== Statue Graphics ===
 
=== Statue Graphics ===
 +
[[File:Graphics_template_statues.png|right|thumb]]
 
Statue graphics are the generic images placed on top of a pedestal whenever a creature is the primary subject of a statue. The image is implied to occupy multiple tiles, and all examples in vanilla are 1x2 vertical rectangles. Statue graphics are defined as below:
 
Statue graphics are the generic images placed on top of a pedestal whenever a creature is the primary subject of a statue. The image is implied to occupy multiple tiles, and all examples in vanilla are 1x2 vertical rectangles. Statue graphics are defined as below:
 
  [STATUE_CREATURE_GRAPHICS:<creature id>]
 
  [STATUE_CREATURE_GRAPHICS:<creature id>]
         [DEFAULT:STATUES_LAYERED:<x1>:<y1>:<x2>:<y2>]
+
         [DEFAULT:<tile page identifier>:<x1>:<y1>:<x2>:<y2>]
 +
 
 +
[STATUE_CREATURE_CASTE_GRAPHICS:<creature id>:<caste id>]
 +
        [DEFAULT:<tile page identifier>:<x1>:<y1>:<x2>:<y2>]
  
 
* ''creature id'': The [[Creature token|Creature ID]] the graphics represent.
 
* ''creature id'': The [[Creature token|Creature ID]] the graphics represent.
 +
* ''caste id'': The [[Caste|Caste ID]] of the caste whose graphics are being defined.
 
* ''x1'': The x position of the upper left tile counting from 0 from the left of the tile page.
 
* ''x1'': The x position of the upper left tile counting from 0 from the left of the tile page.
 
* ''y1'': The y position of the upper left tile counting from 0 from the top of the tile page.
 
* ''y1'': The y position of the upper left tile counting from 0 from the top of the tile page.
Line 126: Line 129:
 
* ''y2'': The y position of the lower right tile.
 
* ''y2'': The y position of the lower right tile.
  
 +
Statue graphics will be automatically recolored based on how their [[Color#Color tokens|Color]] would appear in the default [[Graphics token#Palettes|palette]], like an item. The image (right) is an example of how a graphic would be aligned within the 1x2 grid. Vanilla statues customarily place the bottom row of pixels on the white line, with the gold box delineating where a 32px tall (exactly) sprite would fit.
  
 
=== Layered Graphics ===
 
=== Layered Graphics ===
Line 133: Line 137:
  
 
* ''creature id'': The [[Creature token|Creature ID]] of the creature the graphics represent.
 
* ''creature id'': The [[Creature token|Creature ID]] of the creature the graphics represent.
* ''[[Graphics_token#Basic_Conditions|condition]]'': The condition the creature needs to be in for this set of layers to be displayed.
+
* ''[[Graphics_token#LAYER_SET|condition]]'': The condition the creature needs to be in for this set of layers to be displayed.
  
 
Once you start defining a Layer Set, you can begin adding individual layers from the bottom up to create your final image. For example, if you want to draw a helmet being worn on a head, you would define the head layer first, then define the helmet layer. Layers are defined according to this format:
 
Once you start defining a Layer Set, you can begin adding individual layers from the bottom up to create your final image. For example, if you want to draw a helmet being worn on a head, you would define the head layer first, then define the helmet layer. Layers are defined according to this format:
Line 140: Line 144:
 
  [<layer condition(s)>]
 
  [<layer condition(s)>]
  
* ''layer name'': The internal name of the layer. No known function at this time, but using a descriptive label is recommended.
+
* ''layer name'': The internal name of the layer. Does not need to be unique. No known function at this time, but using a descriptive label is recommended.  
 
* ''[[#Tile Page|tile page identifier]]'': The Internal ID of the image defined in the Tile Page.
 
* ''[[#Tile Page|tile page identifier]]'': The Internal ID of the image defined in the Tile Page.
* ''x position'': The x position of the graphic to be displayed in tiles counting from 0 (left&rarr;right).
+
* ''x position'': The x position of the graphic to be displayed in tiles counting from 0 (left→right).
* ''y position'': The y position of the graphic to be displayed in tiles counting from 0 (top&rarr;bottom).
+
* ''y position'': The y position of the graphic to be displayed in tiles counting from 0 (top→bottom).
 
* ''[[#Large Graphics|LARGE_IMAGE]]:x1:y1:x2:y2'': (optional) Allows a multiple tile image to be displayed. Replaces <x position>:<y position>.
 
* ''[[#Large Graphics|LARGE_IMAGE]]:x1:y1:x2:y2'': (optional) Allows a multiple tile image to be displayed. Replaces <x position>:<y position>.
 
* ''color type'': (optional) Uncertain function, frequently replaced with <code>AS_IS</code> in vanilla [[Raw|RAW]]s. ColorTypeEnum{{cite|DF language server|https://gitlab.com/df-modding-tools/df-raw-language-server/-/blob/dev/df_ls_structure/src/objects/graphics.rs}}
 
* ''color type'': (optional) Uncertain function, frequently replaced with <code>AS_IS</code> in vanilla [[Raw|RAW]]s. ColorTypeEnum{{cite|DF language server|https://gitlab.com/df-modding-tools/df-raw-language-server/-/blob/dev/df_ls_structure/src/objects/graphics.rs}}
 
* ''[[Graphics_token#Layered_Conditions|layer condition(s)]]'': One or more conditional tokens that define under what conditions the layer is displayed and how it interacts with other layers.
 
* ''[[Graphics_token#Layered_Conditions|layer condition(s)]]'': One or more conditional tokens that define under what conditions the layer is displayed and how it interacts with other layers.
  
 +
====Portraits====
  
=== Forgotten Beast Graphics ===
+
96x96 portraits{{version|50.13}} are shown in [[Adventure mode]] and when viewing a creature's sheet. They use the same tokens as layered graphics to display a more detailed view of a creature.
Forgotten beast graphics define layered graphics based on which body parts are present in each procedurally-generated forgotten beast.
 
  
    [TILE_GRAPHICS_RECTANGLE:<tile page id>:<x1>:<y1>:<x2>:<y2>:<beast body token>]
+
A single-layer portrait can be added to a [CREATURE_GRAPHICS] entry with this format:
  
* ''[[#Tile Page|tile page identifier]]'': Internal ID of the image defined in Tile Page.
+
  [LAYER_SET:PORTRAIT]
* ''x1'': The x position of the upper left tile counting from 0 from the left of the tile page.
+
    [LAYER_GROUP]
* ''y1'': The y position of the upper left tile counting from 0 from the top of the tile page.
+
    [LAYER:MAIN:<tile page id>:<x position>:<y position>]
* ''x2'': X position of the lower right tile.
+
    [END_LAYER_GROUP]
* ''y2'': Y position of the lower right tile.
 
* ''beast body token'': The internal ID of generated forgotten beast body types and body parts.
 
  
The <code>TILE_GRAPHICS_RECTANGLE</code> token displays a large image with the upper left corner being defined by <x1>, <y1> and the lower right corner defined by <x2>, <y2>. The <beast body token> is a conditional token that causes the graphics for each layer to be displayed only when the forgotten beast has that particular body type or part.{{verify}}
+
See above for the explanation of each argument.
  
There is not currently a way to use procedurally defined graphics like this for non-{{token|FEATURE_BEAST|c}} creatures.{{verify}}
+
=== Procedural Creature Graphics ===
 +
Procedural graphics define layered graphics based on which body parts are present in each [[Creature token#GENERATED|procedurally-generated]] forgotten beast, titan, or otherwise.
  
 +
    [TILE_GRAPHICS_RECTANGLE:<tile page id>:<x>:<y>:<width>:<height>:<PCG layering token>]
  
=== All creature tokens ===
+
* ''[[#Tile Page|tile page identifier]]'': Internal ID of the image defined in Tile Page.
For reference, all known creature graphics tokens are reproduced below.
+
* ''x'': The x position of the upper left tile counting from 0 from the left of the tile page.
 +
* ''y'': The y position of the upper left tile counting from 0 from the top of the tile page.
 +
* ''width'': How many tiles right the graphic spans. Usually this is 3.
 +
* ''height'': How many tiles down the graphic spans. Usually this is 2.
 +
* ''[[Creature token#PCG_LAYERING|PCG layering token]]'': The internal ID of a [[procedural graphics layer]], representing generated forgotten beast body types and body parts.
  
 +
The <code>TILE_GRAPHICS_RECTANGLE</code> token displays a large image with the upper left corner being defined by <x>, <y> and the size defined by <width>, <height>. The PCG layering token is a conditional token that causes the graphics for each layer to be displayed only when the forgotten beast has that particular body type or part.
  
:'''Basic Conditions'''<br>Different graphics can be defined for the same creature based on some properties about it. Below is a list of all conditions that can be used for creature graphics that accept a ''condition'' token.
+
Humanoid [[experiment]]s use <code>TILE_GRAPHICS</code> instead of <code>TILE_GRAPHICS_RECTANGLE</code>, which omits the <width> and <height> parameters.
{| {{prettytable}}
 
|- bgcolor="#dddddd"
 
! Condition
 
! Accepts<br>Secondary
 
! Description
 
|-
 
| {{token|DEFAULT|g}} || No || The default condition that will be displayed unless overwritten by a more specific one below.
 
  
|-
+
The {{token|PROCEDURAL_CREATURE_GRAPHICS|c}} token allows a creature to use the generation system for a given [[Graphics token#Basic creature sprite types|sprite type]] (which can be caste-specific), and each {{token|PCG_LAYERING|c}} entry will add that part to the assembled sprite.
| {{token|CHILD|g}} || Yes || Will only be displayed if the creature is a {{token|CHILD|c}} or {{token|BABY|c}} and is younger than one of those ages.
 
  
|-
+
== Item Graphics ==
| {{token|ANIMATED|g}} || Yes || Displayed if the creature is raised from the dead, although it is not known how this is decided. Raised status is not related to having a syndrome with the class from {{token|CONDITION_SYN_CLASS|g}} or from having {{token|NOT_LIVING|c}}/{{token|OPPOSED_TO_LIFE|c}}.
+
Item graphics can also be defined, but are mostly hardcoded. This section of the wiki needs to be fleshed out.
  
|-
+
== Workshop Graphics ==
| {{token|CORPSE|g}} || Yes || Displayed as soon as the creature dies.
+
Workshop graphics are displayed during each stage of construction and when it is completed. There are two layers, the base layer and an OVERLAY layer. The base layer shows the floor, tables, chairs and other basic features. The overlay shows various decorations that give the workshop its unique appearance.
  
|-
+
base layer:
| {{token|TRAINED_HUNTER|g}} || Yes || Shown for hunting-trained versions of this creature.
+
    [TILE_GRAPHICS:<tile page identifier>:<graphic tile x position>:<graphic tile y position>:WORKSHOP_CUSTOM:<workshop id>:<building stage>:<workshop tile x position>:<workshop tile y position>]
 +
overlay layer:
 +
    [TILE_GRAPHICS:<tile page identifier>:<graphic tile x position>:<graphic tile y position>:WORKSHOP_CUSTOM_OVERLAY:<workshop id>:<building stage>:<workshop tile x position>:<workshop tile y position>]
  
|-
+
* ''[[#Tile Page|tile page identifier]]'': The Internal ID of the image defined in the Tile Page.
| {{token|TRAINED_WAR|g}} || Yes || Shown for war-trained versions of this creature.
+
* ''graphic tile x position'': The x position of the graphic in tiles counting from 0 (left→right).
 +
* ''graphic tile y position'': The y position of the graphic in tiles counting from 0 (top→bottom).
 +
* ''WORKSHOP_CUSTOM'' and ''WORKSHOP_CUSTOM_OVERLAY'': These tokens define the graphics as belonging to a custom workshop. These tokens do not exist in vanilla workshops except for the Soap maker and Screw press, which are used as examples for custom workshops.
 +
* ''workshop id'': The ID of the workshop defined in its raws.
 +
* ''building stage'': What building stage this graphic is displayed during.
 +
* ''workshop tile x position'': The x position of the workshop tile where the graphic is displayed counting from 0 (left→right).
 +
* ''workshop tile y position'': The y position of the workshop tile where the graphic is displayed counting from 0(top→bottom).
  
|-
+
Note that an extra Y row is defined above the workshop. This allows for graphics that extend into the tile above the workshop.
| {{token|LIST_ICON|g}} || Unknown || Displayed in menus. Useful for large images that would extend beyond the menu boxes otherwise/
 
  
|-
+
Also note that currently custom furnaces do not properly work with premium graphics. The WORKSHOP_CUSTOM and WORKSHOP_CUSTOM_OVERLAY tokens ONLY work with custom workshops. If used with a custom furnace they give an error and the graphics will not appear in game. Custom furnaces can still be made to use graphics if they are defined as workshops in their raws.  
| {{token|SKELETON|g}} || Unknown || Decayed remains of the creature.{{verify}}
 
  
|-
+
These values can be validated by checking the RAW vanilla file <code>[DF Installion]\data\vanilla\vanilla_buildings_graphics\graphics\graphics_workshops.txt</code>
| {{token|SKELETON_WITH_SKULL|g}} || Unknown || Decayed remains of the creature with a skull.{{verify}}
 
|}
 
  
  
:'''Vermin Conditions'''<br>Special Conditions for {{token|VERMIN|c}} creature graphics:
+
== World Map Graphics ==
{| {{prettytable}}
+
World map graphics come in two variations:
|- bgcolor="#dddddd"
 
! Condition
 
! Description
 
|-
 
| {{token|VERMIN|g}} || Necessary for defining graphics that use the tokens below.{{verify}}
 
 
 
|-
 
| {{token|VERMIN_ALT|g}} || Image cycles every 1 second.
 
  
|-
+
    [TILE_GRAPHICS:<tile page identifier>:<x position>:<y position>:<graphic id>]
| {{token|SWARM_SMALL|g}} || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in small groups.
+
    [TILE_GRAPHICS:<tile page identifier>:<x position>:<y position>:<graphic id>:<variation {1 - 5}>]
  
|-
+
* ''[[#Tile Page|tile page identifier]]'': The Internal ID of the image defined in the Tile Page.
| {{token|SWARM_MEDIUM|g}} || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in medium-sized groups.
+
* ''x position'': The x position of the graphic to be displayed in tiles counting from 0 (left→right).
 +
* ''y position'': The y position of the graphic to be displayed in tiles counting from 0 (top→bottom).
 +
* ''graphic id'': The [[Graphics_token#World_Map_Graphics|Graphic Token]] of the world map tile the graphics represent.
 +
* ''variation {1 - 5}'': For Graphic IDs that allow variants.
  
|-
+
These values can be validated by checking the RAW vanilla file <code>[DF Installion]\data\vanilla\vanilla_world_map\graphics\graphics_world_map.txt</code>
| {{token|SWARM_LARGE|g}} || For swarming vermin like [[fly|flies]] and [[fairy|fairies]] in large groups.
 
  
|-
+
== Palettes ==
| {{token|LIGHT_VERMIN|g}} || For [[firefly|fireflies]] etc. Does not replace {{token|VERMIN|g}}.
+
[[File:palettes_v50.png|right]]
  
|-
+
[[Palette]]s are used by [[graphics]] to render colorized objects. This is usually based on [[Material definition token#STATE_COLOR|material colors]], though arbitrary palettes{{version|50.13}} can be created and applied with {{token|USE_PALETTE|g}}.
| {{token|LIGHT_VERMIN_ALT|g}} || Like {{token|VERMIN_ALT|g}} for [[firefly|fireflies]] etc.
 
  
|-
+
    [PALETTE:<palette identifier>]
| {{token|LIGHT_SWARM_SMALL|g}} || Like {{token|SWARM_SMALL|g}} for [[firefly|fireflies]] etc in small groups.
+
        [FILE:images/imagename.png]
 +
        [PALETTE_DEFAULT:<row>] this is the one used in the images themselves
 +
        [PALETTE_COLOR:<color>:<row>]
  
|-
+
* ''name'': The Internal ID being created for the image. DEFAULT is used by most objects and requires a PALETTE_COLOR entry for each [[Descriptor color token|raw-defined color]] that exists.
| {{token|LIGHT_SWARM_MEDIUM|g}} || Like {{token|SWARM_LARGE|g}} for [[firefly|fireflies]] etc in large groups.
+
* ''imagename.png'': The file name of the 8bit RGBA (sometimes called 32bit) in the <code>\graphics\images</code> folder of the mod.
 
+
* ''row'': The y position of the graphic to be displayed in pixels counting from 0 (top→bottom). It is customary to place the default palette at 0.
|-
+
* ''color'': A [[Color#Color tokens|color]] token.
| {{token|LIGHT_SWARM_LARGE|g}} || Like {{token|SWARM_LARGE|g}} for [[firefly|fireflies]] etc.
 
 
 
|-
 
| {{token|REMAINS|g}} || Vermin corpses.
 
 
 
|-
 
| {{token|HIVE|g}} || Vermin hives.
 
|}
 
 
 
 
 
:'''Layered Conditions'''<br>Layers aren't very useful on their own, so they come with a set of conditions to define how when they are displayed and how they interact.
 
{| {{prettytable}}
 
|- bgcolor="#dddddd"
 
! Token
 
! Arguments
 
! Type
 
! Description
 
 
 
|-
 
| {{token|LAYER_GROUP|g}} ||  || Layer<br>Group
 
| Begins defining a layer group. Current effect unknown.{{verify}}
 
 
 
|-
 
| {{token|END_LAYER_GROUP|g}} ||  || Layer<br>Group
 
| marks the end of a layer group. Current effect unknown.{{verify}}
 
 
 
|-
 
| {{token|CONDITION_ITEM_WORN|g}} ||
 
* BY_CATEGORY / BY_TOKEN
 
* [[Body_token#CATEGORY|category]] / [[Body_token#BP|body part token]]
 
* Armor type (ARMOR, GLOVES, Etc.)
 
* Item ID(s)
 
|| Armor<br>Wieldables || Defines a clothing or armor graphic by the specific part it is equipped to, the type of armor it is, and the internal id of that item.
 
For example, a condition representing a right handed mitten or glove would be defined as:
 
<code>[CONDITION_ITEM_WORN:BY_TOKEN:RH:GLOVES:ITEM_GLOVES_GLOVES:ITEM:GLOVES:MITTENS]</code>
 
 
 
|-
 
| {{token|SHUT_OFF_IF_ITEM_PRESENT|g}} ||
 
* BY_CATEGORY / BY_TOKEN
 
* [[Body_token#CATEGORY|category]] / [[Body_token#BP|body part token]]
 
* Armor type
 
* Item ID(s)
 
|| Armor || Causes the current layer to not be rendered if the creature has one of the items worn or equipped. Also accepts the input <code>ANY_HELD</code> or <code>WIELD</code> (e.g. <code>WIELD:WEAPON:ANY</code>).
 
 
 
|-
 
| {{token|CONDITION_DYE|g}} ||
 
* dye color
 
|| Armor
 
|| Should represent which color the clothing is dyed. Currently nonfunctional.{{version|50.05}}
 
 
 
|-
 
| {{token|CONDITION_NOT_DYED|g}} ||  || Armor
 
|| Should check if the clothing is dyed. Currently nonfunctional.{{version|50.05}}
 
 
 
|-
 
| {{token|CONDITION_MATERIAL_FLAG|g}} ||
 
* material flag
 
|| Material || Changes graphics based on the material an equipped item is made of. Valid material flags are similar to [[Reaction#Full_token_list|reactant conditions]] including:
 
* WOVEN_ITEM
 
* ANY_X_MATERIAL
 
:with X being:
 
:* PLANT, SILK, YARN, LEATHER, WOOD, SHELL, BONE, STONE, GEM, TOOTH, HORN, PEARL
 
* IS_DIVINE_MATERIAL
 
* NOT_ARTIFACT
 
* IS_CRAFTED_ARTIFACT
 
* METAL_ITEM_MATERIAL
 
* GLASS_MATERIAL
 
* FIRE_BUILD_SAFE
 
* MAGMA_BUILD_SAFE
 
[http://www.bay12forums.com/smf/index.php?topic=169696.msg8442543#msg8442543 among other, less useful ones.]
 
 
 
|-
 
| {{token|CONDITION_MATERIAL_TYPE|g}} ||
 
* material token
 
|| Material || Changes graphics based on the material an equipped item is made of. Valid material types take the form <code>METAL:COPPER</code> where copper can be replaced with any weapons-grade metal. Initial testing has shown that some [[material token]]s are not functional. {{token|CONDITION_MATERIAL_FLAG|g}} is a better option for any material condition other than metal.
 
 
 
|-
 
| {{token|CONDITION_PROFESSION_CATEGORY|g}} ||
 
* [[Unit type token|profession token(s)]]
 
|| General
 
|| Checks the profession of the creature to act as a condition. Multiple profession tokens can be chained together.
 
 
 
|-
 
| {{token|CONDITION_RANDOM_PART_INDEX|g}} ||
 
* body part
 
* integer index
 
* integer range
 
|| General
 
|| Chooses a random layer within the same group of body parts. Index is which option this condition is, out of Range number of options. Ex:
 
<code>[CONDITION_RANDOM_PART_INDEX:HEAD:3:4]</code>
 
Is the third possible random head out of four total options. One of these random conditions each will be put into a set of four slightly different heads to add some random variation in the appearance of the creature's head.
 
 
 
|-
 
| {{token|CONDITION_HAUL_COUNT_MIN|g}} ||
 
* integer
 
|| General
 
|| Counts how many items the creature is hauling. Used for {{token|PACK_ANIMAL|c}}s in vanilla.
 
 
 
|-
 
| {{token|CONDITION_HAUL_COUNT_MAX|g}} ||
 
* integer
 
|| General
 
|| Counts how many items the creature is hauling. Used for {{token|PACK_ANIMAL|c}}s in vanilla.
 
 
 
|-
 
| {{token|CONDITION_CHILD|g}} ||  || General
 
|| Checks if the creature is a child or baby.
 
 
 
|-
 
| {{token|CONDITION_NOT_CHILD|g}} ||  || General
 
|| Checks if the creature is an adult.
 
 
 
|-
 
| {{token|CONDITION_GHOST|g}} ||  || General
 
|| Checks if the creature is a ghost.
 
 
 
|-
 
| {{token|CONDITION_SYN_CLASS|g}} ||
 
* {{token|SYN_CLASS|syndrome}}
 
|| Syndrome || Changes graphics based on any syndromes the creature is affected by. Valid values include:
 
* ZOMBIE
 
* NECROMANCER
 
* VAMPCURSE
 
* RAISED_UNDEAD
 
* GHOUL
 
 
 
|-
 
| {{token|CONDITION_TISSUE_LAYER|g}} ||
 
* BY_CATEGORY
 
* [[Body_token#CATEGORY|body part category]] or ALL
 
* [[Body_detail_plan_token#BP_LAYERS|tissue layer]] or ALL
 
|| Tissue
 
|| Selects a tissue layer to use for checking other conditions. Ex:
 
<code>[CONDITION_TISSUE_LAYER:BY_CATEGORY:ALL:SKIN]</code>
 
 
 
|-
 
| {{token|TISSUE_MIN_LENGTH|g}} ||
 
* integer
 
|| Tissue
 
|| Checks the current {{token|CONDITION_TISSUE_LAYER|g}}'s LENGTH [[Creature_token#TISSUE_LAYER_APPEARANCE_MODIFIER|appearance modifier]]. Is true if the LENGTH is greater than the integer input.
 
 
 
|-
 
| {{token|TISSUE_MAX_LENGTH|g}} ||
 
* integer
 
|| Tissue
 
|| Checks the current {{token|CONDITION_TISSUE_LAYER|g}}'s LENGTH [[Creature_token#TISSUE_LAYER_APPEARANCE_MODIFIER|appearance modifier]]. Is true if the LENGTH is less than the integer input.
 
 
 
|-
 
| {{token|TISSUE_MAY_HAVE_COLOR|g}} ||
 
* [[Color#Color_tokens|color token(s)]]
 
|| Tissue
 
|| Checks the selected tissue's color. Accepts multiple color tokens, and is true if the any of the colors is present in the selected tissues.
 
 
 
|-
 
| {{token|TISSUE_MAY_HAVE_SHAPING|g}} ||
 
* styling token
 
|| Tissue
 
|| Checks the current {{token|CONDITION_TISSUE_LAYER|g}}'s shaping (hairstyle). Valid tokens are NEATLY_COMBED, BRAIDED, DOUBLE_BRAIDS, PONY_TAILS, CLEAN_SHAVEN and STANDARD_HAIR/BEARD/MOUSTACHE/SIDEBURNS_SHAPINGS.{{verify}}
 
 
 
|-
 
| {{token|TISSUE_NOT_SHAPED|g}} || || Tissue
 
|| Checks the current {{token|CONDITION_TISSUE_LAYER|g}}'s color. Accepts multiple color tokens, and is true if the any of the colors is present in the selected tissues.
 
 
 
|-
 
| {{token|TISSUE_SWAP|g}} ||
 
* IF_MIN_CURLY
 
* integer
 
* tile page id
 
* x position
 
* y position
 
| Tissue
 
| Checks if a tissue is sufficiently curly, and if so swaps to display a different image. The new image is defined by the tile page ID, x position, and y position.
 
 
 
This condition should be within a [LAYER:... ] that has a similar graphic to the on in the TISSUE_SWAP.
 
The current {{token|CONDITION_TISSUE_LAYER|g}} group must also include a {{token|TISSUE_MIN_LENGTH|g}}.
 
|}
 
 
 
 
 
== Item Graphics ==
 
Item graphics can also be defined, but are mostly hardcoded. This section of the wiki needs to be fleshed out.
 
  
 +
Each row of the vanilla palettes.png file is a palette. The PALETTE_DEFAULT row is the row of colors (aka palette) used to in the internal graphics (which are loaded by a tile page) and get replaced by the colors of one of the other rows as specified in the palette_default.txt file. It isn't shown in-game, but the exact RGB values are replaced by the row specified by <code>[PALETTE_COLOR]</code> or {{token|USE_PALETTE|g}}. Each palette supports up to 18 colors.
  
 
= Classic Graphics =
 
= Classic Graphics =
Line 437: Line 258:
 
The main tileset (also called 'character set' or just 'tileset') is an image in BMP or PNG format that contains the 256 different tiles, corresponding to the [[Main:character table|IBM Code Page 437]], which are used to display all objects, creatures, and UI elements in game. The tiles are always arranged in a 16x16 grid, but its dimensions can be varied. You can have both square and non-square tiles, with 16x16 pixels being the most common size. Creatures are displayed as [[Tilesets#Main_creature_tiles|colored letters]] (a white 'B' is a [[polar bear]], a brown 'd' a [[dog]], and a grey 'c' is a [[cat]]).
 
The main tileset (also called 'character set' or just 'tileset') is an image in BMP or PNG format that contains the 256 different tiles, corresponding to the [[Main:character table|IBM Code Page 437]], which are used to display all objects, creatures, and UI elements in game. The tiles are always arranged in a 16x16 grid, but its dimensions can be varied. You can have both square and non-square tiles, with 16x16 pixels being the most common size. Creatures are displayed as [[Tilesets#Main_creature_tiles|colored letters]] (a white 'B' is a [[polar bear]], a brown 'd' a [[dog]], and a grey 'c' is a [[cat]]).
  
As the tileset is limited to only 256 tiles, some objects share the same tile. Most notably, even with upper and lower case letters and 16 colors, a lot of creatures still look identical (goblin, goat, various gibbons, gremlin, goose, etc). The tile for bins, up/down stairs and the cursor are the same; bags use the same tile as the symbol for "male"; and the "female" symbol shares a graphic with amulets. Roads and large rivers on the world map, minecart tracks and walls all share the same tiles as well.
+
As the tileset is limited to only 256 tiles, some objects share the same tile. Most notably, even with upper and lower case letters and 16 colors, a lot of creatures still look identical (goblin, goat, various gibbons, gremlin, goose, etc.). The tile for bins, up/down stairs and the cursor are the same; bags use the same tile as the symbol for "male"; and the "female" symbol shares a graphic with amulets. Roads and large rivers on the world map, minecart tracks and walls all share the same tiles as well.
  
 
Some of those can be changed in the raws and init files, and creatures can have separate graphics, but in most cases they are hardcoded.
 
Some of those can be changed in the raws and init files, and creatures can have separate graphics, but in most cases they are hardcoded.

Latest revision as of 17:45, 25 September 2024

This article is about the current version of DF.
Note that some content may still need to be updated.

Graphics v50 preview.png
For a list of all Premium graphics tokens and basic usage, see Graphics token.
For a repository of all Classic tilesets used in DF, see Tileset repository.
For details on creating Classic tilesets, see Tileset repository.

The graphics system in v50 is still being reverse engineered. It is a custom solution which appears to involve compositing graphics sets directly in C++ before texmapping them to SDL. This blitting approach is software rendered and so largely doesn't use hardware acceleration on graphics cards. This system means that despite graphics sets supporting rudimentary animation, there is no traditional sprite mapping, which places extensive limits on the types of graphics that are possible. While the number of user editable graphics sets has increased significantly in v50, many game elements are still hard coded graphics sets, or using a tileset over the older style graphics from classic DF.

Premium Graphics[edit]

For a list of all Premium graphics tokens and basic usage, see Graphics token.

The [OBJECT:GRAPHICS] object defines the use of various tile-based graphics in the game. As of version 50.01, graphics tokens have been greatly expanded to accommodate the release of the Steam & Itch premium version. This section is a basic description of how to define various types of graphics.

Making custom graphics requires multiple interacting files to function:

  1. An 8bit RGBA (sometimes called 32bit) "imagename.png" in the \<mod_id>\graphics\images folder
  2. A "tile_page_name.txt" in the \<mod_id>\graphics folder
  3. A "graphics_type_name.txt" in the \<mod_id>\graphics folder

Mods can reuse any graphics loaded ahead of them (including vanilla) by using the same tile page token.


Tile Page[edit]

Tile pages link image files to a tile page token so they can be referenced by the graphics file. Just like all other Raw files, Tile Pages must be defined from within a properly named "tile_page_<name>.txt" file and follow:

tile_page_<name>

[OBJECT:TILE_PAGE]

After the object type is defined as above, any number of tile pages can be defined according to the format below.

  [TILE_PAGE:<tile page identifier>]
     [FILE:images/imagename.png]
     [TILE_DIM:<tile x dim>:<tile y dim>]
     [PAGE_DIM_PIXELS:<page x dim>:<page y dim>]
  • tile page identifier: The Internal ID being created for the image.
  • imagename.png: The file name of the 8bit RGBA (sometimes called 32bit) in the \graphics\images folder of the mod.
  • tile x dim: The width of each tile in pixels (usually 32).
  • tile y dim: The height of each tile in pixels (usually 32).
  • page x dim: The width of the image file in pixels.
  • page y dim: The height of the image file in pixels.

Known issues:

  • Currently it is only recommended to use [TILE_DIM:32:32] as only the upper left 32×32 pixels are displayed on tiles defined larger, and smaller tiles are displayed starting from the upper left of each in-game square (individually by tile with large graphics) rather than centered and bottom justified as might be expected.
  • It is important that the [PAGE_DIM_PIXELS:<x dim>:<y dim>] matches the size of the referenced image exactly - as the game will stretch tile pages with a dimension larger than the actual image by inserting blank lines, and a tile page smaller than the image will cause a crash to desktop.

Creature Graphics[edit]

For a list of all known creature graphics tokens, see Graphics token#Creature Graphics..

Creature graphics are found within graphics_creature_x files (such as graphics_creature_domestic or graphics_creature_layered). All graphics files must begin with the file name, followed by the [OBJECT:GRAPHICS] token that tells the game that the file contains graphics definitions.

Basic Graphics[edit]

An example of how X and Y positions are read, starting from the top left.

The most basic form of creature graphics is a single tile, defined below:

[CREATURE_GRAPHICS:<creature id>]
   [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
  • condition: The condition the creature needs to be in for this image to be displayed. Use DEFAULT for generic graphics.
  • creature id: The Creature ID of the creature the graphics represent.
  • tile page identifier: The Internal ID of the image defined in the Tile Page.
  • x position: The x position of the graphic to be displayed in tiles counting from 0 (left→right).
  • y position: The y position of the graphic to be displayed in tiles counting from 0 (top→bottom).
  • color type: (optional) Uncertain function, frequently replaced with AS_IS in vanilla RAWs. ColorTypeEnum[1]
  • secondary condition: (optional) An additional condition that must be satisfied for the image to be displayed.

When the condition [DEFAULT] is used, this graphic will be displayed for the creature in all conditions unless additional, more specific conditions are also defined.

Basic Conditions

Different graphics can be defined for the same creature based on some properties about it. Below is a list of the most common creature conditions tokens.

Condition Accepts
Secondary
Description
[DEFAULT] No The default condition that will be displayed unless overwritten by a more specific one below.
[CHILD] Yes Will only be displayed if the creature is a [CHILD] or [BABY] and is younger than one of those ages.
[ANIMATED] Yes Displayed if the creature is raised from the dead, although it is not known how this is decided. Raised status is not related to having a syndrome with the class from [CONDITION_SYN_CLASS] or from having [NOT_LIVING]/[OPPOSED_TO_LIFE].
[CORPSE] Yes Displayed as soon as the creature dies.
[LIST_ICON] Unknown Displayed in menus. Useful for large images that would extend beyond the menu boxes otherwise.

Caste Graphics[edit]

Creature caste graphics allow a simple alternative to Layered Graphics to represent males and females (or other castes) of a creature with different images.

[CREATURE_CASTE_GRAPHICS:<creature id>:<caste id>]
   [<condition>:<tile page identifier>:<x position>:<y position>:<color type>:<secondary condition>]
  • caste id: The Caste ID of the caste whose graphics are being defined.
  • All other parameters are identical to basic graphics.

Large Graphics[edit]

A 3x2 large image is rendered in the top center, with the central tile in red.
A 2x1 large image is left-justified.

The only difference between graphics for large creatures and small creatures is the addition of LARGE_IMAGE and additional coordinates to the line below:

   [<condition>:<tile page identifier>:LARGE_IMAGE:<x1>:<y1>:<x2>:<y2>:<color type>:<secondary condition>]
  • LARGE_IMAGE: This tag allows a rectangular image with multiple tiles to be defined by its upper left and lower right tiles. Valid for 1x1 - 3x2 tiles.
  • x1: The x position of the upper left tile counting from 0 from the left of the tile page.
  • y1: The y position of the upper left tile counting from 0 from the top of the tile page.
  • x2: The x position of the lower right tile.
  • y2: The y position of the lower right tile.
  • All other parameters are identical to basic graphics.

Large images and small images can be used within the same CREATURE_GRAPHICS or CREATURE_CASTE_GRAPHICS definition, and in fact it is often useful to include a single tile image to act as a [LIST_ICON] for menus.

Statue Graphics[edit]

Graphics template statues.png

Statue graphics are the generic images placed on top of a pedestal whenever a creature is the primary subject of a statue. The image is implied to occupy multiple tiles, and all examples in vanilla are 1x2 vertical rectangles. Statue graphics are defined as below:

[STATUE_CREATURE_GRAPHICS:<creature id>]
       [DEFAULT:<tile page identifier>:<x1>:<y1>:<x2>:<y2>]
[STATUE_CREATURE_CASTE_GRAPHICS:<creature id>:<caste id>]
       [DEFAULT:<tile page identifier>:<x1>:<y1>:<x2>:<y2>]
  • creature id: The Creature ID the graphics represent.
  • caste id: The Caste ID of the caste whose graphics are being defined.
  • x1: The x position of the upper left tile counting from 0 from the left of the tile page.
  • y1: The y position of the upper left tile counting from 0 from the top of the tile page.
  • x2: The x position of the lower right tile.
  • y2: The y position of the lower right tile.

Statue graphics will be automatically recolored based on how their Color would appear in the default palette, like an item. The image (right) is an example of how a graphic would be aligned within the 1x2 grid. Vanilla statues customarily place the bottom row of pixels on the white line, with the gold box delineating where a 32px tall (exactly) sprite would fit.

Layered Graphics[edit]

Layered graphics are a method for displaying overlapping body parts, equipment, clothing, professions, hairstyles.. etc. They allow much more freedom in conditions than normal basic graphics, and they allow combinations of many graphical variations within the same creature to give your graphics more personality and display more information about the individuals. All layered graphics started as shown below:

[CREATURE_GRAPHICS:<creature id>]
	[LAYER_SET:<condition>]
  • creature id: The Creature ID of the creature the graphics represent.
  • condition: The condition the creature needs to be in for this set of layers to be displayed.

Once you start defining a Layer Set, you can begin adding individual layers from the bottom up to create your final image. For example, if you want to draw a helmet being worn on a head, you would define the head layer first, then define the helmet layer. Layers are defined according to this format:

[LAYER:<layer name>:<tile page id>:<x position>:<y position>:<color type>]
	[<layer condition(s)>]
  • layer name: The internal name of the layer. Does not need to be unique. No known function at this time, but using a descriptive label is recommended.
  • tile page identifier: The Internal ID of the image defined in the Tile Page.
  • x position: The x position of the graphic to be displayed in tiles counting from 0 (left→right).
  • y position: The y position of the graphic to be displayed in tiles counting from 0 (top→bottom).
  • LARGE_IMAGE:x1:y1:x2:y2: (optional) Allows a multiple tile image to be displayed. Replaces <x position>:<y position>.
  • color type: (optional) Uncertain function, frequently replaced with AS_IS in vanilla RAWs. ColorTypeEnum[2]
  • layer condition(s): One or more conditional tokens that define under what conditions the layer is displayed and how it interacts with other layers.

Portraits[edit]

96x96 portraitsv50.13 are shown in Adventure mode and when viewing a creature's sheet. They use the same tokens as layered graphics to display a more detailed view of a creature.

A single-layer portrait can be added to a [CREATURE_GRAPHICS] entry with this format:

 [LAYER_SET:PORTRAIT]
    [LAYER_GROUP]
    [LAYER:MAIN:<tile page id>:<x position>:<y position>]
    [END_LAYER_GROUP]

See above for the explanation of each argument.

Procedural Creature Graphics[edit]

Procedural graphics define layered graphics based on which body parts are present in each procedurally-generated forgotten beast, titan, or otherwise.

   [TILE_GRAPHICS_RECTANGLE:<tile page id>:<x>:<y>:<width>:<height>:<PCG layering token>]
  • tile page identifier: Internal ID of the image defined in Tile Page.
  • x: The x position of the upper left tile counting from 0 from the left of the tile page.
  • y: The y position of the upper left tile counting from 0 from the top of the tile page.
  • width: How many tiles right the graphic spans. Usually this is 3.
  • height: How many tiles down the graphic spans. Usually this is 2.
  • PCG layering token: The internal ID of a procedural graphics layer, representing generated forgotten beast body types and body parts.

The TILE_GRAPHICS_RECTANGLE token displays a large image with the upper left corner being defined by <x>, <y> and the size defined by <width>, <height>. The PCG layering token is a conditional token that causes the graphics for each layer to be displayed only when the forgotten beast has that particular body type or part.

Humanoid experiments use TILE_GRAPHICS instead of TILE_GRAPHICS_RECTANGLE, which omits the <width> and <height> parameters.

The [PROCEDURAL_CREATURE_GRAPHICS] token allows a creature to use the generation system for a given sprite type (which can be caste-specific), and each [PCG_LAYERING] entry will add that part to the assembled sprite.

Item Graphics[edit]

Item graphics can also be defined, but are mostly hardcoded. This section of the wiki needs to be fleshed out.

Workshop Graphics[edit]

Workshop graphics are displayed during each stage of construction and when it is completed. There are two layers, the base layer and an OVERLAY layer. The base layer shows the floor, tables, chairs and other basic features. The overlay shows various decorations that give the workshop its unique appearance.

base layer:

   [TILE_GRAPHICS:<tile page identifier>:<graphic tile x position>:<graphic tile y position>:WORKSHOP_CUSTOM:<workshop id>:<building stage>:<workshop tile x position>:<workshop tile y position>]

overlay layer:

   [TILE_GRAPHICS:<tile page identifier>:<graphic tile x position>:<graphic tile y position>:WORKSHOP_CUSTOM_OVERLAY:<workshop id>:<building stage>:<workshop tile x position>:<workshop tile y position>]
  • tile page identifier: The Internal ID of the image defined in the Tile Page.
  • graphic tile x position: The x position of the graphic in tiles counting from 0 (left→right).
  • graphic tile y position: The y position of the graphic in tiles counting from 0 (top→bottom).
  • WORKSHOP_CUSTOM and WORKSHOP_CUSTOM_OVERLAY: These tokens define the graphics as belonging to a custom workshop. These tokens do not exist in vanilla workshops except for the Soap maker and Screw press, which are used as examples for custom workshops.
  • workshop id: The ID of the workshop defined in its raws.
  • building stage: What building stage this graphic is displayed during.
  • workshop tile x position: The x position of the workshop tile where the graphic is displayed counting from 0 (left→right).
  • workshop tile y position: The y position of the workshop tile where the graphic is displayed counting from 0(top→bottom).

Note that an extra Y row is defined above the workshop. This allows for graphics that extend into the tile above the workshop.

Also note that currently custom furnaces do not properly work with premium graphics. The WORKSHOP_CUSTOM and WORKSHOP_CUSTOM_OVERLAY tokens ONLY work with custom workshops. If used with a custom furnace they give an error and the graphics will not appear in game. Custom furnaces can still be made to use graphics if they are defined as workshops in their raws.

These values can be validated by checking the RAW vanilla file [DF Installion]\data\vanilla\vanilla_buildings_graphics\graphics\graphics_workshops.txt


World Map Graphics[edit]

World map graphics come in two variations:

   [TILE_GRAPHICS:<tile page identifier>:<x position>:<y position>:<graphic id>]
   [TILE_GRAPHICS:<tile page identifier>:<x position>:<y position>:<graphic id>:<variation {1 - 5}>]
  • tile page identifier: The Internal ID of the image defined in the Tile Page.
  • x position: The x position of the graphic to be displayed in tiles counting from 0 (left→right).
  • y position: The y position of the graphic to be displayed in tiles counting from 0 (top→bottom).
  • graphic id: The Graphic Token of the world map tile the graphics represent.
  • variation {1 - 5}: For Graphic IDs that allow variants.

These values can be validated by checking the RAW vanilla file [DF Installion]\data\vanilla\vanilla_world_map\graphics\graphics_world_map.txt

Palettes[edit]

Palettes v50.png

Palettes are used by graphics to render colorized objects. This is usually based on material colors, though arbitrary palettesv50.13 can be created and applied with [USE_PALETTE].

   [PALETTE:<palette identifier>]
       [FILE:images/imagename.png]
       [PALETTE_DEFAULT:<row>] this is the one used in the images themselves
       [PALETTE_COLOR:<color>:<row>]
  • name: The Internal ID being created for the image. DEFAULT is used by most objects and requires a PALETTE_COLOR entry for each raw-defined color that exists.
  • imagename.png: The file name of the 8bit RGBA (sometimes called 32bit) in the \graphics\images folder of the mod.
  • row: The y position of the graphic to be displayed in pixels counting from 0 (top→bottom). It is customary to place the default palette at 0.
  • color: A color token.

Each row of the vanilla palettes.png file is a palette. The PALETTE_DEFAULT row is the row of colors (aka palette) used to in the internal graphics (which are loaded by a tile page) and get replaced by the colors of one of the other rows as specified in the palette_default.txt file. It isn't shown in-game, but the exact RGB values are replaced by the row specified by [PALETTE_COLOR] or [USE_PALETTE]. Each palette supports up to 18 colors.

Classic Graphics[edit]

For a list of all tile characters used in DF, see Tilesets.
For a chart with the default ASCII characters, see Character table.
For user-created creature tilesets, see Tileset repository.
For information about Graphic sets, see Graphic set.
For information on how tilesets get colored, see color.

General Information[edit]

Although commonly referred to as text or "ASCII"-graphics, classic DF uses a bitmap tileset* with characters from the IBM Code Page 437, displayed with a foreground and background color picked from 16 predefined colors. Text files (and often hardcoded values) define the tile, and colors of all objects. Both color scheme and tileset can be changed (see below), and definitions that are in text files can be modified. In addition, interface text can be displayed with a TrueType font and creatures (which normally are displayed as letters) can be assigned to separate tilesets called graphic sets. The main tileset is sometimes called "character tileset", while the graphic sets are also referred to as "object tilesets".

*except when using PRINT_MODE:TEXT

Tileset[edit]

Main article: Tilesets

The main tileset (also called 'character set' or just 'tileset') is an image in BMP or PNG format that contains the 256 different tiles, corresponding to the IBM Code Page 437, which are used to display all objects, creatures, and UI elements in game. The tiles are always arranged in a 16x16 grid, but its dimensions can be varied. You can have both square and non-square tiles, with 16x16 pixels being the most common size. Creatures are displayed as colored letters (a white 'B' is a polar bear, a brown 'd' a dog, and a grey 'c' is a cat).

As the tileset is limited to only 256 tiles, some objects share the same tile. Most notably, even with upper and lower case letters and 16 colors, a lot of creatures still look identical (goblin, goat, various gibbons, gremlin, goose, etc.). The tile for bins, up/down stairs and the cursor are the same; bags use the same tile as the symbol for "male"; and the "female" symbol shares a graphic with amulets. Roads and large rivers on the world map, minecart tracks and walls all share the same tiles as well.

Some of those can be changed in the raws and init files, and creatures can have separate graphics, but in most cases they are hardcoded.

That also can be used to categorize custom tilesets: Those that are made for and come bundled with modified raws/init files, and those that are made for and work with the default raws. Usually, the latter are more symbolic, or 'ASCII-like', while the former are often more pictographic, detailed or "pixel-arty". These sometimes are also bundled with their own creature graphics. Tilesets that are made for default raws have the advantage that you can use them immediately without any work for any new version that is released. With modified raws, you need to manually edit the new raws again, or wait for the maintainer to do that.

Graphic set[edit]

Main article: Graphic set

Graphic sets are additional tilesets used to give objects different graphics. As opposed to the main tileset, any number of tiles can be arranged in any grid configuration. Currently, DF only supports graphic sets for creatures. Every graphic set needs a corresponding text file that assigns a tile to a creature.

Color[edit]

Main article: Color

In general, a tileset has white tiles with a transparent background. White pixels show the foreground color, transparent pixels (magenta pixels for .bmp) the background color. Black pixels remain black. Shades of grey, partial transparency and even colored tiles can be used for various effects. Additionally, creature graphics can be set to be displayed in the colors they're drawn in.

Otherwise, the game selects from 16 colors (the color scheme) to decide the color: which of the 16 colors the game uses depends on the color value or color token of the material/item.


Installation[edit]

Further information: Mod, Tilesets, Graphic set, and Color scheme

Repositories[edit]

Users of the Steam version can subscribe to mods on Steam Workshop. The wiki has repositories for tilesets, graphic sets, and color schemes. You will find more in the bay 12 graphics subforum and on DFFD. Some graphic sets and tilesets are additionally maintained on github. Often, tileset creators offer preinstalled downloads or folders you just have to drop into your DF folder and overwrite files when prompted. They usually come with installation instructions either in a readme file or in their respective forum thread. In addition, there are various launcher applications that let you install and change graphics automatically.

For manual installation of the various components, see here:

Tileset[edit]

Put the tileset you want to use into the data/art/ folder. Open up init.txt (in data/init/) with a text editor and change the entries FONT, FULLFONT, GRAPHICS_FONT, and GRAPHICS_FULLFONT to the filename of your new tileset.

Creature Graphics[edit]

Put the graphic set into a subfolder in raw/graphics and the corresponding text file directly in raw/graphics. If you have an active save you will have to put them into the raw folder of your save as well (data/save/<your region>/raw/graphics). Finally, set GRAPHICS to YES in data/init/init.txt

Color Scheme[edit]

Replace colors.txt in data/init with your new colors.

True Type Font[edit]

Replace font.ttf in data/art with your new font.


See Also[edit]