# Zone Builder tutorial/Sectors and textures

 Zone Builder tutorial [view]

In this chapter, you will learn how to use sectors to shape the landscape of your level. You will create sectors with different heights and learn which textures have to be used in which situation, you will learn how to connect sectors with each other and delete them, and you will learn what the middle texture is used for.

## Textures

Now that you are familiar with the most basic terms and techniques of level making, we will take a look at how to apply them in an actual level. First of all, we will take a look at the differences between upper, middle and lower textures. Before we do that though, you should refresh your knowledge of front and back sides: The front sidedef is always the one with the notch in the middle. The sector that this sidedef faces is the front sector of the linedef. The back sidedef is the one without the notch. The sector that this sidedef faces is the back sector of the linedef. Now let's take a look at the differences between the textures:

Textures on a linedef.
• Upper – Upper textures connect two ceilings of different heights. That means that if the back sector has a higher ceiling height than the front sector, the back upper texture must be set, since the back side will be visible for the player. Likewise, if the front sector has the higher ceiling, the front side will be visible, and thus the front upper texture must be set.
• Lower – Lower textures connect two floors of different heights. That means that if the back sector has a lower floor height than the front sector, the back lower texture must be set, since the back side will be visible for the player. Likewise, if the front sector has the lower floor, the front side will be visible, and thus the front lower texture must be set.
• Middle – Middle textures are a bit more complicated. They are intangible, which means you can pass through them in-game. Unlike upper and lower textures, which are tiled to fill up the height difference between the surfaces they connect, middle textures are normally drawn only once and do not tile unless you explicitly specify that. Their most common use are grass borders and other purely visual effects. In most cases, both sides of a linedef will receive a middle texture so that it is visible from both sides.

We will now test your understanding of the concept of front/back and upper/lower textures on some examples. By doing this, you will also learn how to make raised ground and pits. Middle textures will be explained in detail later, since they're somewhat different from normal textures and also a bit harder to make.

### Raised floor

We will begin with some raised ground. Draw a small square sector (128×128 is a good size) somewhere in the test level. Note that depending on the direction in which you draw the sector, the front sides of the linedefs can face inwards or outwards. If you draw it clockwise, the linedefs will face inward. This is normally recommended, but it makes no practical difference. If you draw the sector counterclockwise, the linedefs will face outward. For our purposes, draw the sector clockwise.

In its current state, the new sector has the same properties as the sector surrounding it, so there is no visible difference if you play the level. Now select the sector in Sectors Mode and change the floor height to 32 fracunits. Since the floor is now higher than that of the surrounding sector, the sector will now be surrounded by walls for which you need to specify textures. Before you do so, try to figure out yourself whether you need an upper texture or a lower texture and which side it needs to be placed. Then continue reading.

The height difference lies in the floor height, while the ceiling height is the same for both sectors. That means we need a lower texture. The front sector of the linedefs is higher than the back sector. That means that when playing the level, we will be able to see the back sides, but not the front sides. Therefore we need a back lower texture. Now select all linedefs of the sector (you have learned how to do that in the previous chapter) and give them `GFZROCK` as a back lower texture.

### Lowered floor

As a second step, let's create a pit. Draw another square sector like the one before (the linedefs should face inward again), but this time, give it a floor height of -32 fracunits. Again, try to figure out first which textures you need and then continue reading.

Since we are connecting floors again, we will also need a lower texture for the linedefs. But this time, the front sector is the lower one of the two. When standing inside the pit, you will be able to see the front sides, but you will never be able to see the back sides. Thus, you need to apply front lower textures to the linedefs.

### Lowered ceiling

