home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 September / PCWELT_9_2006.ISO / pcwsoft / Freeciv-2.0.8-win32-gtk2-setup.exe / doc / README.graphics < prev    next >
Encoding:
Text File  |  2005-10-13  |  20.4 KB  |  440 lines

  1. ----------------------------------------------------------------------
  2. Freeciv Graphics, and Tile Specification Files
  3. ----------------------------------------------------------------------
  4.  
  5. Using Graphics:
  6. ---------------
  7.  
  8. To use different graphics with Freeciv, use the '--tiles' argument to
  9. the Freeciv client.  Eg, to use the 'engels' graphics, start the
  10. client as:
  11.   
  12.     civclient --tiles engels
  13.  
  14. What Freeciv actually does in this case is look for a file called
  15. 'engels.tilespec' somewhere in your Freeciv data path.  (See the file
  16. INSTALL for some information on the Freeciv data path.)  That tilespec
  17. file contains information telling Freeciv which graphics files to use,
  18. and what those graphics files contain.
  19.  
  20. That is all you need to know to use alternative graphics provided by
  21. Freeciv or by third-party add-ons.  The rest of this file describes
  22. (though not fully) the contents of the tilespec file and related
  23. files.  This is intended as developer reference, and for people
  24. wanting to create/compile alternative tilesets and modpacks for
  25. Freeciv.
  26.  
  27. ----------------------------------------------------------------------
  28. Overview:
  29. ---------
  30.  
  31. The purpose of the 'tilespec' file and related 'spec' files is to
  32. allow the detailed layout of the graphics within the files to be
  33. flexible and not hard-coded into Freeciv, and to allow add-ons to
  34. conveniently provide additional graphics.
  35.  
  36. There are two layers to the tilespec files:
  37.  
  38. The top-level file is named, eg: 'trident.tilespec'.  The basename of
  39. this file (here, 'trident') corresponds to the parameter of the
  40. '--tiles' command-line argument for the Freeciv client, as described
  41. above.
  42.  
  43. The top-level tilespec file contains general information on the full
  44. tileset, and a list of files which specify information about the
  45. individual graphics files.  These filenames must be located somewhere
  46. in the data path, though not necessarily the same place as the
  47. top-level tilespec file.  Note that with this system the number and
  48. contents of the referenced files are completely flexible at this
  49. level.
  50.  
  51. An exception is that the intro graphics must be in individual files,
  52. as listed in the tilespec file, because Freeciv treats these
  53. specially: these graphics are freed after the game starts, and
  54. reloaded later as necessary.
  55.  
  56. ----------------------------------------------------------------------
  57. Graphics formats:
  58. -----------------
  59.  
  60. Different clients support different graphics formats.  All of them should
  61. support PNG, however, so this is what you should use.  The XAW client
  62. currently only supports indexed PNGs.
  63.  
  64. Using GIMP, you can use the following steps to convert an image to an
  65. indexed PNG:
  66.  
  67.   * Choose the menu entry "Image" -> "Mode" -> "Indexed" (alt-I).
  68.   * Choose the "Generate Optimal Palette" option, with no color dithering.
  69.   * Accept these options.
  70.   * Choose the menu entry "File" -> "Save As..."
  71.   * Save the file as xxx.png.
  72.   * I recommend choosing a high level of compression.
  73.  
  74. ----------------------------------------------------------------------
  75. Tileset options:
  76. ----------------
  77.  
  78. In the top-level tilespec file you can set options for the tileset.
  79. Each of these should go within the [tilespec] section. Currently
  80. options include:
  81.  
  82.   Strings (enclosed in "")
  83.   ------------------------
  84.   options               : A capability string, currently "+tilespec3"
  85.   name                  : the name of the tileset
  86.   city_names_font       : an X font string
  87.   city_productions_font : an X font string
  88.   main_intro_file       : GFX file for the intro graphics
  89.   minimap_intro_file    : GFX file for the radar screen intro graphics
  90.  
  91.   Integers
  92.   --------
  93.   normal_tile_width     : the width of terrain tiles
  94.   normal_tile_height    : the height of terrain tiles
  95.   small_tile_width      : the width of icon sprites
  96.   small_tile_height     : the height of icon sprites
  97.   roadstyle             : Specifies how roads and rail are drawn.
  98.                           0 : A single sprite is drawn for every connection
  99.                               the tile has; only 8 sprites are needed.
  100.                           1 : A single sprite is drawn for all cardinal
  101.                               connections and a second sprite is drawn
  102.                               for all diagonal connections; 32 sprites are
  103.                               needed.
  104.                           2 : One sprite is drawn to show roads in all
  105.                               directions.  There are thus 256 road and 256
  106.                               rail sprites (64 for a hex tileset).
  107.   fogstyle              : Specifies how fog is drawn.
  108.                           0 : A single fog sprite is drawn on top of all
  109.                               other sprites for fogged tiles.  The
  110.                               tx.fog sprite is used for this.
  111.                           1 : Each sprite for a fogged tile is drawn fogged.
  112.                               The tx.fog sprite may be used for the fog
  113.                               drawing (but clipped by the mask of the
  114.                               underlying sprite).
  115.   darkness_style        : Specifies how "encroaching darkness" is drawn.
  116.                           0 : No darkness.
  117.                           1 : A single sprite can be split into 4 parts, each
  118.                               containing the darkness for that particular
  119.                               cardinal direction.  (Iso-view only.)
  120.                           2 : Four different sprites exist, each holding the
  121.                               darkness for a particular direction.  Any or all
  122.                               of the sprites may be drawn.
  123.                           3 : The sprite is chosen based on the vector sum of
  124.                               the darkness in all 4 cardinal directions.  15
  125.                               different sprites are needed.
  126.   flag_offset_x        : Gives an offset from the tile origin at which to
  127.   flag_offset_y          draw flags behind units and cities.  With isometric
  128.                          tilesets this should be non-zero so that the flag
  129.                          is placed correctly behind the unit/city.
  130.   hex_side             : When is_hex is specified (see is_hex, below), this
  131.                          value gives the length of the "extra" side of the
  132.                          hexagon.  This extra side will be on the top/bottom
  133.                          of the tile if is_isometric (below) is given, or
  134.                          on the left/right of the tile otherwise.  The actual
  135.                          dimensions of the hex tile are determined from the
  136.                          normal_tile_width/normal_tile_height of the tileset
  137.                          as well as the hex side.  The "normal" dimensions
  138.                          give the X and Y offsets between adjacent tiles in
  139.                          the tileset - this is not the same as the dimensions
  140.                          of the tile itself.  The dimension of the bounding
  141.                          box of the hexagonal tile will be equal to the
  142.                          "normal" dimension minus the hex_side.  For instance
  143.                          "normal" dimensions of 64x32 with a hex_side of 16
  144.                          for an iso-hex tileset will give hexagons of size
  145.                          48x32.
  146.  
  147.   Booleans (0 or 1)
  148.   -----------------
  149.   is_isometric          : set to 1 for an iso-view tileset
  150.   is_hex                : set to 1 for a hexagonal tileset.  If is_isometric
  151.                           is also specified then you have an iso-hex tileset.
  152.                           Hex tilesets should be used with topologies 8-11 and
  153.                           iso-hex tilesets with topologies 12-15.
  154.  
  155.   String lists (a comma-separated list of strings)
  156.   ------------------------------------------------
  157.   files                 : A list of .spec files to scan for sprites.
  158.                           See "individual spec files", below.
  159.  
  160.  
  161. ----------------------------------------------------------------------
  162. Terrain options:
  163. ----------------
  164.  
  165. The top-level tilespec file also contains information on how to draw each
  166. terrain type.  For each terrain type include a section "terrain_<terrain>"
  167. (e.g., "terrain_plains").  This section contains information on how to draw
  168. this terrain type.  (The terrain types are specified in the server ruleset
  169. file under the graphc and graphic_alt flags.)
  170.  
  171.   [terrain_XXX] options
  172.   ----------------
  173.   is_blended            : If set, this terrain will be blended with adjacent
  174.                           terrains.  Blending is done civ2-style with a
  175.                           dither mask.  Only iso-view currently supports
  176.                           blending.  Only the base graphic will be blended.
  177.                           Blending is drawn on top of the first layer (see
  178.                           below).
  179.                           The blending mask has sprite t.dither_tile.
  180.   num_layers            : The number of layers in the terrain.  This value
  181.                           must be either 1 or 2.  Each layer is drawn
  182.                           separately.  The layerN options below control the
  183.                           drawing of each layer (N should be either 0 or 1).
  184.   layerN_match_type     : If 0 or unset, no terrain matching will be done and
  185.                           the base sprite will be drawn for the terrain.  If
  186.                           non-zero, then terrain matching will be done.  A
  187.                           matched sprite will be chosen that matches all
  188.                           cardinally adjacent tiles whose terrain has the same
  189.                           match_type.
  190.   layerN_match_style    : A string telling how matching is to be done for
  191.                           this layer.
  192.                           "none" : No matching is to be done.
  193.                           "bool" : Matching is done based only on whether the
  194.                                    adjacent tile has the same match type.
  195.                           "full" : Matching is done against all possible
  196.                                    match types of adjacent tiles.
  197.   layerN_cell_type      : With traditional tilesets each tile is drawn using
  198.                           one sprite.  Which sprite to use may be specified
  199.                           using a match_type, and there may be multiple layers
  200.                           (each having one sprite).  This method corresponds
  201.                           to cell_type "single".  A more sophisticated drawing
  202.                           method breaks the tile up into 4 rectangles.  Each
  203.                           rectangular cell is adjacent to 3 different tiles.
  204.                           Each adjacency is matched, giving 8 different sprites
  205.                           for each of the 4 cells.
  206.  
  207. Additionally the top-level tilespec file should contain information about
  208. the drawing of each layer.  This is needed because the way each layer is
  209. drawn must be consistent between different terrain types.  As an example you
  210. can mix boolean and no matching but you cannot mix full and boolean matching.
  211. You may not have more than 2 layers (either in this section or in the
  212. [terrain_XXX] sections).
  213.  
  214.   [layerN] options
  215.   ----------------
  216.   match_style            : Gives the match style for this layer.
  217.                            "none" : no matching
  218.                            "bool" : terrains may use "none" or "bool" for
  219.                                     matching
  220.                            "full" : terrains may only use "full" matching
  221.   match_types            : Gives a string list of all different match types.
  222.                            This list must include every possible match_type
  223.                            used by terrains for this layer.
  224.  
  225. ----------------------------------------------------------------------
  226. Individual spec files:
  227. ----------------------
  228.  
  229. Each spec file describes one graphics file (PNG format is standard,
  230. although some clients may accept other formats as well) as specified in
  231. the spec file.  The graphics file must be in the Freeciv data path, but
  232. not necessarily in the same location as the spec file.  Note you can have
  233. multiple spec files using a single graphics file in different ways.
  234.  
  235. The main data described in the spec file is in sections named
  236. [grid_*], where * is some arbitrary tag (but unique within each file).
  237. A grid corresponds to a regular rectangular array of tiles.  In
  238. general one may have multiple grids in one file, but the default
  239. tilesets usually only have one per file.  (Multiple grids would be
  240. useful to have different size tiles in the same file.)  Each grid
  241. defines an origin (top left) and spacing, both in terms of pixels, and
  242. then refers to individual tiles of the grid by row and column.  The
  243. origin, and rows and columns, are counted as (0,0) = top left.
  244.  
  245. Each individual tile is given a "tag", which is a string which is
  246. referenced in the code and/or from ruleset files.  A grid may be
  247. sparse, with some elements unused (simply don't mention their row and
  248. column), and a single tile may have multiple tags (eg, to use the same
  249. graphic for multiple purposes in the game): just specify a list of
  250. comma-separated strings.
  251.  
  252. If a given tag appears multiple times in the spec files, the *last*
  253. such tag is used.  (That is, in the order of files listed in the
  254. tilespec file, and order within each file.)  This allows selected
  255. graphics to be "overridden" by listing a replacement spec file near
  256. the end of the 'files' list in the toplevel tilespec file, without
  257. having to modify earlier files in the list.
  258.  
  259. ----------------------------------------------------------------------
  260. Tag prefixes:
  261. -------------
  262.  
  263. To help keep the tags organised, there is a rough prefix system used 
  264. for standard tags:
  265.  
  266.   f.          national flags
  267.   r.          road/rail
  268.   s.          general "small"
  269.   u.          unit images
  270.   t.          basic terrain types (with _n0s0e0w0 to _n1s1e1w1)
  271.   ts.          terrain special resources
  272.   tx.          extra terrain-related
  273.   gov.          government types
  274.   unit.          unit overlays: hp, stack, activities (goto, fortify etc)
  275.   upkeep.     unit upkeep and unhappiness
  276.   city.          city related (city, size, sq.-prod., disorder, occupied)
  277.   cd.          city defaults
  278.   citizen.    citizens, including specialists
  279.   explode.    explosion graphics (nuke, units)
  280.   spaceship.  spaceship components
  281.   treaty.     treaty thumbs
  282.   user.          crosshairs (in general: user interface?)
  283.  
  284. In general, graphics tags hard-wired into Freeciv _must_ be provided
  285. by the spec files, or the client will refuse to start.  Graphics tags
  286. provided by ruleset files (at least for the "standard" rulesets)
  287. should also be provided, but generally the client will continue even
  288. if they are not, though the results may not be satisfactory for the
  289. user.  To work properly tags should correspond to appropriately sized
  290. graphics.  (The basic size may vary, as specified in the top-level
  291. tilespec file, but the individual tiles should be consistent with
  292. those sizes and/or the usage of those graphics.)
  293.  
  294. ----------------------------------------------------------------------
  295. Sprites
  296. -------
  297.  
  298. Depending on the information given here the tileset must/may contain certain
  299. sprites.
  300.  
  301.   Theme Sprites
  302.   -------------
  303.  
  304.   citizen sprites :
  305.  
  306.     This provides citizen graphics.  Each citizen has one or more sprites
  307.     which are shown in the city dialog.  The types of citizen are "happy",
  308.     "content", "unhappy", and "angry".  The tag name is "citizen.<type>_<n>".
  309.     <type> is one of the listed types. <n> is the number of the graphic
  310.     (numbered starting with 0, unlike most other graphics) which allows more
  311.     than one sprite to be used.  No more than 6 sprites per citizen may be
  312.     used.
  313.  
  314.     Currently the citizen and specialist sprites may not have any
  315.     transparency, as this is ignored in much of the drawing.  This is
  316.     considered a bug.
  317.  
  318.   specialist sprites:
  319.  
  320.     These provide specialist graphics just like the citizen graphics.  However
  321.     specialist types come from the ruleset and may be changed in modpacks.
  322.     The sprite name is "specialist.<type>_<n>".  Again <type> is the
  323.     type of specialist (currently "elvis", "scientist", "taxman") while <n>
  324.     is the sprite number.  See "citizen sprites" above.
  325.  
  326.   progress indicators:
  327.  
  328.     There are three types of progress indicator.  "science_bulb" indicates
  329.     progress toward the current research target.  "warming_sun" indicates 
  330.     progress toward global warming.  "cooling_flake" indicates progress
  331.     toward nuclear winter.  Each indicator should have 8 states, numbered
  332.     0 (least) through 7 (most).  The sprite names are "s.<type>_<n>".
  333.  
  334.   government icons:
  335.  
  336.     There should be one icon for each government.  Its name is "gov.<gov>",
  337.     where <gov> is the government name.  Government types come from
  338.     governments.ruleset (currently "anarchy", "despotism", "monarchy",
  339.     "communism", "fundamentalism", "republic", "democracy").
  340.  
  341.   tax icons:
  342.  
  343.     One icon for each tax type.  These are used to show the tax rates.  The
  344.     sprites are "s.tax_luxury", "s.tax_science", "s.tax_gold".  Commonly
  345.     the specialist sprites are reused for this.
  346.  
  347.   right arrow:
  348.  
  349.     A sprite "s.right_arrow" is used on the panel when more units are
  350.     present than can be shown.
  351.  
  352.   Terrain sprites
  353.   ---------------
  354.   base sprite           : If the terrain has no match type or is layered, a
  355.                           base sprite is needed.  This sprite has tag
  356.                           "t.<terrain>1" (e.g., "t.grassland1").  More than
  357.                           one such sprite may be given ("t.grassland2", etc.)
  358.                           in which case one will be chosen at random for each
  359.                           tile.
  360.   matched sprites       : If the terrain has a match type or is layered, a
  361.                           set of matched sprites is needed.  This consists of
  362.                           16 sprites with tags "t.<terrain>_n<V>e<V>s<V>w<V>"
  363.                           (e.g., "t.hills_n0e0s1w0".  Each direcional value
  364.                           <V> is either 0 or 1.  Note that the directions are
  365.                           in map coordinates, so n (north) in iso-view is
  366.                           northeast on the mapview.  (Note this only applies
  367.                           for cell_type "single".)
  368.   cell sprites          : For matched terrains that have cell_type "rect",
  369.                           32 different sprites are needed.  Each sprite is
  370.                           a rectangle corresponding to one cell, and there are
  371.                           8 different sprites per cell.  Each sprite has
  372.                           a name like "t.ocean_cell_u110" where "ocean" is the
  373.                           terrain, "u" means up (north on the map) and
  374.                           110 indicates which of the adjacent tiles are
  375.                             mismatched.  For instance u110 means
  376.  
  377.                     /\
  378.                    /B \
  379.                   /\ 1/\
  380.                  / A\/C \
  381.                  \1 /\ 0/
  382.                   \/D \/
  383.                    \  /
  384.                     \/
  385.  
  386.               a matching terrain exists at C but not at A or B.  In
  387.                           this case D is the current tile.
  388.  
  389.   Examples:
  390.  
  391.     ; This specifies a civ2-like grassland tile.  A single sprite
  392.     ; t.grassland is needed; it will be drawn blended.
  393.     [terrain_grassland]
  394.     is_blended = 1
  395.     num_layers = 1
  396.     layer0_match_type = 0
  397.  
  398.     ; This specifies a civ1-like mountain tile.  16 sprites
  399.     ; t.mountains_n0s0e0w0 ... t.mountains_n1s1e1w1 are needed.  One of them
  400.     ; will be drawn to match the adjacent tiles.  Assuming only mountains
  401.     ; has this match_type, adjacent mountains will match.
  402.     [terrain_mountains]
  403.     is_blended = 0
  404.     num_layers = 1
  405.     layer0_match_type = 7
  406.  
  407.     ; This specifies a civ2-like hills tile.  A base sprite t.hills will be
  408.     ; needed, plus 16 matching sprites.  The base sprite will be drawn,
  409.     ; dithered with adjacent base sprites, and the matching sprite will be
  410.     ; drawn on top.  (In most civ2 tilesets the base sprite is the grassland
  411.     ; sprite).
  412.     [terrain_hills]
  413.     is_blended = 1
  414.     num_layers = 2
  415.     layer0_match_type = 0
  416.     layer1_match_type = 8
  417.  
  418.     ; This specifies a civ2-like ocean tile.  Ocean is drawn via a cell-based
  419.     ; system as explained above.
  420.     [terrain_ocean]
  421.     is_blended = 1
  422.     num_layers = 1
  423.     layer0_match_type = 6
  424.     layer0_cell_type = "rect"
  425.  
  426.   Terrain Special Sprites
  427.   -----------------------
  428.  
  429.   farmland/irrigation:
  430.  
  431.     tx.farmland and tx.irrigation provide the basic sprites for farmland
  432.     and irrigation.  Additionally, there is support for drawing continuous
  433.     farmland and irrigation (as is used in Civ3).  Here there are 16
  434.     irrigation sprites (and the same for farmland), starting with
  435.     tx.s_irrigation_n0s0e0w0 and running through tx.s_irrigation_n1s1e1w1.
  436.     An appropriate sprite will be chosen depending on which adjacent tiles
  437.     also have farmland/irrigation.  If any of these sprites are not present,
  438.     the default sprite will be used as a fallback.
  439.  
  440.