Level Design - Adding Terrain & Decorations [Calibas Tutorials #3]
In the previous two tutorials, the terrain has consisted of nothing but a flat plane with a grass texture covering it. Chances are you probably want something a little more interesting to look at for your maps, so in this tutorial I'll go over how to use the Tile Editor tool to do things like add water, paths, trees, plants, and raise/lower terrain. I'll cover all the basics for creating a decent looking map.
I'm going to start with a blank map, though you can also use a preexisting map, like the one we made in the previous tutorial. To generate a new map for your addon, load up Hammer, press Ctrl-N for a new map, and then Shift-C for the Tile Editor tool. It'll prompt you to create a new tile grid, so select yes.
One of the first things to understand is that we don't want players to be able to be able to move all the way to the edge of the map. If they do, they'll see something like this:
That kind of kills immersion and makes for an ugly map, so it's not something I recommend. You'll normally want to use the terrain to block players from moving all the way to the edge of a map, so let's do that now. You can use things like forests, water, higher/lower terrain or invisible walls, and I'm going to go with heightened terrain to begin with.
Using the Tile Editor (Shift-C) in Paint Terrain mode (Q) you can Left-Click anywhere on the map to raise up the terrain. To make things easier, I zoomed way out so I could see the whole map in the 3d viewport. If you're using a map from a previous tutorial, you'll likely have fog enabled, and you'll want to turn that off using Fullbright mode (F5). Use the tool to draw raised terrain all around the edges of the map, and notice that you can increase the brush radius to make this job easier.
Here's what your map should look like now, and I've highlighted the Tile Editor tool, Paint Terrain mode, and where to adjust the Brush Radius:
If you made any mistakes, don't worry it's easy to fix. You can use Ctrl-Left-Click to lower the terrain, and you can use Shift-Left-Click to flatten the terrain. To use flatten properly, first shift-click on a tile that's the height you want, then drag your cursor around to set other tiles to that same height. Also, notice at the bottom of the Tool Properties pane there's a list of all the keyboard shortcuts in case you ever forget.
Next I'm gonna select the Paint Water mode (E) and draw a little pond in the center of the map. It's very easy to use, simply Left-Click to "paint" the water in an area, and Ctrl-Left-Click to remove the water. I also switched back to the Paint Terrain mode (Q) and created a little hill behind the pond. Here's what my map looks like now:
Looking better, though still a little bland, so let's add some trees and bushes to make it more visually appealing. Switch to the Paint Trees mode (T) and use it to draw a forest to the top-right of the pond. Just like with the water tool, you can use the Ctrl-Left-Click to remove trees if you need to.
Now switch to the Paint Plants mode (Y) and we'll use this to add some variety to the grassy areas. Note that these are purely decorative elements, and wont affect gameplay or pathing at all. The Density slider defaults to 50, which is rather thick vegetation, so I'm gonna drop that down to 10 instead. You can also up the radius some to make things easier, I chose 550, then Left-Click and drag to draw plants around the pond. Here's what my map looks like now:
It's starting to look like a real map.
Now we'll add some paths to the landscape, which serve two purposes. First, they add a visual element, which can be used as decoration or to direct a player where to go. Second, they ensure that players and NPCs can cross over terrain. Paths are used to add ramps between higher and lower terrain, and can also be used to do things like clear a path through a forest.
Select the Paint Path mode (R) and I dropped the radius down to 140 to make a skinnier path. Draw a path from the bottom of the hill, going downwards, and another path from the bottom of the pond, going downwards too. Make sure to click right where the height changes, and it will add steps there. Here's how mine look:
Notice how the ground texture is different for the paths than it is for the grass. You can actually change those texture directly using the Paint Blends mode (O). After selecting that mode, you'll see a Texture Blending area in the Tool Properties, and in there you can select from 4 different layers. The first one, Layer 4, is a dark green shade of grass, Layer 3 is the default grass texture your map should already be covered in, Layer 2 is a stone floor, and Layer 1 is the same dirt texture the paths use. Here's an image of all 4 side by side:
Note that this is only for the default material set on the radiant_basic tile set. If you change tile sets or material sets, you'll see different textures being used, though that's something I'll cover more in a later tutorial.
On my map I added a few patches of the dark green grass (Layer 4) around the forest and the pond for some variety. I also dropped the Stroke Opacity setting down to 50% to give it a more natural transition. Dropping the opacity essentially means I made the texture 50% transparent, so the color is halfway between the lighter green grass texture underneath and the dark green texture on top.
To finish up let's add some props to the map using the Place Objects mode (U) of the Tile Editor tool. You can select which tile set the props will be from (I'm using radiant_basic), and notice that you can also select a different object type if you want to do things like place individual trees or plants. I'm going to use the prop object type, then use the light sources prop type to add another torch at the top of the stairs to the left of the pond. I'm also going to use the bases_static prop type to add some stones to the top of those stairs, and I'll use the statues prop type to add a few Radiant statues around the pond.
If you make a mistake, you can hit Ctrl-Z to undo the last thing you did or use the Undo History pane to go back a few steps. If you want to remove a prop directly, you can switch to Select mode (I), select a prop and then hit the delete key. You can also use the Next Variation button in the select mode to see other variations of the prop type.
If you want to launch your new map and you haven't already placed a spawn point, you'll want to drag the basic_entities.vmap prefab from the assets pane onto your map. Then hit F9 to build, wait a little bit, and your custom game should launch in the Dota 2 client.
What I've covered here is just the very tip of the iceberg when it comes to the power of the Hammer editor. It's a very powerful tool, and I'll go over some of the more advanced features in the next tutorial.
This part of a series of 7 tutorials that are designed to help the beginner get familiar with the Workshop Tools and they end with showing how to write a very simple script.