<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wesnoth.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bvanevery</id>
	<title>The Battle for Wesnoth Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wesnoth.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bvanevery"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/Special:Contributions/Bvanevery"/>
	<updated>2026-11-18T11:56:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=40361</id>
		<title>TerrainGraphicsWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=TerrainGraphicsWML&amp;diff=40361"/>
		<updated>2011-02-23T22:12:00Z</updated>

		<summary type="html">&lt;p&gt;Bvanevery: .png is incompatible between 1.8.x and 1.9.x&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
&lt;br /&gt;
{{Needs update}}&lt;br /&gt;
&lt;br /&gt;
== The toplevel [terrain_graphics] tag ==&lt;br /&gt;
&lt;br /&gt;
For information about the multi-hex tiling system, see [[MultiHexTutorial]]&lt;br /&gt;
&lt;br /&gt;
In terrain graphics, in Wesnoth 1.8.x all images are assumed to be .png and relative to images/terrain/. For example, writing &#039;image=grassland&#039; means that the image file is images/terrain/grassland.png.  In Wesnoth 1.9.x the .png extension is required.  This means that TerrainGraphicsWML is incompatible from 1.8.x to 1.9.x.&lt;br /&gt;
&lt;br /&gt;
The multi-hex tiling system adds a new top-level element to WML, [terrain_graphics].&lt;br /&gt;
A building rule is used to specify images to place when terrains are in a certain formation.&lt;br /&gt;
When a building rule is applied to a map, it is applied once to each coordinate on the map;&lt;br /&gt;
when it is applied to a coordinate then that coordinate is considered the &#039;&#039;base&#039;&#039;.&lt;br /&gt;
All locations in &#039;&#039;&#039;[terrain_graphics]&#039;&#039;&#039; are relative to the base.&lt;br /&gt;
&lt;br /&gt;
The following keys/tags are recognized:&lt;br /&gt;
* &#039;&#039;&#039;[tile]&#039;&#039;&#039;: whenever a building rule is applied, each [tile] tag corresponds to a tile on the map. The corresponding tile must match each condition contained in [tile] for the [tile] tag to match. All [tile] tags must match in order for a rule to match. If the rule for a [tile] tag is applied, each action within [tile] will be executed on the tile corresponding to that [tile] tag&lt;br /&gt;
** &#039;&#039;&#039;x&#039;&#039;&#039;,&#039;&#039;&#039;y&#039;&#039;&#039;: standard coordinates - the location of the corresponding tile relative to the base.&lt;br /&gt;
** &#039;&#039;&#039;pos&#039;&#039;&#039;: a shortcut to specifying coordinates. Used in combination with &#039;&#039;map&#039;&#039;&lt;br /&gt;
** &#039;&#039;&#039;type&#039;&#039;&#039;: a comma-separated list of terrain codes (See [[TerrainWML]], data/terrain.cfg). In order for a tile to match this condition, it must be one of the terrains specified. However, if the string is preceded by &amp;quot;!&amp;quot;, the terrain must not be listed in order to match. If the string is &#039;*&#039;, or if it is empty, any tile matches.&lt;br /&gt;
** &#039;&#039;&#039;set_flag&#039;&#039;&#039;: a comma-separated list of strings. Attaches flags from that list to the corresponding tile if the rule matches. The only difference a flag makes is being detected by &#039;&#039;has_flag&#039;&#039; and &#039;&#039;no_flag&#039;&#039; in [tile]. This is determined by the order of the [terrain_graphics] tags; a tag after another one cannot influence it. See also &#039;&#039;has_flag&#039;&#039;, &#039;&#039;no_flag&#039;&#039;&lt;br /&gt;
** &#039;&#039;&#039;has_flag&#039;&#039;&#039;: a comma-separated list of strings. Matches if all flags in that list are attached to the corresponding tile. Flags are attached using the &#039;&#039;set_flag&#039;&#039; key.&lt;br /&gt;
** &#039;&#039;&#039;no_flag&#039;&#039;&#039;: a comma-separated list of strings. Matches if none of the flags in that list are attached to the corresponding tile. Flags are attached using the &#039;&#039;set_flag&#039;&#039; key.&lt;br /&gt;
** &#039;&#039;&#039;set_no_flag&#039;&#039;&#039;: {{DevFeature1.9}} helper combining &#039;&#039;set_flag&#039;&#039; and &#039;&#039;no_flag&#039;&#039;. Same effect as using them with the same flags. Added because it&#039;s the most common use; &#039;&#039;set_flag&#039;&#039; or &#039;&#039;no_flag&#039;&#039; can still be used to add flags in one group only. &lt;br /&gt;
** &#039;&#039;&#039;[image]&#039;&#039;&#039;: images specified as a subtag to &#039;&#039;&#039;[tile]&#039;&#039;&#039; sets the images for a single tile.&lt;br /&gt;
*** &#039;&#039;&#039;layer&#039;&#039;&#039;: an integer, usually negative. The more negative it is, the earlier it is drawn, and thus the farther &amp;quot;back&amp;quot; it is when compositing the terrain images together.&lt;br /&gt;
*** &#039;&#039;&#039;name&#039;&#039;&#039;: the image to apply on this tile if appropriate&lt;br /&gt;
*** &#039;&#039;&#039;base&#039;&#039;&#039;: specifies the point at which the image is considered to be for layering purposes.  &#039;&#039;base&#039;&#039; is specified as &#039;&#039;&#039;x,y&#039;&#039;&#039; where x and y indicate distances in pixels from the top-left corner of the &#039;&#039;&#039;image&#039;&#039;&#039;. This is translated to a certain pixel on the map, and all images with the &#039;&#039;base&#039;&#039; attribute are drawn from top-to-bottom in terms of these specified pixel positions &#039;&#039;&#039;on the map&#039;&#039;&#039;.&lt;br /&gt;
*** &#039;&#039;&#039;[variant]&#039;&#039;&#039;: an alternate image to use for differing times of day&lt;br /&gt;
**** &#039;&#039;&#039;tod&#039;&#039;&#039;: the time of day for which this variant applies. {{DevFeature1.9}} Accepts a comma separated list of times of day.&lt;br /&gt;
**** &#039;&#039;&#039;name&#039;&#039;&#039;: the image to apply on this tile if appropriate&lt;br /&gt;
* &#039;&#039;&#039;[image]&#039;&#039;&#039;: image may also be used directly in the rule, to specify multihex images.&lt;br /&gt;
* &#039;&#039;&#039;probability&#039;&#039;&#039;: the percent probability for each position that if the position matches, then the rule will be applied. Default is 100(%).  See [[TerrainGraphicsTutorial#Cumulative_Probabilities|Cumulative_Probabilities]] for mathematical complications.&lt;br /&gt;
* &#039;&#039;&#039;rotations&#039;&#039;&#039;: 6 comma(&#039;&#039;&#039;,&#039;&#039;&#039;) separated input strings. A rule that contains this key is not actually checked against the terrain; it instead is used as a template to create 6 new rules, each corresponding to a rotated version of the current rule. Whenever a rotated version is applied, instances of @(at-sign)R0, @R1, ... @R6 in attributes in the [terrain_graphics] tag will be adjusted by the corresponding amount and replaced with the letters specified by that numbered rotation in the &#039;&#039;rotations&#039;&#039; list. Each value corresponds to the rotated version that is -Pi/3 (60° clockwise) from the previous version; the first value corresponds to the unrotated version.&amp;lt;br&amp;gt;For example, if &#039;&#039;&#039;rotations=n,ne,se,s,sw,nw&#039;&#039;&#039; and it is being rotated 120°, then &amp;quot;@R0&amp;quot;-&amp;gt;&amp;quot;@R2&amp;quot;-&amp;gt;&amp;quot;se&amp;quot;, &amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;@R3&amp;quot;-&amp;gt;&amp;quot;s&amp;quot;, ... &amp;quot;@R6&amp;quot;-&amp;gt;&amp;quot;@R1&amp;quot;-&amp;gt;&amp;quot;ne&amp;quot;.&amp;lt;br&amp;gt;Basically the important thing is that this lets the rule be applied in any of the six hex-directions, allowing you to adjust the name of the image files automatically.&lt;br /&gt;
* &#039;&#039;&#039;set_flag&#039;&#039;&#039;,&#039;&#039;&#039;has_flag&#039;&#039;&#039;, &#039;&#039;&#039;no_flag&#039;&#039;&#039;: shortcuts to putting these in the [tile] subtags; unbound attributes will apply to all [tile] subtags.&lt;br /&gt;
* &#039;&#039;&#039;map&#039;&#039;&#039;: a shortcut for defining [tile] tags with &#039;&#039;type&#039;&#039; conditions. Inputs a multi-line string value visually describing the map. The lines are cut into words of 4 characters, which correspond to [tile] tags. The line types alternate between lines corresponding to relatively even-abciss tiles and lines preceded by two spaces corresponding to relatively odd-abciss tiles. Every two lines represent 1 row on the map.&lt;br /&gt;
&lt;br /&gt;
=== Words ===&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;word&#039;&#039; is a 4-character shortcut to a [tile] tag. There are different types of words:&lt;br /&gt;
* Usually a word is interpreted as being the input to the &#039;&#039;type&#039;&#039; key of the corresponding [tile]. That is, it creates a [tile] with the attribute &#039;&#039;&#039;type=&#039;&#039;word&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
* A word can also be a digit followed by 3 spaces. In this case, it is a shortcut to the [tile] with the attribute &#039;&#039;&#039;pos=&#039;&#039;word&#039;&#039;&#039;&#039;&#039;. This is called &#039;&#039;anchoring&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In 1.3, the format is basically the same but the following changes are made&lt;br /&gt;
* A &#039;&#039;word&#039;&#039; no longer needs to be 4 characters but is comma separated and spaces and tabs may be used for padding&lt;br /&gt;
* The 2 spaces for odd lines in no longer used, instead a leading comma is used on these lines (before the comma spaces and tabs are allowed for padding)&lt;br /&gt;
* A &#039;&#039;word&#039;&#039; may only be a dot a star or an anchor. The terrain letter format was not used and hard to support in the new engine, so that support is dropped.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
To define a north-south 2-tile mountain, the following syntax can be used:&lt;br /&gt;
&lt;br /&gt;
 [terrain_graphics]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=0&lt;br /&gt;
         type=Mm&lt;br /&gt;
     [/tile]&lt;br /&gt;
     [tile]&lt;br /&gt;
         x=0&lt;br /&gt;
         y=1&lt;br /&gt;
         type=Mm&lt;br /&gt;
     [/tile]&lt;br /&gt;
     no_flag=&amp;quot;mountain-tile&amp;quot;&lt;br /&gt;
     set_flag=&amp;quot;mountain-tile&amp;quot;&lt;br /&gt;
     image_background=&amp;quot;mountain-n-s&amp;quot;&lt;br /&gt;
 [/terrain_graphics]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This represents a tile T, and its 6 adjacent tiles A, in the map notation.&lt;br /&gt;
&lt;br /&gt;
 .,   .,   .,   .&lt;br /&gt;
 ,  .,   A,   .,   .&lt;br /&gt;
 .,   A,   A,   .&lt;br /&gt;
 ,  .,   T,   .,   .&lt;br /&gt;
 .,   A,   A,   .&lt;br /&gt;
 ,  .,   A,   .,   .&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[MultiHexTutorial]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
* Ayin&#039;s [http://www.anathas.org/ayin/wesnoth/doc/terrain_graphics_wml detailed Terrain Graphics document]&lt;br /&gt;
* [[TerrainGraphicsTutorial]] - First half of Ayin&#039;s document, wikified&lt;br /&gt;
* [[TerrainGraphicsReference]] - Second (partial) half of Ayin&#039;s document, wikified&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>Bvanevery</name></author>
	</entry>
</feed>