SRB2 Level Editing Made Easy

The Case Against Impassable (and One-Sided) Linedefs

You know that one-sided (and white) linedef in the lower left of secondlevel.wad? Open up its properties and have a good look at them:



Hmm. One-sided linedefs use a main texture, but no "above" or "below." Take note of that. Also look at the back sidedef:



Notice how everything is greyed out and the sector is shown as -1, a sector that doesn't exist (and never will). That means the linedef has no back sidedef — it's one-sided, after all.

Also note that, in the Attributes frame in the lower left, "Two Sided" is not checked, another telltale sign of a one-sided linedef. There are some other interesting options there that we'll get to later. "Impassable" sounds interesting.

You see, in Doom, you could make any linedef — any linedef at all — impassable, and then no one could walk through it, even if they otherwise would be able to. In SRB2, impassable linedefs won't work, and should be avoided.

And so should one-sided linedefs!

Take a stroll through secondlevel.wad as Sonic. As you are likely aware, Sonic has a cool double-jump attack called the "thok" because of the sound effect it makes. Try turning around from the start of the level and thokking through the wall — the wall that was originally right behind you.

Uh-oh. In software mode, you see something like this:



In OpenGL mode, it won't look that messed up, but it won't be pretty. What's going on here? What you've actually done is to thok outside the level! Here's a diagram:



In the messed-up screenshot above, I was the big white dot outside the level, looking in the direction indicated by the arrow. Yes, outside the level, in an empty space I'm certainly not supposed to be in. But how? How did it happen?

Well, it just so happens that SRB2 has a funny bug that allows this to happen on some one-sided linedefs. That bug probably won't ever be fixed. Even if it is, though, one-sided linedefs cause some other problems. Try playing as Knuckles and climbing on the one-sided linedefs. You can't, at least not properly. In addition, one-sided linedefs make your levels prone to camera screw-ups. And you'll see later that preventing the thok problem also makes it easier to have open-air levels (in which you can see sky in the background, not just a bunch of walls).

How do we make a level without one-sided linedefs? We can't, in fact. What we do is make a level without one-sided linedefs that the player can come into contact with. That is, we make a wall enclosing the player, with the only one-sided linedefs outside the wall. And how do we make a wall without using any one-sided or impassable linedefs? Why, we make a sector with the same floor and ceiling height, of course!

Make a sector or two sectors (it's easier to get right with two) surrounding the outside of the level. You should be able by now to do this without screwing anything up, although it will take some time and a lot of splitting and joining linedefs. (Remember Ctrl-Z. Technically, you haven't screwed anything up if you can use the undo feature to unscrew it up, or maybe I should say screw it down.)

When I was finished, I had two new sectors, 4 and 5, looking like this:



...and this:



These two new sectors will comprise my thok barrier. A thok barrier is a very important thing; all your levels should have one. (Now that you know about thok barriers, an easier way to create one would be to make a huge square when you start a new level, then create everything inside the huge square, using the huge square itself as the thok barrier. But keep following along here.)

The idea of the thok barrier is to prevent the player from being able to access any of the one-sided linedefs. And the thok barrier isn't supposed to change the way the level actually looks (at least not for now). So what I have to do is make the thok barrier sectors inaccessible.

I do this by setting their floors and ceilings to the same height. I've chosen 128 as this height, for reasons you'll see in the next section. Set both of your thok barrier sectors up like this:

Ceiling Image: FLOOR0_3
Ceiling Height: 128
Floor Image: FLOOR0_3
Floor Height: 128

It normally doesn't matter what floor and ceiling images you use, but F_SKY1 is a special case, and something different happens if you choose F_SKY1 as the ceiling of your thok barrier (this different something to be described in the next section). Now here comes the tedious part of thok barrier design, the part that makes the huge-square technique seem so attractive. You have to add textures for every single two-sided linedef that touches the thok barrier.

If you were to try the level as it is now, you would get the hall-of-mirrors effect, which is what the funky messed-up stuff you saw before you added Below and Above textures is called. That's because when you stood in sector 0, 1, 2, or 3, and looked at the wall, you were looking at a one-sided linedef, with GFZROCK as the main texture. (That's the default for new sectors, by the way, unless you change it somewhere in WadAuthor's options.) Now, though, you're "looking into" another sector.

You can't actually see that other sector, since it has zero height. But you can see below and above it. So, you guessed it, you have to set above and below textures.

So, set above and below textures on all the two-sided linedefs bordering the thok barrier. Remember to set them for the sidedef that faces away from the thok barrier, because that's the one you'll be standing in. You can do several linedefs at a time like I've done here:



That's a safe selection to make because those five linedefs all border the same two sectors, 1 and 4. And they're all facing the same way — all of them face sector 1. So I open Properties after right-clicking on one of the selected linedefs (doesn't matter which) and set the front sidedef's above and below textures to GFZROCK. Then I do another set.

When you're done, save and test your level again. If you see hall-of-mirrors again, you forgot a linedef somewhere. If you don't, try climbing the walls as Knuckles. They should all be climbable. Then try to thok through them as Sonic. No matter how hard you thok, you can't escape the level.

Try walking next to a wall and turning, to see if you can mess up the camera. I bet you can't! Thok barriers don't eliminate all camera problems completely, but they do minimise the most common kind (or the kind that would be most common if people didn't thok-barrier their levels).

(I noticed a weird SRB2 bug while writing this, one I think is new to Final Demo. If you climb the wall as Knuckles and go up 128 units, which is two blocks' worth in the GFZROCK texture, you fall off. However, if you jump back onto the wall above the 128-unit line, you can climb above it with no problems. Presumably the thing that's special about 128 units is that that's the height we chose for our thok barrier. This doesn't mean you made the thok barrier wrong. If there's a fix for this bug, it'll be news to me. Consider the bug a minor annoyance and don't worry about it.)