                              WAD Special Effects


This text is an ASCII conversion of the WWW page:

	http://www.daimi.aau.dk/~hykkelbj/doom/special/special.html

Check this page to see some better illustrations.
You will also be able to download the mentioned WADs directly 
by clicking.
................................................................

This text will constantly make references to the example WAD: special.zip
(53K). The special.zip is a zipped file, and can be unzipped on a PC using
Pkzip 2.04G (Binary).. I suggest you start by reading the contents, which
follow below. Here you can jump directly to the special effect that interests
you. If you need to read one of the other sections first, there will be a
reference in the start of the section.

Contents

  1.  The Deep Water effect
  2.  Invisible Stairs
  3.  Invisible Lift
  4.  Non-convex Invisible Areas
  5.  The Transparent Door effect
  6.  The Solid Window effect

                           1. The Deep Water effect

To see the deep water effect, you can load in the special.zip (53K) WAD, and
find the door marked SWIMPOOL to the west. Behind this door, you'll find a
swimpool. When you walk into this swimpool, you will see that your viewpoint
gradually lowers, giving you the illusion that you are walking on the button of
the swimpool, and not on the surface of the water.

The first time I saw this special effect demonstrated was in swimpool.zip (2K)
by Robert Fenske Jr. (rfenske@swri.edu), where the effect is demonstrated
convincingly in a single room. The effect was first described by Mathew J
Ledding-Hill, and it was later improved by Robert Fenske Jr. The discovery of
the deep water effect has lead to all kinds of other special effects, as we
shall see later.

This is one of the effects, that will give errors from any consistency
checkers, so if you don't want to see any errors from your editors consistency
checker, don't try to build this special effect. To build this special effect,
you need an editor that lets you change the sector references in a sidedef.
Some editors won't allow this, and are useless for this purpose. If you don't
already know an editor that can change the sidedef references, I suggest you
look around and try a few more editors. You might even learn an important
lesson by doing this: No editor can currently claim to be the best at all
things. One editor might be good at creating sectors, but doesn't allow you to
set the 2s flags for yourself, while another has a great THING editor, but
don't work too well with new graphics. Do what I do: Shift a lot between
editors, and find the best editor for the task at hand.

Construction of the Deep Water

To create the deep water effect, you take advantage of the following rule:

o===============================================================================o
| If you create a sector inside another sector, where the internal sectors	|
| sidedefs ONLY has sector references to the internal sector, then the floor	|
| texture will be painted in the floor height of the external sector, while the	|
| player will walk around in the floor height of the internal sector.		|
o===============================================================================o

To give an example, create the following map:

	(The numbers are sidedef sector references)
	x-----------------------x
	|	    1		|	(The dotted lines are two sided
	|			|	 while the dashed lines are one-sided)
	|	    2		|
	|	x.......x	|
	|	:   2	:	|
	|1     2:2     2:2     1|
	|	:   2	:	|
	|	x.......x	|
	|	    2		|
	|			|
	|	    1		|
	x-----------------------x

Now set the floor texture of sector 1 to F_WATER, set the floor height of
sector 1 to 0, and set the floor height of sector 2 to be -40. This gives the
impression of walking around in a pool of water. You can also set the floor
height of sector 2 to be 70, and you will feel like flying. (Remember to make
the ceiling high enough, so that a player can walk around in the height of 70).
Also be careful when setting a height below -40 (relative to the floor), as you
will get a HOM effect if the player get his head under water.

This first example is great fun, but it doesn't really lead anywhere, as it's
difficult to take the step of 40 units to get out of the deep water. To be able
to both enter and leave the deep water, you will need to create sectors within
sectors in different heights, so that they form a descending stair into the
pool. This is very easy to construct:

	(The numbers are sidedef sector references)
	x---------------------------------------x
	|		    1			|
	|					|
	|		    2			|
	|	x.......................x	|
	|	:	    2		:	|
	|	:			:	|
	|	:	    3		:	|
	|	:	x.......x	:	|
	|	:	:   3	:	:	|
	|1     2:2     3:3     3:3     2:2     1|
	|	:	:   3	:	:	|	
	|	:	x.......x	:	|	
	|	:	    3		:	|
	|	:			:	|
	|	:	    2		:	|	
	|	x.......................x	|
	|		    2			|
	|					|
	|		    1			|
	x---------------------------------------x

This resembles the WAD: swimpool.zip (2K) created by Robert Fenske Jr. Here you
can assign a floor height of 0 for sector 1, while sectors 2 and 3 get a floor
height of -24 and -48 respectively. This will make the water quite deep, while
it's still possible to climb out of it.

