linked_portal_door

From Valve Developer Community
Jump to navigation Jump to search
Example of a linked portal: it connects to a room of the same size with white tiles.

Portal 2 linked_portal_door is a point entity available in Portal 2 Portal 2 and Strata Source Strata Source. It is a special type of portal without any effects, which can be used to seamlessly link together two distant parts of a map. These portals are square, and players can fire their portal gun through them. They are commonly called world portals by the community, referring to the fact that they are seamlessly integrated into the map rather than being placed by the player or a test element.

In the default FGD, the entity is represented as an axis helper. The red axis is normal to the surface of the portal, the green axis is the width, and the blue axis is the height. The default model has no directional indicators for these, so you must use the additional axis lines that appear when the entity is selected to determine which side is the front.

While this is a powerful entity, it has a number of bugs and considerations which must be taken into account when using it:

Icon-Bug.pngBug:
  • Having a solid, moving brush entity in close proximity to the portal causes it to close. Non-moving brush entities and animated or moving props are okay though.
  • Lasers passing through world portals will have the point they exit from offset based on the distance to a wall behind the world portal. If you are using world portals and lasers in the same map, you must make sure there is a wall directly behind the portal, otherwise lasers will not pass through correctly.  [todo tested in?]
Warning.pngWarning:
  • By default, having more than 4 portals visible on-screen (including regular portals, but not incluidng portals seen through other portals) will cause major graphical bugs. This can be fixed/worked around by setting the cvar r_portal_fastpath to 0 on clients. This has no known negative effects on its own, though having many portals visible at once will still degrade performance.
  • On lower graphics settings, world portals may stop rendering at a distance or when seen through another portal, so you should make sure there is something behind the portal for it to fall back to (rather than nodraw).
Note.pngNote:
  • The actual portal appears half of a unit in front of the entity's position, so to create a fully seamless link, it should be offset 0.5 units backwards using Hammer's transform tool (Ctrl+M).
  • Moving the entity will not dynamically change the portal's position (even with sv_allow_mobile_portals on), it must be sent an Enable input for it to update.
  • Portals are one sided, the back does not render.
  • Players will still funnel into world portals if sv_player_funnel_into_portals is enabled, the same as regular portals.

Example uses

Portal 2's impossible room.

All Puzzlemaker levels use world portals to connect the exit and entrance elevators to the respective corridors; this avoids the embed spaces of the doors needing to be extremely large to accommodate the entire elevator shafts. They are also used twice in the campaign (contrary to the commentary's claim that they are only used once): in the GLaDOS wakeup sequence where they are used to connect the incinerator shaft to GLaDOS' chamber, and in Finale 2 where they are used to connect the "trap" chamber to the main map. These are the only uses of this entity in the final game.

However, the developer commentary explains that Valve extensively used these throughout Portal 2's development to make prototyping and iterating on levels faster. By connecting separate rooms with portals, sections of the level could be added, changed, or reordered without having to give any consideration to whether or not the space was physically possible and without having to spend significant amounts of time moving around and reconnecting chunks of the level. For a period of time, "every connection between any space was a portal", and they would even switch between them dynamically. As the game's development concluded and levels were finalized, most of these portals were removed, aside from the two cases listed above.

World portals are also extensively used in The Stanley Parable for the sections that loop infinitely on themselves or where backtracking leads the player somewhere completely different than where they came from.

Keyvalues

Name (targetname) <string>
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Width (width) <integer>
1/2 width of the desired portal. Must be less than 1024, and match the corresponding property of the partner.
Height (height) <integer>
1/2 height of the desired portal. Must be less than 1024, and match the corresponding property of the partner.
Static Portal ([todo internal name (i)]) <boolean> (only in Strata Source)
If set to true, this portal does not ever move or toggle, and allows VRAD to cast light through it.
Note.pngNote:You need the -PortalTraversalLighting argument for VRAD to compile static lighting through world portals, and the -PortalTraversalAO argument for VRAD to compile AO through world portals.
Start Active (startactive) <boolean>
Whether to start the linkage as active from the start.
Note.pngNote:(As of DLC1) This will create a logic_auto entity somewhere in your map. The engine will try to tell you that the logic_auto has invalid i/o. You can safely ignore this.
LinkedPortalDoor:
Linked Partner (partnername) <targetname>
Another 'linked_portal_door' entity which will link to this one.

Inputs

LinkedPortalDoor:
SetPartner <string>
Set a new partner door.
Open
Open the door and cause the portal to activate.
Close
Close the door and cause the portal to deactivate.

Outputs

LinkedPortalDoor:
OnOpen
Called when the door has started its open animation.
OnClose
Called when the door has started its close animation.
OnEntityTeleportFromMe
Called when an entity enters this linked portal.
OnPlayerTeleportFromMe
Called when the player enters this linked portal.
OnEntityTeleportToMe
Called when an entity exits this linked portal.
OnPlayerTeleportToMe
Called when the player exits this linked portal.

See also