Portal 2

Portal 2

Not enough ratings
p0rtalmaster's Hammer Guide Series Part 13/19
By The Sojourner
Hello and welcome to part 13/19 of my series of mini-guides, designed to help you learn perhaps what is the biggest part of the Portal 2 Authoring tools: Hammer.

For a super-quick version of this series, please check out my other guide, Hammer for the Flustered.
   
Award
Favorite
Favorited
Unfavorite
Intro (and a mild warning)
You have now reached the advanced section of my guides. Hopefully you should be very comfortable by now with Hammer and what it can do. You should now fully understand this powerful tool, and if you do not, now is a good time to reflect on your shortcomings by reading my previous guides before moving on.
The Grand Entrance...


...to any ordinary Test Chamber or Enrichment Sphere begins with an elevator. It also ends with an elevator.



Much of what makes a good elevator entrance is just details, mostly prop_static and func_detail, plus the occasional prop_dynamic for animation (e.g. the fans above the player's head). I highly recommend you first check out Valve's maps and instances to see how they did it before trying your own designs (the instances ending in _base make for fine study) However for the core part that is the elevator, you'll need:
  • A prop_dynamic, which will be the elevator model. It's either models\elevator\elevator_b.mdl, models\elevator\elevator_escape.mdl or models\props_underground\elevator_a.mdl, depending on your theme (several additional models and some extra stuff will be needed; the models should be nearby).
  • A func_tracktrain (brush entity; use nodraw for this), sounds set accordingly for theme. If not in an Enrichment Sphere, the speed ("Max Speed" keyvalue) is typically 300 (although Valve has used slower speeds on occasion). Otherwise the speed to use is 120.
  • Some path_tracks to control the speed of the elevator. The func_tracktrain will move along the path created by linking these entities via their keyvalues.
  • Some trigger_onces to get things going, change lighting and videos, etc.
  • An info_player_start located inside the elevator
  • A weapon_portalgun if you want/need your player to start with the portal gun
  • An env_soundscape (re-read Guide 3 to see why)
The assembly should be real simple and intuitive:



1) Shape the func_tracktrain so that it covers just the top and bottom of the elevator (the prop_dynamic). You'll need two brushes for this.

2) Position your path_tracks so that they follow the elevator shaft.

3) Inside the elevator, place the remaining entities.

4) Set the I/O and animations for the prop_dynamic accordingly. Because this is my first "Advanced" guide in the series, you'll be on your own for this one. Just remember to use the model browser to look up animations for the elevator, such as opening and closing doors (you'll also find animations for pre-arrival and pre-departure).


Here's the general flow of events to help guide your I/O setup:

1) When the player spawns in the elevator, have it move and maybe adjust lighting. If not in an Enrichment sphere, turn on the elevator videos.

2) When the player arrives, adjust lighting again and do animations to open the elevator (and containing tube if not in an Enrichment Sphere) once it stops.

3) If not in an Enrichment Sphere, switch soundscapes (using env_soundscape or the triggerable variant) whenever the player gets in/out of the elevator.

4) If not in an Enrichment Sphere, turn off the videos, adjust lighting and switch soundscapes again.

At any point, you can try adding a voice line (using an ambient_generic or logic_choreographed_scene).

If not inside an Enrichment sphere, the soundscapes typically used are:
  • EntryExitElevator.Interior for inside the elevator,
  • EntryExitElevator.Exterior for outside the elevator (if using a clean or late reconstructing theme), and
  • EntryExitElevator.IndustrialStairs for the stairs and antechamber area.
Otherwise you can just start with your usual Enrichment Sphere soundscape (ug_sphere_water_01 is a good place to start).

