BSPZIP: Difference between revisions
SirYodaJedi (talk | contribs) m (→Compression: JB3 supports compressed BSPs, but it's BSPZIP program does not) |
SirYodaJedi (talk | contribs) m (→Compression: propose possible solution for partial zip lump compression) |
||
Line 65: | Line 65: | ||
{{warning|Repacked maps won't work in {{sfm|2}} and will crash the program on load!}} | {{warning|Repacked maps won't work in {{sfm|2}} and will crash the program on load!}} | ||
{{note|Currently, the BSPZIP included with {{csgo}} Authoring Tools doesn't support repacking.<br>The BSPZIP included with {{jbep3}} Authoring Tools doesn't either, but the ''game itself'' can load compressed BSPs.}} | {{note|Currently, the BSPZIP included with {{csgo}} Authoring Tools doesn't support repacking.<br>The BSPZIP included with {{jbep3}} Authoring Tools doesn't either, but the ''game itself'' can load compressed BSPs.}} | ||
{{warning|Map compression isn't supported by {{src13sp}}, but ''is'' supported by {{src13mp}}.}} | {{warning|Map compression isn't supported by {{src13sp}}, but ''is'' supported by {{src13mp}}.}} | ||
{{tip|The map will need to be decompressed before BSPZIP will allow new files to be packed into the BSP. | {{tip|The map will need to be decompressed before BSPZIP will allow new files to be packed into the BSP. | ||
{{confirm|Can the ZIP lump in a compressed BSP be edited in some other way (using some other tool), allowing for custom levels of compression of the contained files?<br>For example, the compression method used ([[Wikipedia:LZMA|LZMA]]) significantly impacts load latency of audio files compared to faster methods like [[Wikipedia:Deflate|Deflate]] (which is used in {{idtech3}} PK3s).}}}} | {{confirm|Can the ZIP lump in a compressed BSP be edited in some other way (using some other tool), allowing for custom levels of compression of the contained files? Perhaps using [[Lump file format|LMPFIX]]?<br>For example, the compression method used ([[Wikipedia:LZMA|LZMA]]) significantly impacts load latency of audio files compared to faster methods like [[Wikipedia:Deflate|Deflate]] (which is used in {{idtech3}} PK3s).}} | ||
}} | |||
{{bug|Map compression may sometimes result in packed [[WAV|ADPCM audio files]] not properly caching, resulting in improper playback on subsequent loads (observed in {{tf2}}, [https://cdn.discordapp.com/attachments/213848987411808257/950967938687569920/ADPCM_Error.mp4 Video demonstration]). This does not happen if the audio cache was created when the BSP file was uncompressed, or when using other audio formats (8-bit, 16-bit, [[MP3]], etc).}} | {{bug|Map compression may sometimes result in packed [[WAV|ADPCM audio files]] not properly caching, resulting in improper playback on subsequent loads (observed in {{tf2}}, [https://cdn.discordapp.com/attachments/213848987411808257/950967938687569920/ADPCM_Error.mp4 Video demonstration]). This does not happen if the audio cache was created when the BSP file was uncompressed, or when using other audio formats (8-bit, 16-bit, [[MP3]], etc).}} | ||
Revision as of 10:09, 20 May 2023
BSPZIP is a command-line tool that allows arbitrary files to be embedded within a BSP. When the map is being loaded the files will be mounted as if they were present in the game's real content folders.


While it is usually a good idea to BSPZIP content, there are times when it can cause problems and other times when it won't work at all (e.g., for Maplist Thumbnails). When this happens, a resource list can be used instead.
Usage

BSPZIP is found at "common\<gamename>\<gamefolder>\bin\bspzip.exe". It performs several functions:
Adding a List of Files
The most common function. There are two related commands:
-addlist <input bsp> <file list> <output bsp> -addorupdatelist <input bsp> <file list> <output bsp>
Include file extensions. The former command packs all files in the list, the latter (untested, Orange Box only) packs only those that have changed since the last operation.

The "file list" is a .txt file containing this pattern:
internal_path\file1 external_path\file1 internal_path\file2 external_path\file2 ...
- Internal paths ("relative paths") are the location the file will take within the BSP; e.g., materials/metal/new_steel.vmt.
- External paths ("full paths") are the location of the file to be packed, e.g., C:\Users\Public\our_maps\materials\metal\new_steel.vmt.
Adding a Single File
The same principle as above, but without a file list.
-addfile <input bsp> <internal path> <external path> <output bsp>
Viewing and Extracting Files
If you have an archive tool installed that is able to look inside BSPs, it's better to use that. If you don't, these are the commands you need:
-extract <bsp file> <output.zip> -extractfiles <bsp file> -dir <bsp file>
Handling Cubemaps
Should be self-evident:
-extractcubemaps <bsp file> <output folder> -deletecubemaps <bsp file>

Testing
There are situations where files won't be loaded from BSP files correctly. As time goes on, they become fewer in number, but it's always worth checking regardless. The easiest way to do so is moving all of the embedded content out of the game's folders—or even better, not storing it there in the first place.
Compression
Repacking allows you to compress your map using LZMA to save hard drive space and download times. To repack a map and compress it, these commands are used:
-repack -compress <bsp file>
To decompress repacked maps, run the same command but ommit the -compress
command:
-repack <bsp file>




The BSPZIP included with



For example, the compression method used (LZMA) significantly impacts load latency of audio files compared to faster methods like Deflate (which is used in



GUIs/Replacements
The following GUI tools are often preferred to BSPZIP directly, and they may aid you in determining which files need to be packed into your map.
- Compile Pal
- Packbsp
- Map Analyst
- Pakrat
VIDE
- BspZipGui(2020) - This app allows you to embed a folder with your files into BSP file, repack (compress and decompress) and can save different map configurations. It uses bspzip for the actual packing.
- BspZipGui(2016) - The app allows you to embed a folder with your files into BSP file in just a few clicks. It uses bspzip for the actual packing.
- AutoBSPpackingTool - Automatically detects content that is used in the map and packs it. It has a GUI as well as a command line interface which makes it easy to add as a compile step in Hammer.
- QuickPack - This script quickly finds and packs all dependencies in a map. For models with different skins, it only packs used skins to save file space.
- TeamSpen210's HammerAddons - This includes a post-compiler which automatically finds and packs custom content, and adds entities to control auto-packing.
TeamSpen's Hammer Addons - Postcompiler has a number of automatic and on-command packing features.
See Also
- Resource list (Alternative method to push content to users)
- GCFScape (Read-only tool for inspecting BSP contents)
|