Intro to Source Mapping: Foundations
(Unreleased, slated for October 24, 2017)
The game world is a volatile place. Fire fights, cinematics, and events forever ingrained in the memories of players happen in it, and it's your job as the mapper to create it, or more specifically, bring it all together through the textures, models, and effects available to you. Mapping sounds like a big job, and it is. A Counter-Strike level can take months of construction and tuning before players start blasting each other on it, and for singleplayer, story-driven games like Half-Life 2, the level design work sometimes involves additional tools and preparation to get the effect you want.
Baby steps, however. Mapping is more tedious than difficult, and you can have your first map in a matter of minutes. Mapping boils down to a few basic concepts. The jargon will be kept to a minimum here, though a basic understanding of geometry will prove useful.
A brush is a block. That's the simplest way to put it. It can be a big block, or a small block, but it is a block. Players cannot move through brushes and brushes themselves can't move. Brushes make up roads, buildings, walls, and things that aren't very detailed. Brushes make up most of the game world, and as a result, you can have thousands of brushes in a single map. The "plaza" map in Half-Life 2,
d1_trainstation_02, has 2,213 brushes in it—roads, buildings, even the plinth the Breencast jumbotron is fixed to—all brushes.
Brushes can take the shape of pyramids, cylinders, boulders, or simple prisms, but the big requirement is that each brush has to be convex. If you can draw a line between two vertices of the brush and at least one part of that line goes outside of the shape, it's not convex, it's concave. The game doesn't know what to do with concave shapes, and if a brush is concave, it won't work in-game. When you start trying to create more complex brushes, you can easily run into a situation where you'll either need to split a concave brush into smaller convex shapes or recreate it altogether.
You create brushes in the level editor you're using (most likely, Hammer) using the Block Tool. Operation of Hammer will be discussed later in the track.
An entity is something interactive. It's a part of the game world that does something—move around, activate other entities, think, attack. Entities come in two forms, point and brush entities.
Point entities belong to one point in the map and add detail or functionality. You can think of brushes as the skin and bones of the world, while point entities are the eyes and mouth. Whether they're AI nodes that tell NPCs where to go, the NPCs themselves, boxes of rounds, awnings, trash cans, fire, or spotlights, point entities populate the world that brushes form.
Brush entities are entities with volume. They can either affect the space inside them or the space around them. An elevator is good example of a brush entity; it can move and be interacted with, but it's created with the Block Tool like a normal brush and given special functionality. Turning a brush into a brush entity is known as tying it to an entity, and many brushes can be tied to one entity.
A map created in Hammer can't be played right away. Instead, it has to be compiled, or run through tools that prepare the map for the game. In Hammer, you can compile a map by going to the File menu and selecting "Run Map...".
There's three tools involved in compiling a map for a Source game, VBSP, VVIS, and VRAD. VBSP makes the level itself, converting brushes, preparing entities, and making it functional. VVIS embeds visibility information in the map to make it render much faster. VRAD handles lighting, calculating radiosity and light bounces. Compiling can be slow, especially for VVIS and VRAD. Be patient. Your computer isn't frozen.
You don't need to worry about what each tool does for the most part. Just remember to compile your map from the File menu each time you'd like to test it in-game.