Please note that in this special effects we use sectors inside sectors, to
create the special effect needed. If we want to create other things like an
invisible stair, it's suddenly quite difficult to form the stair, so that it
consists of sectors inside sectors. Instead another method can be applied.

                              2. Invisible Stairs

If you haven't read about the deep water effect , I suggest you do that now.
The invisible stair special effect is very similar to the deep water effect. To
find the special effect in the example WAD: special.zip (53K) , you should find
the door marked "INVISIBLE STAIR" to the south, behind which you will be able
to try the effect.

Construction of invisible stairs

As I mentioned earlier it's impossible to build a stair with sectors inside
sectors like in the deep water. Instead I'll remind you of the general rule:

If you create a sector inside another sector, where the internal sectors
sidedefs ONLY has sector references to the internal sector, then the floor
texture will be painted in the floor height of the external sector, while the
player will walk around in the floor height of the internal sector.

This general rule implies that it's possible to create an invisible stair like
this:


	(The numbers are sidedef sector references)

	x-----------------------x
	|	  1		|
	|	     2		|
	|	x.......x	|
	|	:    2	:       |
	|1     2:2     2:2     1|
	|       :    2  :	|
	|	x.......x	|
	|	     2		|
	|	  1		|
	x.......................x
	|	  3		|
	|	     4		|
	|	x.......x	|
	|	:    4	:       |
	|3     4:4     4:4     3|
	|       :    4  :	|
	|	x.......x	|
	|	     4		|
	|	  3		|
	x.......................x
	|	  5		|
	|	     6		|
	|	x.......x	|
	|	:    6	:       |
	|5     6:6     6:6     5|
	|       :    6  :	|
	|	x.......x	|
	|	     6		|
	|	  5		|
	x.......................x
	|	  7		|
	|	     8		|
	|	x.......x	|
	|	:    8	:       |
	|7     8:8     8:8     7|
	|       :    8  :	|
	|	x.......x	|
	|	     8		|
	|	  7		|
	x.......................x



The sectors 1, 3, 5 and 7 are the steps, and they should all have floor height
0. (This is the height in which the floor is painted). Now give the sectors 2,
4, 6 and 8 some different floor heights (for instance 16, 24, 40 and 56
respectively). This is the height in which the player will walk. Then you have
an invisible stair.

Invisible rising stair

Now that you've created an invisible stair, you might want to go on and create
an invisible rising stair. This is a bit difficult, but not impossible. I'll
explain how to do it by extending on the stair that you already created . To
have the stair start in the lower position set the floor heights of sectors 2,
4, 6 and 8 to zero. Now for a rising stair to work, the sectors need to be
neighbours, but none of the sectors 2, 4, 6 or 8 are neighbours to other
sectors than themselves, so we'll need to do some kind of trick to get it to
work. The trick is this: create new neighbouring sectors that form a stair, and
edit the sidedef sector references so that these new sectors get the same
numbers: 2, 4, 6 and 8. Since sector 2, 4, 6 and 8 are neighbours now we can
make the rising stair work just like a normal rising stair.

One word of advise though: The linedef number of the new sector created should
be smaller than any of the linedefs in the original sector. This can be hard to
accomplish with most editors, so I advise you to build the dummy sectors 2, 4,
6 and 8 before the invisible stair itself.

If you forgot to build the dummy sectors first, I can give you the following
DEU trick: Split old lines in two, and one of the parts will get a new line
number (higher than any other line number) normally the "front" part will get
the new number:

 before:   split:   drag:

    ^        ^
    |        |   <- New line number.
    |        |
    |        x   <- drag this vertex
    |        |
    |        |
    x        x   <- to this vertex, and merge the two vertices.

When you've completed the new sectors, your invisible stairs should look like
this:

     
	(The numbers are sidedef sector references)

	x-----------------------x
	|	  1		|
	|	     2		|
	|	x.......x	|
	|	:    2	:       |
	|1     2:2     2:2     1|	The "dummy" sectors:
	|       :    2  :	|
	|	x.......x	|
	|	     2		|	x-------x In the dummy sectors
	|	  1		|	|   2	| there are no special
	x.......................x	x.......x sidedef sector references,
	|	  3		|	|   4	| so only one number is
	|	     4		|	x.......x displayed inside each sector.
	|	x.......x	|	|   6	| this is the sector number,
	|	:    4	:       |	x.......x and all sidedef references
	|3     4:4     4:4     3|	|   8	| are created just as usual.
	|       :    4  :	|	x-------x
	|	x.......x	|
	|	     4		|
	|	  3		|
	x.......................x
	|	  5		|
	|	     6		|
	|	x.......x	|
	|	:    6	:       |
	|5     6:6     6:6     5|
	|       :    6  :	|
	|	x.......x	|
	|	     6		|
	|	  5		|
	x.......................x
	|	  7		|
	|	     8		|
	|	x.......x	|
	|	:    8	:       |
	|7     8:8     8:8     7|
	|       :    8  :	|
	|	x.......x	|
	|	     8		|
	|	  7		|
	x.......................x
                    

