Tutorial: All-In-One Portal Guide for GZDoom

Feb 15, 2018 | Tutorial

Let’s start with the easier option:
The Line Portal

Line portals are the easiest portal to make – I dare say they are easier to build than a teleporter! Let’s start with the uses for this kind of portal and what it does. Line portals create a seamless transition from two areas that are separated in the map. The easiest way to think of them is functionally like a teleporter, but visually like you’re ‘snapping two separate parts of the map together’.

THE TYPES OF LINE PORTAL

It’s worth noting that there’s 4 types of line portal:

  • Visual (acts like a solid wall)
    • This acts like a solid wall. Imagine this essentially like a ‘HD 3D Camera Texture’.
  • Teleporter
    • Walking through one side of the portal teleports you to the opposite side.
  • Interactive
    • A lot like teleporter, however projectiles can pass through it and feels more ‘natural’.
  • Static/Linked
    • The same as interactive but now it displays on the automap as connected, too. Bare in mind that this is the hardest to work with as the lines defining both sides of the portal must be the same length and angle.

HOW TO CREATE LINE PORTALS

Lets start by creating the rooms that make up each ‘half of the portal’ first. In this example we’re making a portal that measures the same as a standard door (128 x 128). Ensure that the floor and ceiling heights are identical on both sides of the portal, otherwise this will not work properly!

Once your rooms either side of the portal are ready, draw an empty space connected to each of the portal’s lines that is at least 128px deep. The deepness of the portal defines what can and cannot pass through it, so as a precaution I would recommend leaving more space behind it in case a larger creature tried to pass through, such as an Arachnotron. If you know only a player is going to pass through, you can get away with having it 64px deep; but there’s little reason this would be the case. Refer to the picture below if you’re unsure.

Now, set each portal line to have a unique (unused) line tag, as seen in the image below:

