Include/pack things into a bsp (my way)
Quote from DaMaGepy on May 22, 2011, 6:23 amHi.
Since I've read on this forum that some ppl have problem merging resources (custom textures, sounds etc) into the bsp, I tell you how I do that. I made this method for portal 1 but then I modified it for portal 2.My method requires, that you never launch the map after the compiling is done from hammer. Well, I never, I youst use a shortcut from my desktop to launch portal + my map, and then (since it runs in window) I just press "i" to reload it after every compile.
So:
1. Add a desktop shortcut
I made a shortcut on the desktop (your portal 2 exe path wil be different ofc):
"E:JATEKValveSteamSteamAppscommonportal 2portal2.exe" -novid -console +map sp_damagepy_02
this will launch portal without the starting vid, showing the console, and auto-loading the specified map. Portal should run in windowed mode.2. Bind a key in portal2 to load or reload the map
In portal I made a binding in console:
bind i "map sp_damagepy_02"
portal saves this binding if u exit portal 2, so will work after next launch too, and you only need to change it (or bind another key) if you making other maps too. After I re-compiled my map, I just switch to the portal 2 windows and press "I" to reload. I shouldn't move ingame tho, because if there were some serious changes in the bsp, and portal2 tries to load something new from the bsp (and ofc it changed), sometimes just crashes portal2. If that happens, just use the desktop shortcut to load the map. I sometimes use the console command "reload" but loading the map is safer, since reload sometimes keeps your location etc and remembers things, that sometimes not there in the newly compiled bsp.3. Adding bspzip's path in hammer
Since I failed to add a custom executable with path to hammer's F9 advanced compiling, I had to use the game_exe variable for bspzip:
Tools / Options / Build programs tab, Game executable:
$SteamUserDirportal 2binbspzip.exe
(Note: when I added the bspzip with path as a command into the expert mode, the space in the path f@cked up things, Also tried to use $gamedir but it just added it as a text, thats why Ichose to use the game_exe variable to set bspzip's path)4. Compiling, F9 Expert mode
Now when compiling a map in expert mode, I've added a new row after the $light_exe row but before the Copy file:
command: $game_exe
Parameters: -addlist $path$file.bsp $path$file.txt $path$file.bsp
and of course unchecked the last $game_exe row since it can't auto-launch the compiled map now (can be done with the desktop shortcut, or just reloading the map with the keybinding)
With this command, bspzip will look for a txt file where the .vmf is and process it5. Making the resource-list .txt
Create a txt, its name is thesame as the map, in my example its sp_damagepy_02.txt
The txt must contain the files you want to include in the bsp. For example if you want to add two custom sound (mind the different and / separators in the paths!):
sound/damagepy/music1.mp3
e:JATEKValveSteamSteamAppscommonportal 2sdk_contentmapsmusicmusic1.mp3
sound/damagepy/cavesound.mp3
f:whatevermysoundscustomsound_cave.mp3to add a file it needs 2 row (paired), so to add 3 custom thing, the txt must have 3x2=6 row:
The first row is the path inside the bsp where you want to add it
The second is the path to the file, can be anywhere, as I showed in the 2nd custom sound example
(btw sound can be mp3, must be 44100 khz 128 bit, and must be in a sound dir, since in an ambient_generic, I can only specify its location as damagepy/music1.mp3, portal automatically search it in a sound path)
Must make it for every included file.Thats all, when you compile the map, it will automatically add the files to the bsp. Check the log after compiling for errors (if you have some blank/empty line at the end of the .txt or it can't find the files, it gives an error)
This is my method, after setup, then everything is automatic, just compile the map with F9 as normally, the only difference is that you need to launch the map in Portal 2 on your own.
IF you make a new map, the only thing you need to do is to manage it's .txt file, if you use the same resources as your other map, just copy/rename its .txt...
Hi.
Since I've read on this forum that some ppl have problem merging resources (custom textures, sounds etc) into the bsp, I tell you how I do that. I made this method for portal 1 but then I modified it for portal 2.
My method requires, that you never launch the map after the compiling is done from hammer. Well, I never, I youst use a shortcut from my desktop to launch portal + my map, and then (since it runs in window) I just press "i" to reload it after every compile.
So:
1. Add a desktop shortcut
I made a shortcut on the desktop (your portal 2 exe path wil be different ofc):
"E:JATEKValveSteamSteamAppscommonportal 2portal2.exe" -novid -console +map sp_damagepy_02
this will launch portal without the starting vid, showing the console, and auto-loading the specified map. Portal should run in windowed mode.
2. Bind a key in portal2 to load or reload the map
In portal I made a binding in console:
bind i "map sp_damagepy_02"
portal saves this binding if u exit portal 2, so will work after next launch too, and you only need to change it (or bind another key) if you making other maps too. After I re-compiled my map, I just switch to the portal 2 windows and press "I" to reload. I shouldn't move ingame tho, because if there were some serious changes in the bsp, and portal2 tries to load something new from the bsp (and ofc it changed), sometimes just crashes portal2. If that happens, just use the desktop shortcut to load the map. I sometimes use the console command "reload" but loading the map is safer, since reload sometimes keeps your location etc and remembers things, that sometimes not there in the newly compiled bsp.
3. Adding bspzip's path in hammer
Since I failed to add a custom executable with path to hammer's F9 advanced compiling, I had to use the game_exe variable for bspzip:
Tools / Options / Build programs tab, Game executable:
$SteamUserDirportal 2binbspzip.exe
(Note: when I added the bspzip with path as a command into the expert mode, the space in the path f@cked up things, Also tried to use $gamedir but it just added it as a text, thats why Ichose to use the game_exe variable to set bspzip's path)
4. Compiling, F9 Expert mode
Now when compiling a map in expert mode, I've added a new row after the $light_exe row but before the Copy file:
command: $game_exe
Parameters: -addlist $path$file.bsp $path$file.txt $path$file.bsp
and of course unchecked the last $game_exe row since it can't auto-launch the compiled map now (can be done with the desktop shortcut, or just reloading the map with the keybinding)
With this command, bspzip will look for a txt file where the .vmf is and process it
5. Making the resource-list .txt
Create a txt, its name is thesame as the map, in my example its sp_damagepy_02.txt
The txt must contain the files you want to include in the bsp. For example if you want to add two custom sound (mind the different and / separators in the paths!):
sound/damagepy/music1.mp3
e:JATEKValveSteamSteamAppscommonportal 2sdk_contentmapsmusicmusic1.mp3
sound/damagepy/cavesound.mp3
f:whatevermysoundscustomsound_cave.mp3
to add a file it needs 2 row (paired), so to add 3 custom thing, the txt must have 3x2=6 row:
The first row is the path inside the bsp where you want to add it
The second is the path to the file, can be anywhere, as I showed in the 2nd custom sound example
(btw sound can be mp3, must be 44100 khz 128 bit, and must be in a sound dir, since in an ambient_generic, I can only specify its location as damagepy/music1.mp3, portal automatically search it in a sound path)
Must make it for every included file.
Thats all, when you compile the map, it will automatically add the files to the bsp. Check the log after compiling for errors (if you have some blank/empty line at the end of the .txt or it can't find the files, it gives an error)
This is my method, after setup, then everything is automatic, just compile the map with F9 as normally, the only difference is that you need to launch the map in Portal 2 on your own.
IF you make a new map, the only thing you need to do is to manage it's .txt file, if you use the same resources as your other map, just copy/rename its .txt...

Quote from ChickenMobile on June 9, 2011, 10:48 amThanks for the tut man, very in depth and helpful. I tried doing this before and failed because I needed to change a '' to a '/'. -.-
The only problem I have with is this:DaMaGeby wrote:Since I failed to add a custom executable with path to hammer's F9 advanced compiling, I had to use the game_exe variable for bspzip:
Tools / Options / Build programs tab, Game executable:
$SteamUserDirportal 2binbspzip.exeSo will this interfere with anything other than the "Don't run the game after compiling" option? If not I will do this myself.
Also just for a heads up:
. It will help a lot.
Thanks for the tut man, very in depth and helpful. I tried doing this before and failed because I needed to change a '' to a '/'. -.-
The only problem I have with is this:
Tools / Options / Build programs tab, Game executable:
$SteamUserDirportal 2binbspzip.exe
So will this interfere with anything other than the "Don't run the game after compiling" option? If not I will do this myself.
Also just for a heads up: . It will help a lot.
Quote from DaMaGepy on June 9, 2011, 12:50 pmWill not interfere, if you dont want hammer to start the map in Portal 2 after compiling.
But in expert mode there is no such checkbox, and the normal mode checkbox only turns the last "$game_exe -dev ..." command off (in expert mode)I never used that feature anyway, since Portal 2 runs in the background all the time (windowed) and after each compile I just alt-tab and reload the map. Not a big loss.
Will not interfere, if you dont want hammer to start the map in Portal 2 after compiling.
But in expert mode there is no such checkbox, and the normal mode checkbox only turns the last "$game_exe -dev ..." command off (in expert mode)
I never used that feature anyway, since Portal 2 runs in the background all the time (windowed) and after each compile I just alt-tab and reload the map. Not a big loss.
Quote from Omnicoder on June 9, 2011, 2:56 pmI don't see why replacing the game exe path is necessary, I've had something similar set up for a while without having to mess up any existing features.
I don't see why replacing the game exe path is necessary, I've had something similar set up for a while without having to mess up any existing features.
Quote from DaMaGepy on June 10, 2011, 6:22 amOmnicoder wrote:I don't see why replacing the game exe path is necessary, I've had something similar set up for a while without having to mess up any existing features.well I tried to enter the bspzip into the Command: editbox using variables $ but then that appeared exactly the same way with $ in the compilation window. Same goes for parameters. Or maxbe it was good as command but when my path had a space it went wrong, and when I used " " in the command it also went wrong. And I never use that $game_exe variable to launch the map, I just use my shortcut:
"E:JATEKValveSteamSteamAppscommonportal 2portal2.exe" -novid -console -w 1600 -h 900 -sw +map sp_damagepy_02
(In the last 2-3 day portal 2 started to forgot its "run in windowed mode" video setting so I had to include the windowed params, also it only ran in 1280x720 or 1440x900 so I included a custom resolution 16:9 for frapsing in HD)
well I tried to enter the bspzip into the Command: editbox using variables $ but then that appeared exactly the same way with $ in the compilation window. Same goes for parameters. Or maxbe it was good as command but when my path had a space it went wrong, and when I used " " in the command it also went wrong. And I never use that $game_exe variable to launch the map, I just use my shortcut:
"E:JATEKValveSteamSteamAppscommonportal 2portal2.exe" -novid -console -w 1600 -h 900 -sw +map sp_damagepy_02
(In the last 2-3 day portal 2 started to forgot its "run in windowed mode" video setting so I had to include the windowed params, also it only ran in 1280x720 or 1440x900 so I included a custom resolution 16:9 for frapsing in HD)
Quote from briandoyle81 on December 5, 2011, 6:50 pmI've been trying to get this method to work for several hours. I've also tried creating a .vpk. Both ways, if I try to play an mp3, I get the "Can't create mixer" error. If I try to play a .wav, the sound doesn't play, but there are no errors.
Anyone have any suggestions?
I've been trying to get this method to work for several hours. I've also tried creating a .vpk. Both ways, if I try to play an mp3, I get the "Can't create mixer" error. If I try to play a .wav, the sound doesn't play, but there are no errors.
Anyone have any suggestions?
Quote from iWork925 on December 6, 2011, 9:45 pmEPIC THREAD RESSURECTION!!!!!
Has been burried for 6 months, but LIVES AND BREATHES AGAIN!!!!!
.... you cant play mp3's in portal 2. There is a specific method of getting wavs to work that I cant remember of the top of my.... oh wait. http://bit.ly/rCJ3aQ
EPIC THREAD RESSURECTION!!!!!
Has been burried for 6 months, but LIVES AND BREATHES AGAIN!!!!!
.... you cant play mp3's in portal 2. There is a specific method of getting wavs to work that I cant remember of the top of my.... oh wait. http://bit.ly/rCJ3aQ

PortalStories.com
"Oh, in case you got covered in that repulsion gel, here's some advice the lab boys gave me: DO NOT get covered in the repulsion gel."
Quote from DaMaGepy on December 7, 2011, 8:38 pmiWork925 wrote:EPIC THREAD RESSURECTION!!!!!
.... you cant play mp3's in portal 2. There is a specific method of getting wavs to work that I cant remember of the top of my.... oh wait. http://bit.ly/rCJ3aQYou can, since I use MP3s all the time as a background music in my maps.
They just must be 44.1khz 128 bit stereo CBR.
.... you cant play mp3's in portal 2. There is a specific method of getting wavs to work that I cant remember of the top of my.... oh wait. http://bit.ly/rCJ3aQ
You can, since I use MP3s all the time as a background music in my maps. They just must be 44.1khz 128 bit stereo CBR.
Quote from iWork925 on December 7, 2011, 10:20 pmoh i thought you could only play wavs. heard it from a pretty reliable source.
oh i thought you could only play wavs. heard it from a pretty reliable source.

PortalStories.com
"Oh, in case you got covered in that repulsion gel, here's some advice the lab boys gave me: DO NOT get covered in the repulsion gel."
Quote from sicklebrick on December 8, 2011, 4:42 amOh well, while it's being ressurected, it might be worth noting that you can add gaps in your resource list as long as you add 2 at a time E.g:
- Code: Select all
materials/models/whatever/
c:blahmaterialsmodelswhatever
materials/models/whatever2/
c:blahmaterialsmodelswhatever2models/newmodel/
c:blahmodelsnewmodelHelps a little in spacing things out - more readable.
Oh well, while it's being ressurected, it might be worth noting that you can add gaps in your resource list as long as you add 2 at a time E.g:
- Code: Select all
materials/models/whatever/
c:blahmaterialsmodelswhatever
materials/models/whatever2/
c:blahmaterialsmodelswhatever2models/newmodel/
c:blahmodelsnewmodel
Helps a little in spacing things out - more readable.