Now you can make a linedef somewhere to activate the raising stair, and make it
point to sector 2. The invisible raising stair is demonstrated in special.zip
(53K) just behind the first invisible stair. If you let yourself drop down
behind the first invisible stair, you will find it impossible to get back
before you press the button, which triggers the invisible rising stair.

Note however that the invisible stair is not entirely invisible. I've put a
small texture on one of the steps, so you can see it raise...
Only the normal texture on the special inner sector is shown, so to create a
texture that sticks to the invisible raised floor like here, I've used the
"lower unpegged" flag.

Remember to put the dummy sectors close to the raising stair, as the sound
propagates from the dummy sectors, and NOT from the special sectors inside the
steps of the stair. (Actually I think the sound is generated by the lowest
numbered linedef, which we put in the dummy sector). This could of course be
used to generate a "Silent Invisible Raising Stair", but that might not be much
fun.

                               3. Invisible Lift

Now that you've seen how to create an invisible raising stair, an invisible
lift should be easy to create. An example invisible lift can be found to the
north in special.zip (53K) . The invisible lift turns out to be easier than the
invisible raising stair, but only because there is only 1 step...

To create the lift you need to create dummy sectors again. Otherwise the
special self-referencing sector will not be able to determine how low it should
go. Remember to create the dummy sector first, so the linedefs here get the
lowest numbers. The lift should look like this:

	(The numbers are sidedef sector references)

	:			:
	:			:
	|	    4		|
	|			|
	x-----------------------x
	|	  1		|
	|	     2		|
	|	x.......x	|
	|	:    2	:       |
	|1     2:2     2:2     1|	The "dummy" sectors:
	|       :    2  :	|
	|	x.......x	|
	|	     2		|	x-------x 
	|	  1		|	|   2	| 
	x.......................x	x.......x 
	|	  		|	|   3	| 
	|	     		|	x.......x 
	:	   5		:
	:			:


Assign a floor height of 0 to the sectors 1, 3 and 4, while the sectors 2 and 5
get a higher floor height like 64. Then make the linedef between sector 4 and 1
a switch activated lift, and make the sector reference point to sector 2. Now
make the linedef between sector 5 and 1 trigger when the player walks over it,
and the sector reference should again point to sector 2.

That's all. Now your invisible lift should be working. The dummy sector 3
determines how low the lift will go, and the linedefs neighbouring sector 1 are
set up to activate sector 2 as a lift, which controls the floor height.

                         4. Non-convex Invisible Areas

Now that you know how to create invisible stairs and invisible lifts, you might
think that you know how to apply this effect to any area, but if the outer
sector isn't convex you'll get into trouble in no time. The problem is that any
sub sector in the special raised sector needs to be a neighbour to the special
self referencing sector inside. If this requirement is not met, you will drop
to the level of the outer sector, and you could get trapped. To make sure this
doesn't happen, you should simply create the inner sector so large that there
simply is no room for the player to drop to the actual floor height.

An example of a non-convex sector where you still can walk around in the air is
given in the east part of special.zip (53K). Here I've enlarged the inner
sector to almost fill the outside sector entirely. The following figure might
clarify what I mean:


	x-----------------------x
	|.......................| (The dotted line is the internal 
	|:		       :|  self-referencing sector.
	|:     ...........     :|  See the WWW page for a more exact 
	|:     :x-------x:     :|  representation of this)
	|:.....:|	|:.....:|
	x-------x	x-------x
	

This ensures that all sub sectors are either inside the special sector, or is
at least a neighbour to it. Now we have covered a lot about invisible floors.
lets look at a different special effect:

                             5. Transparent Doors

The transparent doors can be viewed in the deathmatch WAD spchaunt.zip (86K)
created by Robert Fenske, Jr. (rfenske@swri.edu)

The same effect can also be viewed in the north part of special.zip (53K),
where I've used the standard DOOM 1 open door linedef. The effect is better if
you use the blasting doors now available in version 1.666 and higher. As you
can see in special.wad, there is a considerable amount of HOM when the door is
opened and closed. This looks much better when the blasting doors are used.

