Map making in Left 4 Dead 2

We built a castle. These four words imply simplicity, when in truth they represent five weeks of solid work, sleepless nights, and now, permanently bloodshot eyes. We’ve come a long way since the simple orange boxes and flawed prototypes of our early work. We’ve mastered the arcane rites of portal flow, the intricacies of the logic_case, and the almighty power of the Nav Mesh. And yet, as far as we’ve come, we’re still building boxes. Our level, in all its gothic grandeur, resides within a gigantic box whose walls and ceiling are concealed by the illusionary powers of the skybox.

The buildings within this mega-box are simple, square creations. World geometry, and the processing of it, is complicated in the Source Engine. The engine’s struggle with rendering increases with any chunk of scenery that isn’t at a neat right angle. Like 1,000 candles casting a million shadows, a simple eight-sided tube can cripple the Source Engine’s visibility rendering process. The more complex the shape, the more the engine will struggle to account for each silhouette, each angle, and their effects on visibility.

To get around this, most official levels use a huge number of props: pre-made entities, such as doors and trees, that don’t affect these calculations. As each of these must be placed by hand, we opted for a minimalist approach. After all, these are ruins, not fully-furnished luxury apartments.

Above: The level early in development. These fluorescent grids are a top-down wireframe view of the map. In the beginning, the map is limited to blue and green lines representing brush geometry (walls, etc). As the map progresses, the geometry becomes more complex as the level is filled with props (the yellow boxes) and assorted point entities (purple splotches).

Above: Later on, the level has gotten, let's say, a bit more complex

On this note, while skyboxes can create dramatic, detailed landscapes, in our case we rendered the sky pitch black. Following through on our previous idea to implement darkness as a means to bypass the necessity of detail, a pitch-black sky not only serves our purposes in this sense, but also helps to create an oppressive atmosphere. Blackness is heavy, and for much of the level the world will only be revealed to the survivors through the circle of light cast by their flashlights.

A level with no lighting at all would be lazy and rather confusing, so as a compromise we play with fire, positioning camp fires throughout the ruins. This leads to a new idea: like the safe rooms and quiet corners of Valve’s maps, lighting on this level would serve as a refuge, giving the survivors a measure of safety – but at a cost.

Above: In its basic form, a skybox is a massive box whose internal surfaces are covered with sky and horizon textures. A player is usually placed in the center of the box, which follows them, so they always see the illusion of a distant sky. Advanced games, such as Half-Life 2, have skyboxes that contain miniature landscapes, complete with buildings, clouds, and the blinking lights of distant vehicles

Just like with the pipe bomb, light and sound would attract a horde of zombies. Though it takes us two days of hard labor, learning and swearing, we successfully construct the first of several portable generators that, when used, turn on floodlights, replete with beams and sounds. A couple of seconds after this, a horde will appear, and the apparent safety of the bright light is then tested. The castle structures took two weeks to complete. With lighting and AI pathfinding on their way to being completed, we made the decision to attempt a simple Finale level, and so make a complete, if short, campaign.

Rather than building a new level from scratch, we saved time by inverting the existing map: the ruins themselves become the setting for the finale, lit by morning light. We toyed with a variety of ideas for the survivors’ evacuation from trucks pulling up at the entrance, to fuel being loaded into a car, but in the end settle for what turns out to be the most complicated option: the helicopter.

Necessity really is the father of invention, and the sheer size of the helicopter demanded a significant redesign of the ruins. As the chopper couldn’t fit into them, a new tower emerged from the empty area we’d planned to use for its landing spot. Then we made a church with an accompanying graveyard that could act as a landing area for the aircraft.

The two levels continue to grow in this manner for another week: changing in an almost organic response to every new problem that came up or idea we had. As much as their contents started as a mass of independent components, by this point everything is connected, which meant that any change that was made demanded another.

By week four, playtests of the early two-level campaign began. Players are devious little shits, so within the first few minutes of the first test exploitable flaws were revealed. Much swearing ensues, in private, and is further fueled by the subsequent revelation of the expected (but still dreaded) array of bugs and glitches that accompany any new construction.

To say that eventually worked out would be both entirely true and horribly inaccurate. As the final two weeks of production crawled by in a line-dance of steps forward and back, the backward steps cause us to stumble many times. Game-breaking flaws were revealed in major features, and we blasted through more fixes than in the previous weeks combined. But in the end, it does all work out.

Now the bugs and their fixes become less frequent, and all that’s left to do is implement some HDR lighting – and unleash a final touch, a series of features to unsettle and surprise even veteran zombie-killers, and adapt this map for Versus play.

Want to try it yourself? This is what you’ll need...

  • A Valve Source engine game (Portal, Half-Life 2, Left 4 Dead 2, etc.)
  • The relevant SDK (downloadable fromSteam%26rsquo;s Tools tab)
  • The ability to read, a variety of tutorials and tool explanations
  • Time. Making a good level takes weeks. Making a Valve-quality level will take months. Tons of resources are available in theSteam forums

Tips ‘n’ tricks - Making your first level

Stay Square
Due to the nature of the engine, rectangular environments perform better and compile faster. That’s not to say that levels should only be of right angles, but their foundations should.

Tidy up
Adding props like trees should be the last thing you do before the Nav Mesh. They’re large, and their wireframe can really clutter up your view of the level if you’re designing structures. Keeping a tidy, neatly designed map can save a lot of time and eyestrain.

Pace yourself
Being overambitious can lead to a lot of disappointment and confusion. Keep it simple until you’ve shot your first zombie. Once you know it works, you can experiment more.

Hammer is a resource hog. Keep some paper and pencil nearby at all times; you never know when you’ll need to jot something down, only to find that your PC has staggered to a halt and is refusing to load Notepad.

Above: Don't copy our castle, though. Try something unique

Aug 16, 2010

How to fix what's wrong with PC gaming
The platform is powerful but flawed - here are 12 things that require a reboot

How indie games took on the world (and won)
Meet the maverick heroes of game development