After the elevator room, if your puzzle does not take place inside an Enrichment Sphere, there is often an antechamber with a test chamber sign (as in many of GLaDOS' Test Chambers and every PeTI map, for example). For the sign it's just best to use the instance instance/p2editor/info_sign_sp_clean.vmf. This instance will correctly display the name and (hopefully, once Valve fixes it) the number of the chamber you're in, as well as the hazard/info signs of what testing elements are featured.
Exiting a Test Chamber
First and foremost, no matter what theme you have, as one of Aperture Science's security measures (and as an anti-cheat device) we need to use a fizzler before the player reaches the elevator. Re-read Guide 11 for details on that, as this fizzler is nothing special — there's even an instance for it (in the instances\gameplay directory). It just stays open and active all the time. As the player passes through this fizzler, so does the test chamber's exit door (if there is one) close behind them.

If you're working in an Enrichment Sphere, it's pretty simple to get the player on their way: just reverse the process for elevator entry. Otherwise, you'll need to do a little more, as before. You'll need the same stuff, but without the info_player_start and weapon_portalgun of course.

Meanwhile, in the other elevator rooms, you're also to reverse the process for elevator entry, but remember, as the player enters, they'll need a trigger to turn the elevator videos ON instead of off (I don't think they're ever turned off while you're still playing, but if you want to turn them off as the player leaves, go ahead).
Elevator Videos


You might be wondering how to implement these. It's easy really: you just need to use the vgui_movie_display entity, and set it to play a video when triggered (using the Enable input via a trigger_once). You can select the video by setting the "Movie Filename" keyvalue (check the VDC Wiki for a list of video files to use). Portal 2 video files use the Bink Video (.bik) file format and custom .biks cannot be embedded into any map for the workshop.

For the round elevator rooms where you're surrounded by these videos, you'll need several of these entities, each with different U (horizontal) and V (vertical) minima and maxima. Because each entity is going to have a different set of U and V values, they have to be named separately (yes, each individual one — no grouping). To begin with, you'll need to first use the SetUseCustomUVs input on each vgui_movie_display via a logic_auto. Then you'll need to use use the SetUMax and SetVMax inputs and some logic_relays for organization.

The background for every elevator video is simply a worldbrush textured with something like elevator/elevator_screen (or the broken variants) on the front face. Next, for each screen, the entity goes in the bottom left corner and 0.25 units off of the brush (otherwise there's that weird-looking "Z-fighting" effect). Finally, for each of the vgui_movie_displays, set the width and height to the width and height of each of your panels (this, thankfully, can be done in one step if your panels are all the same size).



Although the entity is positioned where it is, this does not quite reflect the UV scale it uses. U=0 is all the way left whereas U=1 is all the way right, and V=0 is at the top whereas V=1 is at the bottom. Keep this in mind when rescaling each of the vgui_movie_displays for your video display. This same UV scale can also be used to rescale overlays (but there we use the keyvalues instead of inputs).

In some of Valve's elevator rooms, the U values to split from are multiples of 1/23. The V values to split from are even simpler: 0.0, 0.5, and 1.0. Valve ultimately decided to write a script — video_splitter.nut (viewable in Notepad) — to handle the video splitting because of its complexity, and also to be able to conveniently create various effects for video splitting. This does not mean, however, that you need to know how to write a script to make elevator videos work.

It's typical to create a trigger_once where the player starts to leave the elevator room to turn off the videos and some lights. This same trigger also opens the door to either the test chamber or the antechamber containing the test chamber sign.
Starting and Ending Behind-the-Scenes Levels




These don't typically have elevators. Instead these have a small room with only 4 entities in close proximity (in addition to the usual detail work):
  • info_player_start
  • weapon_portalgun if you want/need your player to start with the portal gun
  • env_soundscape (re-read Guide 3 to see why)
  • env_fade for effect (fade to and from black)
Depending on your theme, you'll also be using an Aperture Science 1600-Megawatt Heavy-Duty Factory Security Door (prop_dynamic with model set to models/props/vert_door/vert_door_animated.mdl) or a bar door (prop_dynamic with model set to models/props_underground/underground_door_dynamic.mdl) for the player to open. Ideally there would also be another door on the other side behind or beside the player for plausibility (it is supposed to be a transition hallway after all, right?).

Make sure to carve out or construct a hole for the door that opens! For a bar door, you'll just need a hole that's 112 units high and 56 units wide (a thin wall of 2-16 units is recommended for the door). You can also use a frame for the bar door. For the Security Door, you'll need to carve out a somewhat special frame for it (general dimensions are 192 units wide, 256 units high, and 32 units thick):



Finally, if a door doesn't open, it shouldn't need a hole.

To open and close the doors, just use a logic_auto (when the test subject first begins), and some trigger_onces (when exiting) to animate the doors (check the model browser or the prop_dynamic's "Model" tab for an animation list).
The Proper Way to End Workshop Maps
Some people don't know how to properly end a map. It seems that this page missed their eyes. Yes, you do need to allow players to vote in your map; I don't care if you want to prevent downvotes or not.

So, to properly end a map:

1) Create a func_instance and set "VMF Filename" keyvalue to "instances/p2editor/global_pti_ents.vmf". Give it a name.
2) Create a trigger_once where you want the player to end the map.
3) Send an output (with or without delay) to trigger the instance to do its thing.
4) Get upvotes and words of relieved thanks if you previously didn't do any of this.
5) ???
6) Profit
Mistakes to Avoid & More Information


  • Oh wait... I can't really think of any major mistakes at this time.
  • Pretty nice to know, eh? I'll genrally stop listing these now, but please don't continue to publish half-baked maps.