You might think that the transparent doors could be built much like the floor
special effects we have seen so far, but since the DOOM engine treats sectors
with the same ceiling and floor height in a special way this won't work.
Instead another method has to be used.

Construction of the Transparent Door

(by Robert Fenske, Jr)

In June of 1994, Alberto Barsella (alberto@astrpi.difi.unipi.it) reported to
the DOOM editing mailing list that he had found a way to create transparent
doors. His method was more cumbersome than the method shown below, but
nevertheless paved the way to using this feature in new WADs.

     	(The numbers are sidedef sector references and
 	 the Ln are line numbers for further reference)

	   L1	   L3	   L5
	....----x-------x----....
		:   3	:
		:	:
	 1	:2     2:     4
		:	:
	      L7:	:L8
		:	:
		:   3	:
	....----x-------x----....
	   L2	   L4	   L6


As shown in the figure above, you must start with a three-region section of a
level. You can start with a normal door sector and modify it appropriately. I
will refer to the area bounded by LINEDEFS L3, L8, L4, and L7 as the door area.
The six LINEDEFs labelled L1 through L6 are usual one-sided LINEDEFs. The two
LINEDEFs L7 and L8 are two-sided ones that will constitute the actual door
look. Sectors 1 and 4 are normally created sectors (and could be the same
sector - see the note below). However, there are two sectors inside the door
area, 2 and 3. The crucial aspects of a transparent door are all contained in
LINEDEFs L7 and L8; the ordering of LINEDEFS L3, L4, L7, and L8; and sector 2.

The table below details the specific requirements for each LINEDEF and sector:

        LINEDEF/SECTOR                  Description

                L1              one-sided wall, normal texture
                L2              one-sided wall, normal texture
                L3              one-sided wall, normal texture
                L4              one-sided wall, normal texture
                L5              one-sided wall, normal texture
                L6              one-sided wall, normal texture
                L7              two-sided wall no upper texture,
                                one-patch transparent normal texture with Y
                                offset equal to height of texture
                                optional lower texture,
                                second SIDEDEF references sector 2
                L8              two-sided wall, no upper texture,
                                one-patch transparent normal texture with Y
                                offset equal to height of texture
                                optional lower texture,
                                second SIDEDEF references sector 2

                1               floor height F, ceiling height C
                2               floor height F+1, ceiling height F+1
                3               floor height F, ceiling height C-1
                4               floor height F, ceiling height C

The most crucial requirement is not in the above table. This requirement is
that one of the LINEDEFs L3 and L4 MUST have a lower index number than L7 or
L8. If this is not the case, a HOM effect will be present inside the door. This
ordering is required because the DOOM engine uses the lowest-numbered SEG in a
SSECTOR (subsector) to determine which SECTOR to use to draw the SSECTOR.
Technically, at least one of the SEGS derived from LINEDEFS L3 and L4 must be
the lowest-numbered SEG of the SSECTOR created from the door region (or
lowest-numbered SEG for each of the SSECTORs created if the region is split in
any way or the region is non-convex to start with). In principle, having
LINEDEFs L3 and L4 with lower indices than L7 and L8 could not guarantee the
correct SEGs generation. But as a practical matter all the node builders I am
aware of preserve the SEGs ordering and any extra SEGs created during the node
generation are attached to the end of the SEGs list (and thus will never have
lower indices than the SEGs originally derived from L3 and L4).

Though the lower unpegged ("Lo") bit of LINEDEFs L3 and L4 are typically set
for a normal door, this bit is irrelevant for movement for a transparent door
as the sector associated with these LINEDEFs never moves. It's only use would
be to anchor to the bottom the particular textures on these LINEDEFs. Do not
make the transparent door wide enough so that a player can be fully inside the
door when it closes. If this happens, the player has no way to get the door to
open because the player will now be facing the left side of the LINEDEFs that
are the door (L7 and L8) and consequently the door will not be activated.
However, switches could be placed on LINEDEFs L3 and L4 to open the door.

note: IF you create the door so that it has the same sector on both sides of
the door, you should be aware that this means that sounds will pass through the
door and might wake monsters on the other side. Maybe this is exactly what you
want, and using this you can create doors that let sounds pass.

                          6. The Solid Window effect

(by Robert Fenske Jr.)

The solid window effect is a window that the player can see through, but can't
shoot through. Now that you've seen how to construct the transparent door
special effect, it should be easy to make a solid window. You just omit the
linedefs that opens the door, and place the "stuck" door inside the window.

----------------------------------------------------------------------------
Jens Hykkelbjerg / hykkelbj@daimi.aau.dk
