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