From The Battle for Wesnoth Wiki

This is under construction

This is almost a first draft - still needs images and better formatting

Building tileable castles - Another Tutorial

Introduction To Castles

First, be sure to look at this:

There had been a period where no one was actively working on the castle terrain, and as can be seen in the original Castle Tutorial linked above, the documentation was incomplete at best. As can also bee seen in that Tutorial, exploder and cutter tools were designed with older versions of the castles in mind. There was no obvious way to apply exploder & cutter to the newer castles without the need to edit each individual generated castle fragment image by hand (can be about 50 images). Something had to change.

Fortunately, we are not designing Wesnoth's first-ever castles, so we do not have to start from scratch. We will use the existing castle fragment images as guides, and use a procedure that does not involve editing 50 little .pngs by hand when we are finished. This tutorial was written with GIMP in mind, PhotoShop should work very similarly. If you are using a drawing program that does not support transparency & multiple layers, this will not work until you get yourself a better drawing program that does.

So let us first consider the existing images.

Existing Images

The basic concept of convex & concave is still valid. The significant changes are that diagonal walls are no longer cut in the middle, the towers are taller, and there is a pseudo-second[1] level for the keeps.

(two keep images here)

This makes it difficult to apply a mask for cutting the castle into useful component fragments as exploder & cutter did with the older castles. So there goes that idea. But we know the current castle fragments can be assembled correctly, so we will use them to set up a system that will keep our new castles in line with those.

New Cutter

The new cutter script cuts up a master image into little fragments which will be directly used by Wesnoth (if you've placed them in the correct directory). You should not have to edit them after they are generated, all drawing edits are done to the master image. This is an example of such a master image:

If you wish to use different castles as guides:

  • Delete the ones that are inside the boxes
  • Open the desired castle images and copy the first one to clipboard. Copy the entire image, don't use any select tools.
  • Paste the image onto the master image (which at this point is mostly empty, aside from some black lines & labels). Move the floating layer to the correct box, and make sure the top left corner of the floating layer touches, but does not overlap, the black lines of the guide box. For the top and left edge of the master image, there is no black line so just use the edge of the image itself as the guide. Anchor the floating layer.
  • Move on to the second little image you want to use and repeat the copy & paste above. Keep doing that until you have all of the desired images pasted into the correct box.
  • If you are making some castle that is different from the standard human castle (different size, different layout, different number of fragment images), you will need to make note of the coordinates of the top left corner of each fragment within the master image. Edit the directions.txt file to give the correct position (of top-left corner) of the desired fragment within the master image, as well as the desired size and filename.

Now that you have a template, you may find it easier to draw against some terrain background. If so, just make a map in Wesnoth's editor that is whatever terrain is relevant, take a screenshot and cut & paste the terrain from that screenshot to a new layer (referred to as "Background Layer" from now on) below the existing one with the black lines and pasted castle fragments (referred to as "Template Layer" from now on). Background Layer is not necessary though.

Before you begin drawing, make a new layer (referred to as "Working Layer" from now on) and draw on that. When you are done, set the layer opacity to zero (or whatever you need to do to make Background and Template Layers invisible) and save the image as a .png. A big image master image made only of your new castle fragments in Working Layer is saved.

Run the cutter script on the new master .png image, collect the generated images and put them somewhere Wesnoth can use them. If you don't want to bother with making a custom terrain, put them in some mainline image folder such as the one with elven castles. Be sure you back up the elven images first. Unless you put them in the master .png and edited directions.txt, the cutter script will not make the ground hex image or editor tiles. You have to add those by hand, but it is only 3-4 images.

Testing with Wesnoth

Run Wesnoth to see how the new castles look. Don't test them with the map editor, test them in a game. If you are using them in a new custom terrain, you will need to make a playable map first. Unless you are really lucky or good, something will be wrong with them. Make whatever change you think will fix that to the master .png image, run the cutter script again, put the images in the correct location, and type ":refresh" in Wesnoth to see the changes without the need to close and re-open the map (as of BfW 1.7, :refresh was not available in the editor, that is why we are using a live game). Do that until you get them fixed to your liking.

Viola! Now you have new castle images.

[1] "pseudo" because, despite appearances, the hex terrain graphic is not shifted or elevated. It only looks that way because a fragment of the hex tile graphics is included in the two upper keep wall images.

This page was last edited on 28 April 2014, at 22:08.