[Tutorial] Compressing maps using "bsp_repack"

Got a question or a tutorial?
User avatar
Shadow Sheep
Posts: 558
Joined: Wed Jul 08, 2015 10:22 pm

[Tutorial] Compressing maps using "bsp_repack"

Post by Shadow Sheep » Sun Jun 05, 2016 5:38 pm

Today, when Egan told me that he approves the fix I did of surf_halloween_njv_fix, he also told me about the bsp_repack command.

http://tf2maps.net/threads/repacking-your-maps.24822/

This is a command that basicaly compresses your map file to a format that it more effective than a .bsp.bz2, because the size is similar and the map is still a .bsp (meaning it can be played without extraction). This means that making the map .bsp.bz2 afterwards to upload it to the server is irrelevant because it pretty much doesn't save anything on the idisk occupation.

This allows for huge maps like surf_spacejam, surf_lt_unicorn or surf_kitsune2 that have a big map length, but that also contain a huge amount of custom elements.

This tutorial is only addressed to the people who plan to insert submit newers maps because if you do this manipulation on existing maps you have, there will be a mismatch with the uncrompressed versions running on the servers (not the same map file).


Step 1: Compile, build cubemaps, pack the custom elements in the map.


You need to have a ready to play map file before compressing it. I wouldn't recommend to compress the map file, then pack in the elements.


Step2: Type in console "bsp_repack download/maps/mapname.bsp download/maps/mapname.bsp"


How to enable the develloper's console in Team Fortress 2

The game will then launch an executable that will compress your map in the background, then tell you when it is done and how many bytes it saved in the console.


Well done, you have made your map lighter to upload and to download for everyone.

I wanted to thank Egan for telling me about this trick, and figured I would share it with as many people as possible.
TheDeathly
Posts: 214
Joined: Sun Sep 06, 2015 5:04 pm

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by TheDeathly » Tue Jun 07, 2016 11:43 am

fastDL still requires .bz2 so I still need to .bz2 it. I tested it and it saves ~10mb.

bhop_japan uncompressed - 184mb.
bhop_japan .bz2 - 76mb

bhop_japan repacked - 67mb
bhop_japan repacked .bz2 - 67mb

Pretty negligible difference but up to map makers, but in the end it is still getting .bz2 compressed.

Edit: Well, I guess the difference matters when it's uncompressed. Takes less space up on the players hard drives.
User avatar
Nastybutler
Posts: 572
Joined: Sun Jan 12, 2014 7:40 am
Location: St. Louis, MO

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by Nastybutler » Wed Jun 08, 2016 5:38 pm

This was the old way of compressing maps before batch files were written for third party programs to compress (i.e. VIDE, 7zip, etc.)

I still prefer using 7zip to compress my maps, because it allows me to alter lossless compression ratios, saving a little bit of space here and there.
[Owner] -DB!- tordana: meet me in the playground after school
User avatar
Shadow Sheep
Posts: 558
Joined: Wed Jul 08, 2015 10:22 pm

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by Shadow Sheep » Wed Jun 08, 2016 7:11 pm

The bsp_repack command doesn't make the map a zip file but make its a playable bsp file. Using 7zip will only compress it, but then the player has to extract it himself and the same space is occupied at the end. Here, it compresses the map very good and its playable at a compressed size.
User avatar
Nastybutler
Posts: 572
Joined: Sun Jan 12, 2014 7:40 am
Location: St. Louis, MO

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by Nastybutler » Fri Jun 10, 2016 2:54 pm

Shadow Sheep wrote:The bsp_repack command doesn't make the map a zip file but make its a playable bsp file. Using 7zip will only compress it, but then the player has to extract it himself and the same space is occupied at the end. Here, it compresses the map very good and its playable at a compressed size.

You can use 7zip's algorithm to compress .bsp's into .bz2, using a simple code I wrote a long time ago:

Code: Select all

@Echo Off
:Start
If [%1==[ Goto :EOF
PushD %~pd1
"C:\Program Files\7-Zip\7z.exe" u -tbzip2 %~nx1.bz2 %1
Shift
PopD
Goto Start
Just copy that code, save it as a .bat file, then drag your .bsp onto it to compress it. Easy.
[Owner] -DB!- tordana: meet me in the playground after school
User avatar
asscmalt
Posts: 170
Joined: Mon Jan 13, 2014 3:52 pm
Location: Long Island
Contact:

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by asscmalt » Fri Jun 10, 2016 3:58 pm

Nastybutler wrote:
You can use 7zip's algorithm to compress .bsp's into .bz2, using a simple code I wrote a long time ago:

Code: Select all

@Echo Off
:Start
If [%1==[ Goto :EOF
PushD %~pd1
"C:\Program Files\7-Zip\7z.exe" u -tbzip2 %~nx1.bz2 %1
Shift
PopD
Goto Start
Just copy that code, save it as a .bat file, then drag your .bsp onto it to compress it. Easy.

Everything stored on the ftp is compressed into bz2. Repacking the bsp is just so the bsp takes up less space on the drives of players who dl the map
User avatar
Shadow Sheep
Posts: 558
Joined: Wed Jul 08, 2015 10:22 pm

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by Shadow Sheep » Fri Jun 10, 2016 9:33 pm

Nastybutler, I am telling you again: 7zip will make it a compressed .bz2 that cannot be played, and that have to be extracted to be playable by a player once downloaded.

The extracted mape still takes as much space as before the compression.

This bsp_repack makes the playable file 60% smaller. It in fact compresses so good that compressing it again as a .bz2 saves at most 20% of the final map size. The maps are uploaded as .bz2 anyway, but the map file that is stored on the disk isn't smaller using your compression method, unlike it is with bsp_repack.

I am ready to make a forum bind to repeat this explanation as many times as your understanding of my english needs.
User avatar
Insomnia
Posts: 231
Joined: Wed Aug 20, 2014 9:05 pm
Location: Ontario, Canada
Contact:

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by Insomnia » Fri Jun 10, 2016 10:20 pm

Shadow Sheep is a savage
Contact me - Steam
User avatar
Epi
Posts: 88
Joined: Wed Dec 10, 2014 1:11 am
Location: EU
Contact:

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by Epi » Sat Jun 11, 2016 7:27 am

hahahah holy shit
Image
TheDeathly
Posts: 214
Joined: Sun Sep 06, 2015 5:04 pm

Re: [Tutorial] Compressing maps using "bsp_repack"

Post by TheDeathly » Sat Jun 11, 2016 12:52 pm

lmao yeah sheep is 100% right. The map has to get .bz2 zipped on fastDL regardless, but repacking it makes it smaller in the clients map folder since its a smaller .bsp. Would be cool if valve let us keep the maps .bz2 zipped in our map folder and playable.

Although the repack comes with some issues like sheep has noticed, the grass and photo_menu things. If it continues to break things like that, I may opt not using it anymore simply because it takes away from map i guess.
Post Reply