dackz
11-01-2005, 04:32 AM
If you run a game server like myself, you probably get annoyed when custom maps come with more than just a BSP file. You have to merge the BSP's custom materials with the mod's, which makes it tedious to remove in the future. It also makes distributing the files to clients harder if you're using HTTP downloading, as you have to either copy all of those materials to your web directory, or set up a myriad of symbolic links and do dumb things to your server directory's file permissions. You also sometimes have to make or correct a RES file, as many mappers don't even include that. There's something even better and more convenient than creating RES files though, and that's bspzip.
Bspzip allows you to embed your custom map-related files directly into your BSP. Materials, models, resources, scripts, sounds, even AIN files and map description text files should work. You can pretty much put everything in your BSP file, which would leave you with only a BSP to distribute, which is the correct way to release a map.
Of course the tool Valve has provided isn't exactly easy to use. You can find it in your Steam directory under SteamApps\<account>\sourcesdk\bspzip.exe. It's a command line program, so you'll probably want a command prompt when using it. Running "cmd" from the run dialog in the start menu should suffice, at least for Windows 2000 and XP. Once you have a command prompt, run "X:" where X: is the drive that Steam is on, then run "cd X:\path\to\Steam\SteamApps\<account>\sourcesdk". Now when you run "bspzip.exe" you'll see the following output:
usage:
bspzip -extract bspfile blah.zip
bspzip -dir bspfile
bspzip -addfile bspfile relativepathname fullpathname newbspfile
bspzip -addlist bspfile listfile newbspfile
As you can see it isn't very helpful. First of all you're generally going to want to run this in the mod directory of your map, as it'll whine if it doesn't find a valid gameinfo.txt. So for DOD:S you'll want to run "cd X:\path\to\Steam\SteamApps\<account>\day of defeat source\dod". Now you'll probably want to use the full path of bspzip.exe in order to run it.
At this point you can try to add each file manually with "bspzip.exe -addfile maps/yourmap.bsp materials\somematerial.xxx X:\path\to\Steam\SteamApps\<account>\day of defeat source\dod\materials\somematerial.xxx maps/yournewbsp.bsp" but that's pretty impractical for maps that have many custom materials. Instead you should do the following:
Load up your mod and run the map once. This will generate an AIN file in maps\graphs. You'll want to pack this into your BSP.
Make a text file with a list of all of your files in this format (relative to the mod directory):
directory/file1
X:/path/to/Steam/SteamApps/<account>/mod directory/mod/directory/file1
directory/file2
X:/path/to/Steam/SteamApps/<account>/mod directory/mod/directory/file2
Save the text file in the same directory as gameinfo.txt.
Rename your BSP file to yourmap-old.bsp
Run "bspzip.exe maps\yourmap-old.bsp yourfilelist.txt maps\yourmap.bsp"
You probably won't want to do number two manually though, as that would be incredibly time-consuming. I have my own script that creates a list of files for me, and I weed out what I don't need, but it's a Python script. You'll probably find it easier to something like WinBSPZip (http://www.chaosincarnate.net/cannonfodder/winbspzip.php). You can add files to this with file dialogs and it'll do the rest for you.
I recommend adding EVERYTHING into the BSP, including your map description file and AIN file. Ideally you should end up with just a BSP file. You should test things to make sure it all worked though. Remove all the custom materials from the mod directory and run the new bspzipped BSP in the mod. Make sure your map description is shown and you aren't missing any sounds or textures or anything of the like. Once you've made sure of that, you should test sending out the BSP on a dedicated server. I'm not going to get into this, but if you run into issues with the BSP file being bigger than what the server will send out, look into changing the net_maxfilesize convar.
Hopefully this guide has been clear enough. WinBSPZip does make a lot of the guide irrelevant, but it's good to know how it works regardless. If you're still confused, feel free to ask questions. Oh and when you're distributing your map file, please don't put them in an EXE file or anything weird like that. A lot of server admins don't run Windows, so you're making it harder on them to get it installed, which can hurt your map's exposure. ZIP and RAR files are much nicer, but if you're concerned about people who don't have ZIP/RAR programs, make it a self-extracting RAR file (WinRAR can make these for you).
And here are some other bspzip-related tutorials: http://developer.valvesoftware.com/wiki/Using_Bspzip_to_Embed_Custom_Content Official SDK documentation.
http://forums.fortress-forever.com/viewtopic.php?t=2947 Tutorial from Fortress Forever mod team.
Bspzip allows you to embed your custom map-related files directly into your BSP. Materials, models, resources, scripts, sounds, even AIN files and map description text files should work. You can pretty much put everything in your BSP file, which would leave you with only a BSP to distribute, which is the correct way to release a map.
Of course the tool Valve has provided isn't exactly easy to use. You can find it in your Steam directory under SteamApps\<account>\sourcesdk\bspzip.exe. It's a command line program, so you'll probably want a command prompt when using it. Running "cmd" from the run dialog in the start menu should suffice, at least for Windows 2000 and XP. Once you have a command prompt, run "X:" where X: is the drive that Steam is on, then run "cd X:\path\to\Steam\SteamApps\<account>\sourcesdk". Now when you run "bspzip.exe" you'll see the following output:
usage:
bspzip -extract bspfile blah.zip
bspzip -dir bspfile
bspzip -addfile bspfile relativepathname fullpathname newbspfile
bspzip -addlist bspfile listfile newbspfile
As you can see it isn't very helpful. First of all you're generally going to want to run this in the mod directory of your map, as it'll whine if it doesn't find a valid gameinfo.txt. So for DOD:S you'll want to run "cd X:\path\to\Steam\SteamApps\<account>\day of defeat source\dod". Now you'll probably want to use the full path of bspzip.exe in order to run it.
At this point you can try to add each file manually with "bspzip.exe -addfile maps/yourmap.bsp materials\somematerial.xxx X:\path\to\Steam\SteamApps\<account>\day of defeat source\dod\materials\somematerial.xxx maps/yournewbsp.bsp" but that's pretty impractical for maps that have many custom materials. Instead you should do the following:
Load up your mod and run the map once. This will generate an AIN file in maps\graphs. You'll want to pack this into your BSP.
Make a text file with a list of all of your files in this format (relative to the mod directory):
directory/file1
X:/path/to/Steam/SteamApps/<account>/mod directory/mod/directory/file1
directory/file2
X:/path/to/Steam/SteamApps/<account>/mod directory/mod/directory/file2
Save the text file in the same directory as gameinfo.txt.
Rename your BSP file to yourmap-old.bsp
Run "bspzip.exe maps\yourmap-old.bsp yourfilelist.txt maps\yourmap.bsp"
You probably won't want to do number two manually though, as that would be incredibly time-consuming. I have my own script that creates a list of files for me, and I weed out what I don't need, but it's a Python script. You'll probably find it easier to something like WinBSPZip (http://www.chaosincarnate.net/cannonfodder/winbspzip.php). You can add files to this with file dialogs and it'll do the rest for you.
I recommend adding EVERYTHING into the BSP, including your map description file and AIN file. Ideally you should end up with just a BSP file. You should test things to make sure it all worked though. Remove all the custom materials from the mod directory and run the new bspzipped BSP in the mod. Make sure your map description is shown and you aren't missing any sounds or textures or anything of the like. Once you've made sure of that, you should test sending out the BSP on a dedicated server. I'm not going to get into this, but if you run into issues with the BSP file being bigger than what the server will send out, look into changing the net_maxfilesize convar.
Hopefully this guide has been clear enough. WinBSPZip does make a lot of the guide irrelevant, but it's good to know how it works regardless. If you're still confused, feel free to ask questions. Oh and when you're distributing your map file, please don't put them in an EXE file or anything weird like that. A lot of server admins don't run Windows, so you're making it harder on them to get it installed, which can hurt your map's exposure. ZIP and RAR files are much nicer, but if you're concerned about people who don't have ZIP/RAR programs, make it a self-extracting RAR file (WinRAR can make these for you).
And here are some other bspzip-related tutorials: http://developer.valvesoftware.com/wiki/Using_Bspzip_to_Embed_Custom_Content Official SDK documentation.
http://forums.fortress-forever.com/viewtopic.php?t=2947 Tutorial from Fortress Forever mod team.