Portal 2

Portal 2

52 ratings
How to do a "Full Compile"
By The Sojourner
This guide will teach you how to properly compile a map for publishing. Many times I have likely suggested that you use "Full Compile" on your Hammer-made maps. What do I mean precisely?
   
Award
Favorite
Favorited
Unfavorite
The works of compiling
In an update, the Puzzlemaker shows progress of compiling your map in three stages: "Building geometry", "Computing visibility", and "Calculating lighting." Before that, there was only one progress ring which showed "Building Test Chamber..." Unfortunately this became tedious, as there were only 16 ticks and about 5 mins to compile a map.
This means there was about 18 seconds per tick, which made compiling a map look tedious.

Anyway, there are three corresponding stages of the compiling process:



1) vbsp, which compiles the geometry of your map, checks for leaks, etc. and gives you a portal (.prt) file if there's no leak.
2) vvis, which uses the .prt file to compute visibility. This step is so critical to Portal 2 maps that your map will not compile if it has a leak.
3) vrad, which uses the details from vvis and vbsp to calculate the lighting for your map. This normally takes the most time to finish, and twice as long for compiling both LDR (Low Dynamic Range) and HDR (High Dynamic Range).

The Hammer compiler/runner also has other nice options, such as copying your map into the Portal 2\portal2\maps directory (because that's where the game will recognize your map) and starting the game fullscreen or windowed. When it runs, it will run in "developer" mode, which gives a verbose runoff of stuff you see on the console (and then some) in the upper-right corner, so you can debug little problems without having to open the developer console (though you might still need to use the console to execute commands such as noclip unless you have them bound to a key).
Common misconceptions and the solution
Based on the hundreds of Hammer maps I've seen, I can confidently say that there are a couple of misconceptions:

1) There is only one way of compiling maps, so there may as well be just one "COMPILE" button.
2) Compiling on "Normal" with HDR checked is good enough.

Points of fact:

1) There is more than one way to compile your map, from quick & dirty modes to the slow & beautiful ones.
2) Compiling on "Normal" with HDR checked is never good enough! The compiler will only compute HDR lighting and not LDR lighting. Furthermore, -final is left out of the equation.

The proper way



1) When compiling, click on Expert... Despite the implication of the name of this button, you do NOT need to be an expert at Hammer to use this. There are presets that you can use without having to know much about how the system works (it's command-line based btw).



2) Select the "Full Compile -both -final (slow!)" mode from the drop-down menu.
3) Hit "Go!" and that's it!

TIP: you can check and uncheck the various parts of the compiling process seen below. For example, you can uncheck vrad to debug any logic errors in your map without having to wait the extra 3-4 mins for your map to finish compiling.



Then once you've debugged those errors, you can check vrad again and debug lighting issues. You can also uncheck the part that runs the map in-game if you have any custom content to embed before running/testing/debugging your map.

What does it look like? (NEW)
Maybe some of you don't understand what the visual effect of using a Full Compile is. Here's a little illustration of a couple of elevator rooms, both of which are very ubiquitous among Hammer maps on the workshop:



You should immediately notice the differences: the top image is darker than the bottom one — hell it's even hard to see what color the floor is supposed to be other than "black" despite there being the normal gray carpet texture there!

But in the bottom image, you can see that everything's well-lit, and moreover that it's evenly and plausibly lit. No extra light entities were added to make the bottom image brighter than the top one. That is the power of using a Full Compile when getting ready to publish a map.

If you want to see another example, check out the entrance hallway in all those exported PeTI maps. Normally there's a yellow wall in many of them, but without a Full Compile it's black instead.
That's all
If you're still lost or confused, post a comment below. An Aperture Science testing associate should be available to revive you with peptic salve and adrenaline give you cake and grief counseling answer your questions if they're not already answered by this guide. We wish you the best of luck in your mapping adventures.

Please see also this guide for more information on making better Hammer maps.

35 Comments
francisco 21 Jul @ 3:06am 
doesn't portal 2 not support LDR lighting?
SuperOfSrb2 10 Aug, 2023 @ 10:12pm 
In my dropdown menu, there is no "Final Compile -both -final (slow!)", only "HDR Full compile -final (slow!)" leaving me with all the ugly ldr shadows. Could you link to your config file for the compile presets? I've checked every hammer editor I have installed.
The Sojourner  [author] 8 Jun, 2023 @ 5:42pm 
Heh, I can see it being that old. Interestingly, if you have leaks in a Portal 2 map, it simply will not compile. Something about it probably breaks the portal tech I suppose.
z34chris 7 Jun, 2023 @ 3:25pm 
i remember this program from quake 1. if you had leaks in the map, the compile time took forever.
The Sojourner  [author] 29 Dec, 2022 @ 11:30am 
20 minutes sounds like an unusually long time to compile a map, especially a small one. Do you have a lot of stuff in your map (in particular, lights and visleaves/hint textures)? If so, maybe reduce some of that stuff. You could also check for any other/background processes hogging up your processing power.

If you've tried that (or if that somehow doesn't apply), you could try: making highly detailed portions into func_detail (reduces unnecessary visleaves), using func_viscluster (primarily for large/open maps; also reduces visleaves), and reducing the lightmap scaling on certain textures that don't need it (primarily always-distant textures; shortens vrad.exe compile time).

Hope this helps.
Богомдан 29 Dec, 2022 @ 10:39am 
I already had a small test camera compiled for more than 20 minutes, and now it will be 2 more times more? ;)
SIXBOXX 21 Jan, 2021 @ 1:27pm 
Yep I tried and couldn't find the leak at all. I even tried to place a hollow nodraw around the map but still, didn't compile. I guess it was some glitched prop or something in the void so I copied my work over to a new file and that time it worked so idk what happend.
The Sojourner  [author] 19 Jan, 2021 @ 7:34am 
Does your map have a leak in it? If so, try loading the pointfile to find it manually. Portal 2 maps will simply not compile if they have a leak in them.
SIXBOXX 12 Jan, 2021 @ 11:48am 
I get an error saying that the prt file is missing. I made a map in the puzzlemaker to then try to compile it in hammer and guess what, it didn't compile. Where am I going wrong?
Xbox07 26 Jul, 2020 @ 1:53pm 
Oh wow, thanks!