It gets a little more complicated when both upper and lower textures are involved. However, right now our ceiling is still displaying the sky, so upper textures won't make much sense (in fact, the game won't display them at all in this case). To change the ceiling to a regular flat, select all sectors (including the thok barrier) by left-clicking on them in Sectors Mode or drawing a box around the whole level with the mouse. Then right-click on any sector. Now you can change the ceiling flat for all sectors at once, so change it to `GFZFLR01`. However, since your thok barrier is lower than the ceiling of the actual level, the inner walls of the thok barrier are now missing an upper texture. You can either raise the thok barrier to match the ceiling height of the rest of the level (don't forget to raise both floor and ceiling), or apply an upper texture.

Now select the pit sector from the second example and lower its ceiling to 480 fracunits. Essentially, we now have a sector that's shifted 32 fracunits down in comparison to the surrounding sector. We already have front lower textures for the floor. Since the sector is merely shifted down, it might seem logical that we need front upper textures for the ceiling. However, this is wrong. While the textures for the pit face inside and thus need textures on the front side, the ceiling is visible from outside the sector, so we need upper textures on the back side.

Apart from middle textures, this example is the most complicated situation you will encounter when texturing, so if you have understood the idea behind this, you have understood the whole concept.

## Connecting sectors

When making a level, there will be situations where you want sectors to be connected to each other through a shared linedef. There are several methods for doing this. Remember the two sectors we made before, one with raised ground and one with a pit? We will now overlap these two so that they share a linedef.

First, make sure the sectors are positioned next to each other. You can do that by going into Sectors Mode and simply dragging one of the sectors around while right-clicking until it's to the right of the other one. Now drag it even further to the left until its leftmost linedef is right on top of the rightmost linedef of the other sector. If you let go of the mouse now, the linedefs will merge into one. This happens because the Merge Geometry option is enabled, which makes the overlapping vertices stitch together. Another method is to go into Vertices Mode (you will have to undo the last few actions until the sectors are separate again) and drag the two leftmost vertices of the right sector to the left until they overlap with the two most rightmost vertices of the left sector. In this case however, the sector whose vertices you moved will change its shape, which must be manually adjusted afterwards.

If you want to create a new sector that is connected to an already existing sector, you can create it next to the already existing sector and connect them via the above methods. However, there is an even quicker method: Go into Draw Lines Mode, which is at the top of the editing modes bar to the left. Now left-click on one of the vertices that is attached to the linedef that you want to become the shared border of the two sectors. You should now be able to draw a new linedef from the selected vertex. Now draw the geometry of the new sector until you end up at the vertex at the other end of the border. Place a new vertex on it and right-click. The new sector will be created and the linedefs that belong to the original sector will have their references changed so that both sectors are closed.

To split an already existing sector in two, you can draw the line(s) that will divide them and then right-click. Again, the sector references will automatically be corrected. If you want create a sector that shares borders with more than one existing sector, draw all the stand-alone linedefs separately. Once the last one is drawn, the program should automatically make a new sector out of the enclosed area. Note that although Zone Builder rarely makes mistakes while creating new sectors, sometimes newly created sectors might be unclosed. In these cases, you need to correct the sector references for each linedef separately. You can check the map for unclosed sectors and other errors in Map Analysis Mode.

## Deleting sectors

Deleting a sector is unfortunately not as easy as you might think. If you highlight the sector you want to delete in Sectors Mode and press the delete key, the sector will be removed along with the associated front sidedefs, but the linedefs and their back sidedefs will remain. If you test the map, you should see a huge pillar where the sector used to be. To properly delete a sector, you must select all of its linedefs and delete them.

However, it becomes more complicated if the deleted sector is connected to another sector. As an example, try to delete the pit sector you made earlier. Of course, you can't delete the linedef that is also part of the raised sector, because then that sector would be unclosed. Instead, you must keep it and only delete the other three linedefs of the pit sector. However, if you delete them normally, the back side of the remaining linedef will still be configured to face the deleted pit sector. You can prevent this by pressing the backspace key instead of the delete key when deleting the other linedefs. In this case, the editor will try to keep the remaining level geometry intact, which in this case means correcting the sector reference. If the editor fails to keep level geometry intact, you may have to manually correct the sector references in the linedef properties window.

## Middle texture

When we took a look at the different textures, we left out the middle texture. This is because the middle texture is slightly more complicated to deal with. Essentially, the middle texture is an intangible (which means it can be passed through) texture that hangs down from the ceiling or pops up from the floor. Unlike normal textures, it doesn't cover a wall, because there is no wall to cover, and it doesn't connect floors or ceilings. We will take a look at how it works by adding grass borders to the sector with the raised ground. Before we do that though, change its floor flat to `GFZFLR02`, so that it actually has a grass floor.

Now select all linedefs that belong to that sector and change their front and back middle textures to `GFZGRASS`. We need textures on both sides here because the grass borders can be seen from both sides. If you test the stage now, you will see that the grass borders hang from the ceiling instead of popping out from the floor. This is because middle textures attach to the ceiling by default. You can change this by giving the linedefs the Lower Unpegged flag. When this flag is set, the textures will attach to the floor.

You can also make middle textures tile so that they extend from floor to ceiling by checking the Repeat Midtexture flag. This is useful for fake walls that can be walked through, but appear as normal. Since the grass borders would look weird when tiled, change the middle texture from `GFZGRASS` to `GFZROCK` before you do this. If you test the stage now, you should see that the sector is enclosed in walls stretching from the floor to the ceiling, but can be nonetheless entered.

 Zone Builder tutorial [view]