<?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=Pukeman12345</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=Pukeman12345"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/Special:Contributions/Pukeman12345"/>
	<updated>2026-04-12T04:29:15Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.16</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=CastleTutorial&amp;diff=14711</id>
		<title>CastleTutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=CastleTutorial&amp;diff=14711"/>
		<updated>2007-04-08T02:27:08Z</updated>

		<summary type="html">&lt;p&gt;Pukeman12345: /* The Simple Castle Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Building tileable castles - A tutorial ==&lt;br /&gt;
&lt;br /&gt;
== Introduction To Castles ==&lt;br /&gt;
&lt;br /&gt;
===Overview===&lt;br /&gt;
&lt;br /&gt;
Wesnoth terrain graphics system allows the WML designer to create various&lt;br /&gt;
terrain graphics &amp;quot;models&amp;quot;: rules that allow to determine how the different&lt;br /&gt;
terrain tiles will be displayed by the game. Those allow the terrain designer&lt;br /&gt;
to specify renderings that go beyond the simple &amp;quot;one terrain type = one image&amp;quot;&lt;br /&gt;
representation.&lt;br /&gt;
&lt;br /&gt;
One of those terrain models is the Castle (it will be called like that,&lt;br /&gt;
&amp;quot;Castle&amp;quot;, all along this document, although this model can be used for many&lt;br /&gt;
other terrain types, like, for example, caves.) Castles are created from two&lt;br /&gt;
type of elements: a castle floor, and a castle wall. Castle floors are normal,&lt;br /&gt;
basic tiles that are placed on each corresponding tile. As those really have&lt;br /&gt;
nothing special, they will not be detailed in this document. What we will&lt;br /&gt;
detail is how to build castle _walls_.&lt;br /&gt;
&lt;br /&gt;
===The Simple Castle Model===&lt;br /&gt;
&lt;br /&gt;
The Simple Castle Model is used to build castle walls, without keeps. Castle&lt;br /&gt;
walls are special transitions, that are drawn between Castle tiles, and&lt;br /&gt;
Non-Castle tiles. For example, imagine some castle tiles are disposed as shown&lt;br /&gt;
in figure (1); castle walls will then be drawn as shown in figure (2)&lt;br /&gt;
&lt;br /&gt;
''(figure 1)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure1.png&lt;br /&gt;
&lt;br /&gt;
''(figure 2)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure2.png&lt;br /&gt;
&lt;br /&gt;
Castle Walls are composed of 12 different images (as show in figure 3), that&lt;br /&gt;
tile together. Those are positioned at the corners of the castle border, as&lt;br /&gt;
shown in figure 4.&lt;br /&gt;
&amp;quot;convex&amp;quot; images are positioned at convex borders, &amp;quot;concave&amp;quot; images are&lt;br /&gt;
positioned at concave borders (as it hopefully might be expected.) When we talk&lt;br /&gt;
about &amp;quot;concave&amp;quot;, or &amp;quot;convex&amp;quot; borders, we always take the castle's interior&lt;br /&gt;
point of view.&lt;br /&gt;
&lt;br /&gt;
''(figure 3)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure3.png&lt;br /&gt;
&lt;br /&gt;
''(figure 4)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images[[Image:Example.jpg]][[Media:Example.ogg]][[Media:Example.ogg]][[Media:Example.ogg]]&amp;lt;nowiki&amp;gt;Insert non-formatted text here&amp;lt;/nowiki&amp;gt;--[[User:Pukeman12345|Pukeman12345]] 04:27, 8 April 2007 (CEST)--[[User:Pukeman12345|Pukeman12345]] 04:27, 8 April 2007 (CEST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
'''Bold text'''''Italic text''[[Link title]][http://www.example.com link title]&lt;br /&gt;
== Headline text ==&lt;br /&gt;
&lt;br /&gt;
===The Keep Model===&lt;br /&gt;
&lt;br /&gt;
The Keep Model is created to build the special transitions that are used to&lt;br /&gt;
build a wall around the Keep of a Castle. Keeps are assumed to be always&lt;br /&gt;
composed of one tile (isolated from any other keep tile.)&lt;br /&gt;
Keeps are a little more complex than castles walls: they are built from 24&lt;br /&gt;
different images (see figure 5,) thus setting to 36 the number of images&lt;br /&gt;
required for a complete castle.&lt;br /&gt;
&lt;br /&gt;
''(figure 5)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure5.png&lt;br /&gt;
&lt;br /&gt;
There are 4 kinds of keep images: those representing keeps corners that are&lt;br /&gt;
outside of a castle, those representing keep corners that are inside of a&lt;br /&gt;
castle, and thos representing keep corners which are in the border; the last&lt;br /&gt;
one being divided in 2 categories, depending on the castle-keep tiles going&lt;br /&gt;
clockwise, or counter-clockwise (see figures 5 and 6.) Interior keep tiles are&lt;br /&gt;
supposed to tile with other interior keep tiles, and with corresponding&lt;br /&gt;
transition tiles; same for exterior keep tiles. Figure 6 illustrates the&lt;br /&gt;
different types of transitions for keep tiles.&lt;br /&gt;
&lt;br /&gt;
''(figure 6)''&lt;br /&gt;
&lt;br /&gt;
== The Wall ==&lt;br /&gt;
&lt;br /&gt;
===Tile drawing problematics===&lt;br /&gt;
&lt;br /&gt;
To draw tileable castles, one should start with drawing the wall. Some tileable&lt;br /&gt;
castles may only consist on a wall, without a keep (Think here that what we&lt;br /&gt;
call &amp;quot;Castles&amp;quot; in this document may apply to a lot of other terrains, built&lt;br /&gt;
with the same rules. Also think that some castle may have keeps that are normal&lt;br /&gt;
tiles.)&lt;br /&gt;
The 12 tiles that compose a wall are made from 2 groups of tiles, as stated&lt;br /&gt;
above: convex wall tiles, and concave wall tiles. Tiles for each one of those 2&lt;br /&gt;
groups are drawn together, then automatically cut out using a specialized&lt;br /&gt;
software. That way, only 2 graphics are necessary to generate those 2 tiles.&lt;br /&gt;
&lt;br /&gt;
The main problem, as that should be inferred from reading the tile model&lt;br /&gt;
description, is making convex graphics tiling with concave graphics: as concave&lt;br /&gt;
graphics are drawn together, there is no problem making them tile together;&lt;br /&gt;
same with convex graphics. See figure 7 for an illustration of this problem: ||A and&lt;br /&gt;
B are drawn together, so they tile perfectly. However, we must make sure A will&lt;br /&gt;
correctly tile with C!||&lt;br /&gt;
&lt;br /&gt;
''(figure 7)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure7.png&lt;br /&gt;
&lt;br /&gt;
Geometry, and a good methodology, may be used to make those tile correctly.&lt;br /&gt;
This is possible, but, trust me, this is tedious. And hard to maintain. And&lt;br /&gt;
even harder to explain. And, the more complex the graphics are, the harder it&lt;br /&gt;
is. That is why ia helper tool was developed, to help in the process.&lt;br /&gt;
The helper tool we are talking about is called the Castle Exploder. We will&lt;br /&gt;
describe how to used it to build a complete castle.&lt;br /&gt;
&lt;br /&gt;
===Preparing the work environment===&lt;br /&gt;
&lt;br /&gt;
Before using the Exploder, you must prepare a work environment. The Exploder,&lt;br /&gt;
must be provided with files named according to a correct pattern in order to be&lt;br /&gt;
able to work.&lt;br /&gt;
Exploder files are named according to the type of image they represent. The&lt;br /&gt;
&amp;quot;type&amp;quot; of the image corresponds to the position of the different tiles that&lt;br /&gt;
compose the image. For example, the exploder recognizes any image that is&lt;br /&gt;
called foobar-convex.png as containing the 6 convex castle walls, disposed&lt;br /&gt;
around an hex.&lt;br /&gt;
&lt;br /&gt;
There currently are 7 different image types; all of which are used to build a&lt;br /&gt;
complete castle with keep. Those are named:&lt;br /&gt;
&lt;br /&gt;
* convex&lt;br /&gt;
* concave&lt;br /&gt;
* exploded-convex&lt;br /&gt;
* exploded-concave&lt;br /&gt;
* keep (not yet available)&lt;br /&gt;
* keep-walls (not yet available)&lt;br /&gt;
* keep-flower (not yet available)&lt;br /&gt;
&lt;br /&gt;
''(figure 8)''&lt;br /&gt;
&lt;br /&gt;
Forget about the last 3 ones for now; the 4 first ones are used to build&lt;br /&gt;
castles.&lt;br /&gt;
&lt;br /&gt;
Download the castle project here:&lt;br /&gt;
&lt;br /&gt;
http://www.anathas.org/ayin/wesnoth/castle-tutorial/files/castle_project.zip&lt;br /&gt;
&lt;br /&gt;
To prepare your work environment, unpack the castle_project.zip file in a&lt;br /&gt;
directory of your choice.&lt;br /&gt;
&lt;br /&gt;
===Drawing The Convex Wall===&lt;br /&gt;
&lt;br /&gt;
Open, using your favourite bitmap editor the file &amp;quot;castle-convex.png&amp;quot; (if your&lt;br /&gt;
favourite bitmap editor cannot open png files, I can't help you.) You will see&lt;br /&gt;
the following:&lt;br /&gt;
&lt;br /&gt;
''(figure 10)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure10.png&lt;br /&gt;
&lt;br /&gt;
Do not be afraid with all those coloured polygons! Those just are guides, that&lt;br /&gt;
will help you to position your image. If your bitmap editor handles layers, I&lt;br /&gt;
suggest you make the actual drawing on another layer, keeping this one to&lt;br /&gt;
provide guidelines. If it does not, you should just delete all this coloured&lt;br /&gt;
stuff.&lt;br /&gt;
The different hexes, corresponding to the position of the actual terrain hexes&lt;br /&gt;
in the game, are represented with a value change. The 6 different corners, that&lt;br /&gt;
will be cut into tileable pictures, are represented with a hue change.&lt;br /&gt;
&lt;br /&gt;
This image is supposed to represent a convex castle tile: that is, a single&lt;br /&gt;
castle hex, followed by non-castle hexes all around. Draw the corresponding&lt;br /&gt;
graphics on it. You do not have to bother about them tiling together: they&lt;br /&gt;
will, as they were drawn together.&lt;br /&gt;
&lt;br /&gt;
Some guidelines on drawing the wall: when drawing a wall, the TOP of the wall&lt;br /&gt;
(not the bottom) should be around the hex border (TODO: confirm this: this is&lt;br /&gt;
good for the positioning of units, but not so for villages near castles)&lt;br /&gt;
Ideally, a wall should not be higher than 1/4 of a tile (that is: 18 pixels).&lt;br /&gt;
Try to make the castle appear to be viewed under the same angle as other&lt;br /&gt;
castles, and villages.&lt;br /&gt;
&lt;br /&gt;
Let's draw the wall (figure 11).&lt;br /&gt;
&lt;br /&gt;
''(figure 11)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure11.png&lt;br /&gt;
&lt;br /&gt;
===Exploding The Wall=== http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/castle-exploder.png&lt;br /&gt;
&lt;br /&gt;
Now, we must draw the concave version of the wall. To make sure it will&lt;br /&gt;
correctly tile with the convex version, we will not directly draw it in the&lt;br /&gt;
castle_concave.png image: we will draw it in an exploded version of the&lt;br /&gt;
castle_convex.png image. That is where the Exploder Tool comes into play.&lt;br /&gt;
&lt;br /&gt;
Just open a terminal window, and type the following command:&lt;br /&gt;
&lt;br /&gt;
 exploder castle-convex.png castle-exploded-convex.png&lt;br /&gt;
&lt;br /&gt;
The exploder will open the first file, extract from it the tiles it&lt;br /&gt;
recognizes, then put those on the second file, if there is a place to put&lt;br /&gt;
them (For example, exploding castle_concave.png to castle_convex.png is a&lt;br /&gt;
no-op, as those two pictures do not have any tile in common.)&lt;br /&gt;
&lt;br /&gt;
''After the program finishing merging the tiles'', the castle-exploded-convex.png&lt;br /&gt;
file will then look like figure 12&lt;br /&gt;
&lt;br /&gt;
''(figure 12)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure12.png&lt;br /&gt;
&lt;br /&gt;
===Drawing The Concave Wall===&lt;br /&gt;
&lt;br /&gt;
Draw the castle graphics on the 6 concave tiles, so that they tile correctly&lt;br /&gt;
with the convex tiles. It is useless to modify the concave tiles; if you have&lt;br /&gt;
inadvertently done so, you may explode back the castle_convex.png file on the&lt;br /&gt;
file you are working on. Do not worry: your work will not be lost; as the&lt;br /&gt;
exploder tool does only overwrite the portions of the image it actually&lt;br /&gt;
replaces.&lt;br /&gt;
&lt;br /&gt;
''After you have drawn the missing castle corners'', the castle-exploded-convex.png&lt;br /&gt;
file should look like figure 13&lt;br /&gt;
&lt;br /&gt;
''(figure 13)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure13.png&lt;br /&gt;
&lt;br /&gt;
===Imploding Back the Concave Wall===&lt;br /&gt;
&lt;br /&gt;
The concave tiles you drew should, magically, tile together. However, you may&lt;br /&gt;
want to ensure they actually do, and, if they don't, to correct them so they&lt;br /&gt;
do. Just implode back the castle_exploded-convex.png file into the&lt;br /&gt;
castle_concave.png file, using the command&lt;br /&gt;
&lt;br /&gt;
 exploder castle-exploded-convex.png castle-concave.png&lt;br /&gt;
&lt;br /&gt;
It should look like as in figure 14.&lt;br /&gt;
&lt;br /&gt;
''(figure 14)'' http://www.anathas.org/ayin/wesnoth/castle-tutorial/images/figure14.png&lt;br /&gt;
&lt;br /&gt;
===Further manipulations===&lt;br /&gt;
&lt;br /&gt;
===Cutting The Tiles For Use In The Game===&lt;br /&gt;
&lt;br /&gt;
Once you have up-to-date castle_convex.png and castle_concave.png files, you&lt;br /&gt;
must cut them, so they are usable by Wesnoth. To do this, create a directory&lt;br /&gt;
where you want the cut tiles to be output (or you may just use the &amp;quot;output&amp;quot;&lt;br /&gt;
directory which already was created), and use the commands:&lt;br /&gt;
&lt;br /&gt;
 cutter castle-concave.png output&lt;br /&gt;
 cutter castle-convex.png output&lt;br /&gt;
&lt;br /&gt;
== Keeps ==&lt;br /&gt;
&lt;br /&gt;
As it was said above, keeps are a little bit more complicated than castles.&lt;br /&gt;
Keep always being composed of one isolated tile, keep tiles always are convex,&lt;br /&gt;
however, they may have several different relationships with nerby castle tiles:&lt;br /&gt;
they may be inside of a castle, outside from a castle, or in a border.&lt;br /&gt;
&lt;br /&gt;
===The keep views===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Drawing interior and exterior keeps===&lt;br /&gt;
&lt;br /&gt;
Keeps inside of a castle, and keeps outside of a castle, may be strictly&lt;br /&gt;
identical. However, for your graphics to be more &amp;quot;realistic,&amp;quot; you may decide they&lt;br /&gt;
are different. For example, keep tiles located outside of a castle may have no&lt;br /&gt;
doors, less windows, they even may have a stronger wall, etc. Interior keep and&lt;br /&gt;
Exterior keep tiles do not need to tile together, as there always will be an&lt;br /&gt;
intermediate Border tile to make transition. They may be made separately;&lt;br /&gt;
however, keep in mind that you will have to make each transition between those.&lt;br /&gt;
If they are too different, transitions may be clunky.&lt;br /&gt;
&lt;br /&gt;
===Making keep transitions===&lt;br /&gt;
&lt;br /&gt;
===Flower Power===&lt;/div&gt;</summary>
		<author><name>Pukeman12345</name></author>
		
	</entry>
</feed>