Knowledge Base - Portal Door

Portal Door


Portal Door Opened
Portal Door Closed
Figure 1: Portal Door Opened and Closed

The flexibility of the ACS scripting language becomes in apparent in this unusual door I call a portal door. The door opens for a few seconds then closes up. It looks quite cool as it appears in the wall as it opens and then disappears as it closes. The demo wad portaldr.wad illustrates this technique.

Map Layout
Figure 2: Map Layout

As Figure 2 illustrates, the door is actually made of several tagged sectors. These sectors have a floor and ceiling of 64 which is the middle of the room height of 128. The door is made by moving the floor and ceiling a pre-determined amount, pausing and then moving the floor and ceiling back to the original position.

The sectors are paired so that the sections of the door move in unison to make the effect symmetrical. However, there can be numerous variations. The door could open left to right, or every other sector moves at a different rate. Also increasing the number of moving sectors could enhance the visual appeal of the door.

The facing lines of the sectors are tagged with the ACS_Execute function and marked as player uses and repeatable. The door mechanism itself is contained in a simple script.

script 1 (void)
{
    Floor_LowerByValue(1, 16, 16);
    Floor_LowerByValue(2, 16, 32);
    Floor_LowerByValue(3, 16, 64);

    Ceiling_RaiseByValue(1, 16, 16);
    Ceiling_RaiseByValue(2, 16, 32);
    Ceiling_RaiseByValue(3, 16, 64);

    delay(175);

    Floor_RaiseByValue(1, 16, 16);
    Floor_RaiseByValue(2, 16, 32);
    Floor_RaiseByValue(3, 16, 64);

    Ceiling_LowerByValue(1, 16, 16);
    Ceiling_LowerByValue(2, 16, 32);
    Ceiling_LowerByValue(3, 16, 64);
}

Four different specials are used to make the door work properly, but all of them use the same parameters.

Floor_LowerByValue door-tag, speed, distance
Floor_RaiseByValue door-tag, speed, distance
Ceiling_LowerByValue door-tag, speed, distance
Ceiling_RaiseByValue door-tag, speed, distance

  • door-tag: This is a unique number that identifies the door sector.
  • speed: How fast the door moves.
  • distance: The distance the floor or ceiling moves.

In the portal door, the sectors are lowered by different amounts to get the "portal" look. The delay allows the player to move through the door, and then the script executes the opposite functions to close the door.

Although simple in design and use, the portal door is very visually appealing and allows the level designer another tool to create a unique and immersive world.

Sources

ZDoom reference by Marisa Heit.

Back