This step assumes you’re mapping in UDMF format, however if you’re mapping in Doom in Hexen format this is still possible but you may need to refer to the wiki about the “thisline” parameter of the Line_SetPortal action to set the selected line’s tag (https://zdoom.org/wiki/Line_SetPortal)

Lastly, we need to set each of the portal lines to use the Line_SetPortal (Line action 156). Make sure that each line points to the other line’s tag, so the 1st portal points to the 2nd portal, and the 2nd portal points to the 1st portal (unless you’re looking to make some really trippy effects, such as Confinement256’s final map by Bauul). I’d suggest using the interactive portal type for this tutorial’s sake, and to experiment with the other portal types yourself to get an understanding of how they work.

Now hop in game and test it out – you should be able to walk through the portal seamlessly as if the terrain was actually connected!

Troubleshooting

Did you have any troubles? Is it not working? No worries. Here’s a checklist of things to double-check.

  • Are both of the portal’s lines tagged correctly?
  • Do both portals point to the opposite side?
  • Is the floor height and ceiling height exactly the same on both sides?
  • Is it displaying correctly but not letting you walk through?
    • Double check that you left enough space behind the portal for actors to pass through. You’ll want enough space to match the largest actor that’s passing through. If it’s a player, leave 64px, if it’s something larger like a mancubus, leave 128px, etc.
    • Make sure both portals are set up properly. It might be the case that you forgot to set one to Interactive.

Moving on to Stacked Sector Portals

Did you succeed with the line portals? Assuming you did, you’re probably ready to find out about stacked sector portals. I often refer to sector portals as “vertical portals” and line portals as “horizontal portals”, since this is the motion the player can make as they pass through each respective portal type.

Stacked sector portals are relatively easy to work with, if you remain careful and conscious of your mapping. The way to think about a stacked sector portal is to visualise that you’re stacking two rooms on top of each other.

Let’s use the age-old classic toy, Lego, as an example – you’ve made two separate rooms with your lego, and now you want to put one on top of the other like a building. The first of the rooms has a hole in the ceiling, the other has a hole in the floor. When you use stacked sectors it’s Doom’s way of essentially placing one room on top of the other, as demonstrated below:

Incidentally this means you’ll need to make sure that the ‘holes’ in each room are the exact same measurements so that the portal lines up.

First Of All, Create The Two Basic Rooms We’re Going to Connect With a Portal

To have stacked sectors in our map we need a ‘top half’ and ‘bottom half’ for our portals to connect. To keep this tutorial simple, lets start with a basic, detail-less room which is 512x512px in size, with a floor height of 0 and a ceiling height of 128. In the center of this room, we’ll draw a 256x256 square and increase the ceiling height to 192. If you’re unsure of how this should look, reference the below screenshot.

Now duplicate this room. I recommend using copy & paste instead of re-drawing this room to ensure the measurements are correct. When we connect the portal we will want the geometry to line up rather than be misaligned – this prevents your map having “void leaks” which would allow the player to get out of bounds without using cheats… unless you’re looking to make a glitchy mess that could crash the game on purpose, avoid this at all costs!

With the newly copied room, modify the floor/ceiling heights as following: In the outer ring, make the floor 256 and the ceiling 384. In the inner sector, set the floor to 192 and the ceiling to 384. Take note of how the ceiling of the “lower inner sector” lines up with the floor of the “upper inner sector” – these will be the parts we attach together with portals; and they need to connect at the same height for it to work.

Creating The “Anchor Point” and Making the Portal Functional

As the title says, let’s create an ‘anchor point’. I’ve tried and tested several methods, and was fortunately advised of a perfect way to handle this by Gutawer – so I’ll give credit where credit’s due! All you need to do is find somewhere within the portal sectors which is memorable; for example, the top left corner, and add a small line.

Refer to the screenshot below – you’ll see in both sectors we have a small line in the same place, top left, about 16px wide, then split into two with a vertex in the center. This line serves as the anchor point and all tagged sectors base their positioning on this line.

Before we apply portal action to the lines, we need to give the inner sectors a tag. In the lower half, give the sector a tag of “1”. and in the upper sector, a tag of “2”. Now we can apply line action 57:Sector_SetPortal to the 4 lines that create out ‘anchors’. They will all have slightly different settings, so follow the below as closely as you can.

Lower Portal, Left Anchor Line

Tag: 1
Type: 6 (Interactive)
Plane: 1 (Ceiling)
Misc: 0
Opacity: 0

Lower Portal, Right Anchor Line

Tag: 2
Type: 6 (Interactive)
Plane: 0 (Floor)
Misc: 1
Alpha: 0

Upper  Portal, Left Anchor Line

Tag: 1
Type: 6 (Interactive)
Plane: 1 (Ceiling)
Misc: 1
Alpha: 0

Upper Portal, Right Anchor Line

Tag: 2
Type: 6 (Interactive)
Plane: 0 (Floor)
Misc: 0
Alpha: 0

The Portal Is complete!

That’s it, assuming you’ve followed the instructions carefully, you’ve now got a working pair of portals! Pop in a player start point if you haven’t already done so, smash that test button and stare in wonder at your fully functional room-over-room portal trickery!

Example Uses

Below is a small gallery of Line & Stacked Sector portals in use, hopefully these can serve as inspiration and/or as reference for your future portal usage!

Thanks for reading. If this tutorial’s been of any use to you I’d be hugely thankful if you could share this tutorial with your friends and/or drop a comment below. Happy mapping!

Tutorial Difficulty:

Line Portals:

Sector Portals:

Required Tools & Resources

  • GZDoom Builder
  • Increasing patience based on how extensive your portal use will be
    • (Don’t be scared, it’s not that bad!)

Any Issues?

Line portals as covered in this tutorial are “easy peasy“, but sector portals can be tricky stuff when you first start out. As with any advanced mapping technique, there’s a plethora of things that could potentially go wrong with sector portals. Below is a list of things to check if you’re having issues:

  • Check that your ‘anchor lines’ as I refer to them in this tutorial are in the same position relative to eachother
  • Ensure that the lower and upper sectors are tagged appropriately in all areas they are used
  • If things still aren’t working but used to work, try undoing your work or restoring a backup
    • Needless to say, it’s good practice to backup your map before you begin a mapping session!
  • If the game is crashing, it could be that you’ve got a misplaced sector tag causing an ‘infinite loop’. Portals cannot / should not reference themselves (so no ‘lower sector tag’ in the ‘upper sector’ and vice versa)
  • Refer to the ZDoom Wiki – https://zdoom.org/wiki/portal
  • If you’re still having issues after trying the above, try reaching out to me via Discord and I will see if I can help.

More Tutorials: