Doom and the art of ambush

The jump scare. The ambush – A means of fucking up the player in such a way as to illicit fear, and subsequently train them to distrust all gifts, shoot all corpses (just in case) and make them so tediously canny that subsequent generations of level designers will struggle to find ways to scare the shit out of such jaded, thousand-yard-staring souls.

But how did it start?

I dunno, to be honest, and I really can’t be arsed to spend that much time researching it to find the very first occurrence of the jump scare in computer games. So instead I’ll talk about something very old that I actually know a great deal about.


Now I could write a whole bloody essay on the idea that Doom 1 and 2 are actually dungeon crawlers, and that everyone being oblivious to this has directly led to the steady degeneration of what was incorrectly labelled the “FPS” genre – with levels going from vast, intricate, personality-infused mazes to linear sequences of heavily-scripted scares (to paraphrase Max Payne 2). But I shall restrain my verbose nature and instead talk about those there two things. The jump scare, and the ambush. And how, specifically, such things were handled in ancient times before complicated level scripting – in an engine that was designed by a very small team of indie developers, back before “indie developer” was even a thing.

Firstly, here is a Doom level:

Doom e1m3

This is E1M3 – the third level of the first episode of the original Doom.

You may notice how flat the whole thing looks, despite there being quite a lot of verticality in Doom. That’s because technically, Doom isn’t a fully 3D game, and I don’t just mean the presence of 2D sprites running around. Levels in the original Doom game are essentially heightmaps – flat blueprints with certain areas marked as having specific floor/ceiling heights. There can be no spaces under the floor – no true bridges, no buildings with multiple floors stacked one upon the other. Only spaces of varying height between floor and ceiling, beside one another.

People would no doubt chuckle and roll their eyes at the simplicity of yesteryear, but Doom 1 and 2 still contain what is arguably some of the most striking and effective architecture in gaming (and for a good talk on the subject of negative space, and the efficacy of simplicity, take a look at this here GDC lecture). But I digress. Let’s zoom in on one corner of E1M3 that you might recognise:

Doom e1m3-zoom

Here it is in-game:



Now, many of you might remember this as one of your earliest “OH YOU BASTARD!” moments in gaming. In this room, you’re presented with the blue key you need to progress. You’ve fought your way to this location, and yet the key itself seems strangely vulnerable – guarded by only two of the weakest enemies in the game. Perhaps a little suspicious, you pick up the key, and this happens:


The lighting drops, a wall behind you opens up, and four demons attack you with a piercing cry. You promptly have a minor bowel movement and learn an important gaming lesson – that the more benign a room appears, the more malevolent it usually is.

Now if we return to the editor view of that same area, you may have noticed green lines around the little plinth where the key sits (bottom right of that right-hand room). As you can see, everything architectural in Doom is defined by these lines – which are referred to as linedefs. They are the physical shape of the level, but they can also harbour clever tricks.


Doom never had a nice open, complicated scripting system – when making levels for the original game in its original format, you’re limited to a fairly small list of hardcoded effects. For example, a line may serve as a usable switch – telling the game that if the player presses use while facing this line, something will happen. Or a line may be triggered by walking across it.

In this case, you’ll note that the key-plinth has two layers of green lines. That’s because any given line can have only a single effect assigned to it – it will do one thing, and one thing only. So to drop the lighting, AND open the door behind the player? There are two sets of lines – they’re close enough together that, during normal play, the player will trigger both at once with their clumsy lunging movements. But because of this one-action-per-line limitation, it is actually possible to trip the lighting without tripping the door.

Anyway, this is the foundation of all those clever ambushes, all those layered traps and scenery changes in the original Doom games – individual lines, with very basic actions assigned.

Bonus fact – To make a switch that raises a platform, a level designer must assign the platform itself an identifying number tag, then assign that same tag to the switch so that it references the platform. If the level designer forgets to assign a number to that switch, it’ll still work. Except instead of raising that one platform, it will try to raise EVERY FLOOR ON THE LEVEL AT THE SAME TIME (or rather, any area in the level that doesn’t have a unique tag). Seriously – I’ve done this myself. Doom levels are surprisingly dynamic in this regard; any area can change its floor height or ceiling height at any time. In fact over on the Doomworld forums – the ancient stomping grounds of Doom mappers and modders – you will often see contests to take a pre-existing level, and turn it into something dramatically different by changing the height values.


