Portal 2

Portal 2

78 ratings
Importing/Exporting Between PeTi, Hammer, and Steam Workshop
By hotel
Have you found that creating and editing maps in PeTi is fun and easy, but thought it a bit lacking? Like you don't have the control over elements and aesthetics that you'd like? You may have tried Hammer, the Source map-maker tool before, but found it too hard to get started. This guide will teach you how to start a map in PeTi, getting your basic structures and entities down, and then bring it into Hammer, to make your map have just the fine-tuned control you'd like.


*WARNING!*
Once a map from PeTi has been edited in Hammer, you CANNOT (to my knowledge) reopen it in PeTi.
   
Award
Favorite
Favorited
Unfavorite
Making the map
This guide was written a reeeally long time ago, and I give no guarantees that any of it still works. Try at your own peril- I will not be offering any support. Good luck!

So first off, you're going to need a map. If you've tried making one from scratch in Hammer before, you've probably experienced the endless frustration of trying to find a tiny leak, or whatever. For this, we turn to the PeTi map-maker that was built into Portal 2. By starting with this, we can shape the map and add hazards and testing elements, that in Hammer would have taken hours, in minutes.




Say I wanted a laser field in front of the entrance, but I want it to take the player by surprise. In Hammer, there is a utility known as a 'Trigger Brush.' This brush, or box, is essentially an invisible field that acts as a sort of tripwire, so when the player passes through, it will 'trigger' an event. In this case, I could have it so that when the player steps across the threshold into the test chamber, the laser field suddenly activates. This is why we're about to export the map to Hammer.
Exporting to Hammer
WARNING!! BEFORE WE GO ANY FURTHER, MAKE SURE YOU HAVE YOUR MAP HOW YOU WANT IT! THERE IS NO GOING BACK TO PeTi!

Okay, now that you have your map to your liking, if you haven't already, hit Escape, go to Options, Keayboard/Mouse, and enable the Developer Console. This can be accessed at any time by pressing the ~ (tilde) key (US keyboards), or whatever key is located left of the 1 key, and beneath the Escape key (International keyboards).



Next, you want to type the following into the console:

puzzlemaker_export new_map_name

Replacing 'new_map_name' with your map's name. It is very important that you do not have any spaces in your map's name! Instead, I suggest using underscores.

That was easy, wasn't it?
Hammer Install
Now, If you have not done so already, it's time to install Hammer.

Note: All of the Source SDK packages include the Hammer Map Editor Utility, so if you have one of those, skip this step. For the purpose of this guide, I am using the Portal 2 Authoring Tools Beta (because I had installed already), so if you already have that, you can skip this step as well.


In Steam, navigate to the Library tab at the top of the screen, and click on Tools.


Next, find the Portal 2 Authoring Tools Beta entry, and if it does not say 'Ready to Play,' begin to install it. Alternatively, you could install any of the Source SDK packages, but those take more time to install.
Editing the Map in Hammer
Once Portal 2 Authoring Tools Beta (or Source SDK of your choice) has been installed, launch it, and open Hammer Map Editor.

Next, you want to do File>Open (or Ctrl+O) and navigate to the directory your map was exported to. I'm assuming here that you don't know offhand what the directory is exactly so here it is:

X:\Program Files\Steam\steamapps\common\Portal 2\sdk_content\maps

Note: Replace X with whatever drive name you've installed Steam to. By default, it will be C.


Now select and open the file that you just exported.

If you're like me, and haven't used Hammer since before the PeTi came out, it might take you a minute to get yourself reacquainted with the controls, so here's a brief refresher:

Note: The following controls are for the top left viewport (the 3D viewer). You can maximise this viewport by pressing Shift+Z, and reset the viewports by pressing Ctrl+A.
W = Forward
S = Backward
A = Left
D = Right
Space+Mouse Drag = Look Around

F9 = Compile + Run the map in Portal 2. For this,it's important that you not have Portal 2 open before pressing this.

Once you've gotten the controls down, you can go ahead and begin editing!

