This tutorial will show you how to interactively model large-scale terrains using only Conjurer. This covers from the very basic modelling of the geometry to the advanced creation and use of specific materials. For details on the tools presented, please refer to Terrain Editor in the Conjurer Manual.

If you followed the previous tutorial, Getting Started, you should already know how to setup a new, fresh level, and how to define a new terrain class. Now we’ll get into more interesting concepts.

Terrain as a height map

Terrains in the Zombie Engine are large squares where equally spaced points of the square are assigned a height value. This means that for a pair of coordinates (longitude, latitude) you have a single height value, what is referred to as a height map. Therefore you can’t have caves or other such complex formations (not this way, anyway) but that isn’t such a big shortcomming.

The great thing about representing terrains using height maps is that these are very efficient data structure, for memory consumption, disk space, and performance. Also, such a compact representation allows using a level-of-detail algorithm that basically draws the terrain with more detail where required, saving both processing power and bandwidth.

Terrains in Zombie are rendered using geomipmapping,a technique that subdivides a terrain in square pieces named Blocks. The Block is the smallest piece of a terrain that can be handled separately, and the number and size of Blocks must be carefully chosen beforehand, for it has an impact on the performance and available detail of the resulting terrain.

Enough with the technobabble, let’s create a terrain again and let’s see how these concepts apply practically.

Setting up a terrain

Remember the dialog for creating a terrain? Let’s review again with the concept above in mind:

Now that we know what a height map is and what blocks are, the fields in this dialog make more sense:
Terrain size and Block size state how big you want both the terrain and the blocks to be, in other words, the size of the height map, for the entire terrain, and for each individual block. Only power-of-two-plus-one values are allowed for technical reasons, but the number of blocks is determined by the relationship between these two values, eg. for terrain size = 65, block size = 17, the terrain will be a grid of 4×4 square blocks. Which is a terrain as the one in the screenshot (toggle the wireframe mode hitting the 0 key if you want to see for yourself)

But that doesn’t say too much about the actual size of the terrain. The Point Separation value states the world distance between two contiguous points in the terrain grid, thus effectively fixing its size, as well as how much the textures covering the terrain will be stretched.

This is all you need to know for now about the terrain, the rest of fields will be explained as you move to actually editing the terrain.

Modeling a terrain

Now that you have a terrain in place, it’s time to create a few hills and valleys. Hit the button to enter the terrain editing mode. Two new windows open: Terrain Edit Tool and Terrain Materials.

The Terrain Edit Tools lets you choose how you are going to deform, texture or otherwise modify your terrain. In addition to these windows, you’ll notice that an orange rounded shape appears in the render window and follows the movement of the mouse while in this mode. This shape is your editing cursor, and shows you the area that will be modified when clicking on the terrain. Depending on the tool currently selected, the effect on the terrain will be different.
For example, select the button (Raise) and the brush. Now click and drag the mouse on the terrain and see what happens: a bump appears under the round area under the cursor! Now you can experiment the joy of raising hills and mountains.

Now you can experiment with other terrain editing tools such as Flatten or Smooth and deform the terrain in whichever way you prefer. You can also adjust the size of the round shape with the slider named Size in the Terrain Edit Tool, and experiment with other values such as Attenuation and Intensity to adjust the exact way you want to edit your terrain. Refer to the Conjurer Terrain Editor manual for details on what the different tools mean.

An important tool you should always resort to while editing a terrain is Undo. By clicking the button you can revert the last changes made to the terrain (the last changes made in the entire editor, actually, but we’ll stick to terrain for now). Try clicking Undo several times to go back in time and see how the terrain editor recalls your last changes. Use Redo to re-apply changes after you have Undone them.

One thing you might ask is, what’s the maximum and minimum heights to which you can raise or flatten your terrain? You already gave that answer when you first set up your terrain, in the Minimum Height and Maximum Height fields. One important aspect to consider is that the higher the difference between these two values, the lower the resolution of your height map. Because height values are encoded in 8 bits, you only have 256 values to represent your height range, which should be more than enough for most cases, but keep this in mind if you want your terrain to have high slope variations or a large height range. The best way to know what are the best settings is to experiment with different values.

The terrain we have so far is slightly boring because it all looks the same. We’re going to address that right now, but first, enter the game mode and try to walk around your newly created hills and valleys to see how they look from a player’s perspective.

Painting the terrain

Now it’s time to add some color to the terrain, which now has a uniformly unappealing pink color, which means is untextured. From now one, pay attention to the areas of the terrain showing such color, for they are a reminder of the areas you haven’t painted yet. Still, terrain blocks that are left completely unpainted are not rendered in the final game. This way, you can select which areas of a terrain are relevant to your map, and let all other areas remain inactive.

But first, let’s paint the relevant areas by selecting the Paint Tool, and selecting the default, unnamed material in the Terrain Materials window:

Now go back to the render window, and notice that when you click on the terrain, the area under the cursor is painted using the texture of the material you just selected, by default a green grass texture. Move the cursor around to paint: you’ll notice that this process is slower than modelling the terrain, because editing textures in realtime is a slow process, but it’s a powerful tool nonetheless, once you get used to it.

Now click New Material in the Terrain Materials window, and the New Material dialog appears:

After naming the new material, click the button with the name of the texture on it, and browse for the texture file you want to use for the new material. This file must be contained in your game repository (aka. the Working Copy), under the export/textures/ folder. Please refer to [link] Working Copy Management for details on how to setup a proper working copy.

Leave all other fields to their default values for now and click Ok. The new material should appear in the Terrain Materials window, and now you can select it and use it to paint the terrain with just as before. For example, paint with the new material in an area right by the one you previously painted:

Now you can see that the two materials blend into each other gracefully. Terrain layers with different materials blend using an internal texture that called a weight map, which specifies the weights (contributions) of different terrain layers to the final color of a point in the terrain. The size of these weight maps fixes the resolution of the blending (the larger, the higher) but it has also a memory cost. This size can be assigned in the Terrain Class creation dialog (Weightmap resolution), and you should experiment with the value that better serves your needs.

Now try and create other materials, and experiment with the various settings, as specified in the Conjurer Terrain Editor manual. There, you’ll learn the details about other terrain tools, as well as some other terrain-related processes that you will find in the Terrain menu. There is a host of options you need to get familiar with before you can create a terrain that entirely satisfy your needs, but for now, just feel the joy of virtual mountaineering by going into Game mode and running up and down the slopes of your hills from a player’s eyes.

And this is all for now about the terrain editor. As a last note of advice, remember to save your changes frequently: editing a terrain is an expensive process in terms of memory and depending on your development workstation, your editor may stall once in a while. Always play it safe by saving after every relevant change.

Next: Models