rails - making better handrails


When you want to prevent the player from passing without preventing him or her from seeing, what do you do ? There are two classic solutions that have been used in the original doom levels : a low wall and a linedef with the impassable flag set.

The low wall works well but it blocks the sight downwards which is sometimes a big drawback (for visual reasons). The impassable linedef is fine with semi-transparent textures that span the whole space between floor and ceiling, but it's not ideal in the case of a handrail.

Fortunately, there is a better way to make a handrail : using a self-referencing sector (SRS), as shown in the demo wad.

The classic method

The first room (the blue room) illustrates the classic method : the impassable linedef.

Screenshot of first room

What's the problem ? The lost soul cannot cross the handrail, even though there is plenty of space above. It pathetically floats along the handrail, taking runs to attack you only to stop dead after a few centimetres, bumping against an invisible barrier.

The SRS method

The second room (the green room) illustrates the self-referencing sector method.

Screenshot of second room

As you can see, this time the lost soul was able to cross the handrail. Which procures the author unadulterated delight (and the player equally unadulterated dismay, but that's their problem).

So how do we go about it ?

  1. Create a new sector that is identical to the sector where you want the handrail to be but make its floor height 25 units higher.

  2. Create a double-sided linedef. This will be the handrail.

  3. Assign both sidedefs of the linedef to the new sector. You now have a self-referencing sector.

  4. Set the middle texture of both sidedefs to something appropriate, such as MIDBARS3.

  5. Make sure the linedef has the lower-texture-unpegged flag set.

  6. Adjust the Y-offset of both sidedefs so that the top of the texture is at the same height as the floor of the SRS. To do that, the Y-offset should be minus the height of the texture. For example, in the case of MIDBARS3, the Y-offset should be -64.

That's the basic procedure. You can try it now if you want but there's still a couple a details to take care of before you have a usable handrail. Read on.

What are sectors 13 and 14 for ?
Why do they have a funny light level ?

If you look at the map in a level editor, you will notice that each handrail is enclosed in a narrow sector. There are two good reasons for doing that. Firstly, the effect of a SRS tends to extend beyond the linedefs from which it is made. How far and in which directions it extends is difficult to predict ; it depends on the shape of the room and the node builder you use. To avoid those kind of problems, you frame the SRS with two-sided linedefs that have "normal" sector references. Those linedefs tell the node builder where the SRS stops.

Secondly, Doom does not clip the textures of double-sided linedefs at floor level unless there is a difference in floor texture or light level between either side. Enclosing each handrail in a sector that has a slightly different light level forces the engine to clip them properly. If all this sound mysterious, try changing the light level of sectors 13 and 14 to match that of sector 1 and see for yourself.

So what's the catch ?

Since the handrail is a sector, it stops projectiles. Lean against the south handrail and try to kill the demon to the north with plasma or rockets : your projectiles hit the handrail, not the demon. Interestingly, the handrail does not seem to stop bullets and the BFG. I suppose that Doom handles those weapons differently.

Monsters below you might not be able to reach you, for the same reason.

If someone plays your wad on a port that has jumping, he or she can cross the handrail by jumping over it.


The reason why the SRS is 25 units above the enclosing sector is that 25 units is the shortest height that the player cannot climb.

If you have trouble selecting the SRS in DEU or one of its descendants, try moving one of the vertices so that the linedef is not horizontal.

If you're lucky, you may be able to get away without enclosing the SRS but the problems might reappear if someone rebuilds the nodes with a different node builder, or with a different version of the same node builder, or with the same node builder used with different options. It's probably a good idea to design wads so that they survive having their nodes rebuilt. For one thing, it makes life easier for node builder maintainers who are doing regression testing.

There are several ways to prevent the bleeding into the ground. You could use a different texture or floor height instead of a different light level. If you use a different light level, it's best to use one of the form n × 16 + 1 (for example 129, 145, 161, 177, etc.). Don't use n × 16 - 1 or the difference will be visible. Naturally, if the height of the handrail texture is the same as the height of the SRS (i.e. 25 pixels), you don't have to worry about bleeding in the first place.


If you missed it, here is the wad.

This is http://www.teaser.fr/~amajorel/rails/. This document and the accompanying wad are copyright André Majorel 2000. All rights reserved. Last modified AYM 2000-10-08.