Intro to Source Mapping: Navigating Hammer and Making Brushes
(Unreleased, slated for October 25, 2017)
Now that you're all caught up on the definitions, let's talk about Hammer itself. If you're making levels for Source games, Hammer 4.0 will most likely be your editor of choice. The editor you need either comes packaged in with the game in the
bin directory (like
C:\Program Files (x86)\Steam\steamapps\common\Half-Life 2\bin) or in a separate set of "authoring tools". You can find these under "Tools" in Steam. Games that have their own set of authoring tools include Alien Swarm, Counter-Strike: Global Offensive, Left 4 Dead 2, and Portal 2. If you're mapping for any of these games, you'll need to launch Hammer through Steam.
When you start Hammer, you'll likely be greeted by a window telling you to pick your "game configuration". Select the game you're mapping for in the list (the other ones won't work anyway), and Hammer will load. In order to bring up the editor proper, you'll need to either load an existing map or create a new one, using the File menu.
The editor might look confusing at first, but it's remarkably simple. By default, you have four
(If you want to play with this layout, you can click the top left of any of the viewports to change what they display. If your 3D viewport is displaying only in wireframe, you can make it display brushes in flat colors, textures, or shaded textures. Shaded textures will look the most like what you see in-game, so we recommend setting it to that.)
You can change the zoom levels of any of these grid views with either the Zoom tool, using the mouse wheel with your cursor hovered over the viewport you'd like to zoom in and out of, or with the + and - keys. Make sure your mouse is over one of the grid views and try zooming in and out of it.
Your toolset is displayed on the left side of the window. Here's a quick rundown of what each button does.
Drawing brushes with the Block tool
For now, we'll be paying attention to the Block tool. The Block tool lets you make brushes by drawing them out in any of the three grids. Select it if you haven't already and turn your attention towards the top right viewport. Drag out a box around the middle of the grid. You should see a dotted box with two numbers along the sides and the white outline of a box in the 3D viewport. Press the Enter key, and the box will turn red. You've made a brush.
If you hover your mouse over the 3D viewport, you can use WASD to fly around your level and the arrow keys to reorient your view. You can also press the Z key to activate mouse look, which works exactly like noclip in-game. Your cursor will turn into a crosshair, the mouse can now be used to look around, and WASD can be used to move all the same. Press the Z key again to get out of this mode.
Of course, levels are built out of a lot of brushes, and now that you've made one, you can make more. One important feature in making brushes is the ability to change their size, location, and dimensions before they're made. Drag out another box, this time, one of the four walls around the brush you've already made. Notice that it's the exact height as the other one.
Use one of the other viewports to make this one taller. You can change the dimensions of a brush by tugging on one of the eight brush anchors (four corners, four sides). Move it upwards so that it forms a wall by dragging the box along the inside of it. Press Enter again, and you've made a wall.
You can also change the dimensions of a brush after it's been made. To do this, switch to the Select tool after you've made the wall brush. You'll notice the eight anchors come back and you can tug on any one of them to change the dimensions of the wall again. Hover your mouse over the 3D viewport and press the X key, and you can have the same anchors appear in the world, in case you want a more visual representation of what you're changing. You might need to find the right angle to get it to shift the way you'd like it to.
Independent of the zoom levels, you can set the grid scale. A grid scale of 64 means that one block of the grid is 64 "Hammer units". Everything in the game world is measured in Hammer units. Likewise, a grid scale of 1 means that one block is one Hammer unit. You'll likely need to change it for finer details. To change the grid scale, use the [ and ] keys. The grid scale is displayed at the bottom right of the Hammer window, on the status bar.
A word on "Snap to Grid"
Something rather important to remember is that the grid is a measurement, not a suggestion. Go to your Map menu and ensure that "Snap to Grid" is checked. If it's not, you will have a world of hurt coming your way. Without the grid, your brushes are more likely to be misaligned with one another, where ends won't meet up and tiny holes in your world will form. Grid scales too small will also increase the likelihood that your brushes are misaligned.
Aside from looking messy, misaligned brushes increase the chances of a , or a hole in your brushwork leading to the outside of the level. If there's a single hole in your brushwork, no matter how tiny, the map will leak. Water won't look right, lights won't look right, particles will be missing, your compiles will take longer, and your level will run worse.
Here's an example of a really messy and badly put together map. Notice the thin floors and the complete disregard for the grid, causing weird double lines and gaps in the brushwork. This level was so leaky and so badly put together than it had to be completely redone.
There's no excuse. Your levels will look worse and play worse. Work with the grid.
Fill in the missing walls and the ceiling of the room we started. Make some more rooms of different sizes. Make a tunnel. Hammer is really quick and easy when you get the hang of it.