Repacking your maps

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,259
999
koth_harvest_event
koth_lakeside_event
koth_viaduct_event
plr_hightower_event
sd_doomsday_event

ctf_2fort
cp_powerhouse
pl_badwater
pl_barnblitz
pl_goldrush
tc_hydro

arena_byre
ctf_landfall
cp_vanguard
cp_snowplow
koth_highpass
koth_probed
koth_suijin
pd_watergate
pl_borneo
pl_snowycoast

cp_gorge_event
cp_sunshine_event
koth_moonshine_event
pl_millstone_event
 

Lucia

L1: Registered
Jul 21, 2016
41
4
Help me!
Couldn't open input file pl_shortbeach - BSP recompress failed
Map compression thread failed :(
]
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,699
2,581
Probably you forgot to point it to the correct folder. The "..\tf\maps\" part is essential, but if for some reason you didn't save your map there, it won't be able to find it.
 

SparkyShock

L3: Member
Feb 6, 2016
125
14
So when i type in the "-repack -compress" do i need to copy paste the whole thing before the ...tf/map/ thing.
 

PC's_Frank

L4: Comfortable Member
Aug 29, 2012
178
24
The first time I tried this, I think it worked. The second time, I received a message saying "bspzip" is not recognizable as an external command, operable program, or batch file.

Am I doing this correctly? My map is called pl_roaring_flame_a6. Should I type it into the command line as pl_roaring_flame_a6.bsp since I also have a zip file of the same name in that same folder?
 

PC's_Frank

L4: Comfortable Member
Aug 29, 2012
178
24
Good news is I fixed the problem. The bad news is when I re-packed my map, it went from being 103 mb to 8 gb. Does anyone know hoe to fix that?
 

ics

http://ics-base.net
aa
Jun 17, 2010
841
543
it went from being 103 mb to 8 gb. Does anyone know hoe to fix that?

Don't know any hoes who could fix that but sounds very interesting. You basically just learned uberXspand, that expands your map filesize 77 times higher!

My only guess is that for some reason it propably "opens" the textures,models and whatnot as they are and then re-saves them while packing them tight. It could temporarely expand the filesize.
 
Sep 14, 2015
13
147
Just want to point out that repacking and repacking with compression are distinct. We've conflated them.

Code:
bspzip -repack [ -compress ] <bspfile>
  Optimally repacks a BSP file, optionally using compressed BSP format.
  Using on a compressed BSP without -compress will effectively decompress
  a compressed BSP.

Repacking is probably reorganizing custom assets in the BSP so that they're arranged optimally for...something. I'm guessing for extraction speed of the custom assets.

Somewhat confusingly, bspzip.exe doesn't compress by default but bsp_repack does.

Repack without compression:
bspzip.exe -repack <input/output bsp>
bsp_repack -nocompress <input bsp> <output bsp>

These double as decompression commands when used on maps repacked with compression.

Repack with compression:
bspzip.exe -repack -compress <input/output bsp>
bsp_repack <input bsp> <output bsp>

Technically, you could do a repack without compression followed by a compression with bz2. You might do this as a last resort if repacking with compression was causing problems.

I can explain a bit since most of this code is my fault:

Both the "bspzip -repack" command and the in-game command invoke the bsp code's "Re-generate this BSP file" logic, which reads in and then writes out the BSP file, ensuring it is saved in the canonical way. Since it re-processes every chunk, it will effectively add or strip compression in the process, depending on whether it is currently enabled. But -repack, by itself, is not doing any optimizing.

There isn't simply a bspzip -compress and -decompress command because it would be hiding the underlying mechanics a bit -- "decompressing" a non-compressed BSP might legitimately result in a different file. It is also perfectly valid to have a BSP that has some compressed and some uncompressed contents. More usefully, there may be legitimate tooling reasons to want to re-save a file. For instance, after modifying it with a third-party tool, or embedding a zip file not generated by the source engine, and wanting to ensure it is compliant. So what the tool is doing is regenerating (repacking) the result file consistently.

The reason the in-game bsp_repack command defaults to compression is because it is using the pathway meant for the workshop tools, which default to compressed. The bspzip command was shipped later, when having -compress be an additional option made more sense, and it was too late to break people using the bsp_repack command.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,699
2,581
Cool. Hey, since I'm in the presence of the coder who made repacking a thing, you should think about getting it into CSGO. Their maps are getting crazy huge lately, like "over 200 MB apiece" huge. It miiiiight be because they decided packing dupes of all the assets right into the maps made for shorter loading times than making the game retrieve them from the VPKs, but I bet there's some super-high-res lightmap shenanigans going on as well.
 

B!scuit

L5: Dapper Member
Aug 12, 2016
205
267
where do i find my repacked maps?
They don't go anywhere, the file you feed into bspzip repacked without creating any new files.
So the maps you repacked are your repacked maps. same file.
 

B!scuit

L5: Dapper Member
Aug 12, 2016
205
267
If you were intending on compressing your file to reduce the file size then you may have forgotten to add -compress after -repack.
bspzip -repack -compress file.bsp is what you should use.
Pretty sure there's some drag and drop batch scripts here on tf2maps, that might be easier (or using repack in compilepal).
 

Forged Identity

L1: Registered
Mar 29, 2017
2
0
I'm having a problem with repacking my map when I enter the input it says "could not find the path specified" can anyone help?