If you've never encountered Hammer before, or even just need a refresher course, I would strongly recommend you check out SolarChronus' channel on youtube for some great, in-depth Portal 2 Hammer tutorials:

http://www.youtube.com/user/SolarChronus

Happy Editing!
Publishing to the Steam Workshop
Now that you've got your map as fine-tuned as you like, it's time to share your lovely creation with the rest of the Community, on the Steam Workshop.

First, if you haven't already, go to File>Run Map to compile your map. Portal 2 will open by default, but you can stop this by unchecking the box marked 'launch game after compiling.'


Next, we will want to navigate to Portal 2's built-in publisher application:

X:\Program Files\Steam\steamapps\common\Portal 2\bin

Again, replacing X with whatever drive you're using.

Open the Publisher, and a dialog box appears. From here, you can see all the files that you've published with it, so for now it should be blank. Click Add, and another dialog box appears.


This is where you fill out all of the identifiying information that goes along with your map: Title, Description, and Preview Image. Once you've got those all filled out, click the 'i accept the terms of the Steam Workshop Contribution Agreement' box (read the agreement if you wish).

Finally, click 'Browse,' and navigate to:

X:\Program Files\Steam\steamapps\common\Portal 2\ sdk_content\maps\new_map_name

Replacing X with your drive, and 'new_map_name' with the name of your map.

Click 'Open,' and then 'Publish.'

It'll take a few moments to upload, then a browser window will appear, showing you your map on the Community website.

That's all there is to it!

Please leave comments detailing how I could improve my guide, and have a lovely day!

56 Comments
Saronin A. C. Jayhart 30 Mar, 2023 @ 1:17pm 
I'm on steam deck and the keyboard doesn't work in Portal 2, is there any way to export it without using console commands
JaxTheDestroyer 23 Oct, 2022 @ 8:33am 
nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo:steamsalty:
BezaoBuilder 21 Aug, 2020 @ 8:18am 
@Wilwagame <3 Tea
Yes
rynegeist 27 Jul, 2020 @ 6:12am 
Are you able to do this with windows 10?
I_Like_Dogs 7 Jul, 2020 @ 7:28am 
NOTE that does not work with BEE2! For exporting BEE2 maps, see https://github.com/BEEmod/BEE2.4/issues/409#issuecomment-253123453

Basically, you have to run the map, navigate to *C:\Program Files\Steam\steamapps\common\Portal 2\sdk_content\maps\styled*, and copy+rename `preview.vmf`
sodiboo 29 Nov, 2018 @ 12:19pm 
Compiling a map is easy, that's what hammer and PeTi do in addition to making the maps, Decompiling a compiled map is really hard however, gonna have to just ask the creator for the source files, copy the map as accurately as YOU can or just try to bruteforce the decompiling or something, You could repost maps easily however you shouldn't do that because it is dishonest and stealing people's hard work
Blondie 14 Feb, 2018 @ 7:41pm 
How to export maps that aren't from puzzlemaker? Like the one's in the single player campaign or workshop maps.
axollyon 24 Dec, 2015 @ 11:22am 
For anyone using this guide: Apparently in a recent(ish) update, Valve removed functionality for p2map_publish.exe, making it spit out the error message "Steam must be running for this application to function!". However, @ℜedstoncraft [ ☣☢ ] put out a fix for it here: http://cs2bus.com/sharedfiles/filedetails/?id=539788458 . Happy mapping!
mood3rd 17 Sep, 2015 @ 1:51pm 
not tried yet. but seems good :)
one suggestion to add to guide is:
before exporting the map made in peti.
click "save as"
this will produce an exact copy of your map, to remain in peti.
so after exporting the map.
if you think you should have done more to it.
eg add items, alter the chambers or remove an unintended sollution, you later find.
you could delete the exported version.
then alter the copied version, that is still in peti.
then do another "save as", for the same reason as before. then export it, as before.
hope you find this helpfull.
thankyou for your guide.
JamTay03 14 Aug, 2015 @ 8:42pm 
errm, hammer doen't launch for me, it says "Portal 2 Authouring Tools-Beta is not supported on this platform"