How to Make Your Own Portal Test Chambers
This article takes you step by step through creating test chambers for Portal, the computer video game. Making test chambers in Portal is average in difficulty, and requires some concentration. Once you know how to make a test chamber, you'll find it's fun and satisfying.
If I Had a Hammer... SDK
What does it take to make test chambers for Portal?
Skill level: Medium
Time required: About one hour.
What do you need to make test chambers for Portal?
The video game Portal.
Source SDK (free on Steam)
Valve sample map (included with Source SDK)
The Portal prefab pack
Resources you can check out.
General Hammer tutorial
I'd Make Portal Test Chambers
Portal has a handy Hammer you can use to make your own test chambers for Portal. Select the Tools tab in your Steam menu, and then double click Source SDK. You can find everything that's required to make a Portal mod at this location, but for now just open the level editor - the hammer. Choose Portal on the dropdown list of games at the bottom of the Source SDK window, and then double-click Hammer. Head over to File > New and four different views will appear. The top left is a 3D perspective, while the remaining views are top and side views. All of them are just black at this point, so we'll have to do something about that.
Portal is a video game made of puzzles and rooms. We'll start by creating a room. Click the Block tool on the left; look for the white cube icon. In any of the 2D views, drag out a box. Drag its corners around the screen until you have a square in all three 2D views, and then press Enter, to make a nice size cube.
Now you have a solid you can work with. Click the red arrow in the top left of the screen and then click on your box to select it. We're going to implement Hammer's most useful short cut, hold Shift, and then drag your box down a little bit. Your box will stay put but a new copy will appear.
Grab hold of the corners of the new box and make it a little bigger than your previous one in each of the 2D views. You can select the inner box by clicking its center, and if you select the wrong one, just press Page Up to switch.
Texturing Your Portal Room
Texturing is done with the green and blue cube icon located on the left of the screen. Select it, and then click on any surface in your room in the 3D view (you can choose multiple items in Hammer by using Ctrl + click). A window will appear, just hit Browse. We need this room to look like Portal should, so type "Portal" into the keywords box at the bottom of the browser. The two vertical concrete panels are the wall-like textures available, double-click on the one you want to try, and then select Apply. Success! Now to make this wall portal-proof, add a brown metal texture.
We're going to add a player to this room. Selet the person-shaped icon on the left of the screen, and then click somewhere on the floor in the 3D view. You can fool around with your person, just press z with your cursor in the 3D window to enable mouse-look and WASD controls, and then have fun. Look for a box in the lower right of the screen called Objects, click on it and then scroll down and you'll get an idea of all the things you can add. Locate weapon_portalgun and put it down in front of your person and your gun is made.
We're going to sneak in and steal a floor-button for our mod. Select File > Open > testchmb_a05.vmf (Value's sample map). We need to get rid of this level, so click Visgroups on the right and click the Auto tab. Uncheck World Geometry and the level will vanish. Next, find the super-button in one of the 2D views and draw a large box surrounding it. Click Enter to choose, Ctrl + C to copy it, Ctrl + Tab to switch back to your mod, and then Ctrl + V to paste it where we need it to be.
Check to see if it works?
We're going to do a quick check to make sure your Portal mod works, so far. Hit F9 and your map will be built, and then when asked, say no to VIS and RAD (these are just lighting features we won't worry about). At this time it's possible that this didn't work, but not to worry, I've found a way around this problem. On some computers, Hammer's default setting for launching Portal doesn't always work. Select Tools > Options > Build Programs and select Browse next to Game Executable. Now, locate the steam.exe in the Steam folder, and then click on it. This time, when you hit F9, the Additional Game Parameters box will appear, in this box type "-applaunch400-dev", which is another way to launch Portal.
After making sure it works, quit playing, and select Ctrl + Tab to head back to Valve's map. This time we want a door near the button and you can quickly and easily select it from the top-down view. Once you have done this, paste it into your map, and while you still have it selected, right-click and go to Properties > Visgroups > Edit groups > New Group. At this point you need to give your door a name, say OK, and then you can make it vanish or reappear by selecting it in the doors Visgroup list.
Next, drag the wall over to one of the walls in your room and note how many grid units wide the door is. To make the door vanish for now, uncheck door under Visgroups > User on the sidebar on the right side. Right-click your room and head to Upgroup. Now you can select the wall you put the door into and drag its outer edge way back, and extend the floor back as well. Create a new block in this large piece of wall, as wide as the door. We're going to carve this out, so make it the shape of a corridor leading off your main room. Right-click > Carve > Delete.
Add a Few Things to Your Portal Room
At this point you should re-check the door and make sure it is properly arranged in the mouth of the corridor. It's time to put a few things in your corridor. Select the little person icon and choose npc_portal_turret_floor on the Objects list. Click anywhere in the corridor in the 3D view. Select Shift+ S to move back to the selection tool, double click the turret with the selection tool, and now you can alter the direction of the turret. You can even name your turret, if you want to; call her anything that tickles your fancy.
You need to make an autosave point. Use the little person icon as before to put a logic_autosave anywhere in your level, and then choose Shift + S and double-click on it to name it. Now select your button, right-click, and go to Ungroup. Here you can double-click just the orange square on top of the button in the 3D view. This orange square is the sensor that notices someone is on the button and opens the door.
Go to Outputs > Add. Name the Output and then Save. Select the Fire Once Only box, and then click Apply.
If you want to add other parts of Portal, like puzzles, bouncy balls, light rails, and rocket-turrets, you can use the prefab pack located at the link at the beginning of this article. Grab the Portal Prefabs folder from this pack and drop it into Steam\steamapps\Username\sourcesdk\bin\orangebox\bin. Once this is done, you can just select the Portal Prefabs from the "Entities" list on the right, and the object you want from the Objects list. All you need to do is to double-click each part to change its name and its Outputs. Success!