More information from the VDC Wiki:
Master Guide List
Please note that there are still some works in progress. This section will be updated as I finish more guides for you!

You are currently viewing part 13/19 in the series.

| 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

Previous Guide (optimizing a map)
Next Guide (compiling a map)

Please feel free to leave a well-reasoned question or comment below. Either I or a qualified Test Chamber Associate (you'll know because they make all the good maps on the workshop) will respond. If your question or comment is not well-reasoned, I recommend reading over my guides again until you understand them 100%. No further information is required here or will be provided, and you will become an excellent Test Chamber Designer — using Hammer!

< >
10 Comments
TChapman500 Oct 6, 2018 @ 5:59pm 
Can't get the videos working with any of the instances that Valve gave us.
InsanityWaffles Jul 5, 2018 @ 12:53pm 
What are the funcs??? I can't find half of the ones you mention! Am I looking in the wrong place?? AAAAAAAAAAAAAAAAAA


---Another Panicked User
Čolibri Aug 18, 2017 @ 4:11pm 
When the player touch the bar, a Setanimation Open is triggered. I dont see what is missed!
The Sojourner  [author] Aug 15, 2017 @ 1:59pm 
I suppose you could do that, though that takes the fun and interactivity out of actually pushing on the bar.
Čolibri Aug 12, 2017 @ 12:35pm 
For the bar door, I just use a trigger brush covering the bar.
The Sojourner  [author] Aug 8, 2017 @ 2:01pm 
It's basically a reskin of the standard elevator model. Check out the latest version of BEEMOD (or Portal Stories: Mel) if you haven't already, as you'll likely find it there.

Other than that, the logic is still the same even though the esthetics and such are different.
Goldensliv Aug 4, 2017 @ 6:03pm 
Could you explain how to get an Overgrown style elevator, I'm trying to make a map and it's in the Overgrown theme.
The Sojourner  [author] Jul 24, 2016 @ 6:28pm 
@Σ.Person, did you shape the func_button using two brushes as in the image above? That's really the only way to get the func_button to work, remain invisible, and still allow the player (and anything really) to pass through.

Also, guides 13-19 are semi-advanced, meaning that it's recommended you read guides 00-12 first to get a better understanding of how to create things for Portal 2 in Hammer. That being said, all that the bar door really is is a func_button to trigger an opening door animation via its OnPressed output. Sounds and collision are included with the model/animations (meaning it makes it easy on you as a mapper).
Person Meetup Jul 23, 2016 @ 3:41pm 
Can you go a bit more in-depth for how to create the bar door? When I used it, I ended up not being able to go through the door.
Batcat Jun 5, 2016 @ 12:40am 
profit?

We get profit? o.O