One of Doom’s more memorable and franchise-defining tools of scaring the shit out of the player with surprise attacks, and one that continued right through to the modern day, is the teleport ambush. You know, when you hear that distinctive teleportation sound effect (the one that sounds like a mystical plughole) and suddenly… demons.

It may surprise you to learn that in the original Doom games, this was not done with any kind of specific scripting – they were not spawning enemies; there was no script to summon demons… except perhaps for the very specific circumstances of the final boss in Doom 2.

So let’s see how it was really done. Remember this room?


This is E1M9 – a secret level from Doom’s first episode. If you don’t recognise this, you may still be able to guess what happens when the player walks onto that hellish-red star-shaped ritual area to pick up the rocket launcher. That’s right; it’s a trap! The moment you wander across the threshold…


…Demons erupt forth with great enthusiasm, teleporting in stylish fashion onto the middle of the ritual star thingy. They teleport in at regular intervals, giving no clue as to how many will appear in total. They just keep coming, as if some inter-dimensional floodgate had been ruptured. It’s a fantastic effect, a great gameplay mechanic, and throughout the rest of the game and its sequel you’ll see similarly brown-trouser-inducing teleport ambushes.

The thing is, the demons have no special AI. They’re programmed to find a direct path to the player, and kill them. That’s it. As I said, there is no special scripting for spawning demons. So like that bloke who played Skinner in X-Files, let me reveal how the magician that is Doom bullshits you:


Sound in Doom works on a flood-fill basis. That is to say, if you fart in one room, the sound event will flood outwards until it hits a solid wall, or a closed door. If you had one massive corridor fifty miles long, and the player whispered at one end… the demons at the other end would instantly turn around and “aggro”. There are various tricks Doom’s level design utilises to ensure that sound doesn’t go where the designer doesn’t want it to go (marking certain linedefs as capable of blocking sound, even if they’re non-solid, or marking enemies as “deaf” so they’ll only engage the player on line of sight). But sometimes a level designer wants the sound to flood somewhere else.

Did you notice the strange little black box on the wall, in that first E1M9 screenshot? Go on, take a look. I’ll wait. It’s there up near the ceiling, directly ahead of the player.

If you noticed it at all, you may have assumed that was just a glitch, a missing texture, or something wrong with the screenshot itself. You would be wrong. Let’s take a look at this area in the level editor:


That’s right. What you’re looking at is a tiny little tunnel connecting the ritual room to some other mysterious place not far away. There is no physical way the player can traverse that tunnel (it’s just few inches across in real-world terms), and that tunnel never opens up in any way shape or form. Rather, its entire purpose is to act as a “sound pipe” – to allow the sound of the player’s activities to flood right on through to that room in the top left.

See those red circles with arrows? Those represent enemies. Outside the level, in a room the player will never see, a bunch of demons stand around… waiting. Then, as the player fights their cohorts in the previous area, the sound floods right on through that little tunnel, alerting those idle demons. All those angry little demons suddenly aggro, and instantly start trying to find a path to the player – moving in the player’s direction with the unnatural awareness of rudimentary AI (they always know where the player is).

Except do you see the green lines again in that little room? The little square in the bottom right corner of that room? The outer grey lines give shape to a solid wall which has been lowered from the ceiling to block that corner of the room. The inner green lines? Those are linedefs with one simple action – to teleport that which crosses it to one specific location. The middle of the red star.

So there we have all the angry demons stomping around, jostling up against that solid wall, trying to move towards the player – trying to move towards that corner of the room.

When the player steps into the star area, linedefs there cause that little corner of the hidden room to open up – a secret door in a secret room, opened without the player knowing what happened.

Unobstructed, the demons mindlessly shuffle across the now-accessible green line, and are teleported to their ambush point.

The player thinks “Wow, that’s a really cool effect! I wonder how they did it? Probably with scripting.”

Now you know. It was done with little tiny pipes, artificial stupidity, and a bit of designer ingenuity.

Nicholas Brakespear

Former PC Zone slave labour, once wrote 9 reviews for a single issue in a desperate bid to make people love him, ended up finally getting paid in a regular freelance capacity just in time to see the magazine die. Currently writes novels for a (lack of) living, makes levels for Doom 2 in his spare time, and works on what he hopes will be Steam's first true text adventure - that is, one in which you can type boobies to see what will happen.

Leave a Reply

Your email address will not be published.