Addon: Bzip2 all maps(Team Fortress 2, and Garry's Mod)

You can share your game exports here.
Post Reply
Cypher100
Posts: 6
Joined: Thu Jan 23, 2014 12:16 pm

Addon: Bzip2 all maps(Team Fortress 2, and Garry's Mod)

Post by Cypher100 » Fri Jan 16, 2015 7:23 pm

Running something like "bzip2 -k *.bsp" will just compress the maps again if even a bz2 file already exists for it, and it would also compress the stock maps; that will waste storage, and resources. This script checks if the map has already been compressed, if it already has been compressed it will skip it. It will also check for stock maps(Maps that came with the game) and will skip them too. This will save time, and go a lot faster. You can easily modify this to work on other source games that use the fast download feature.

Team Fortress 2
Name: Bzip2 Maps
User Install: True
Description: This will compress all maps in the map directory for fast download. BSP file will still exist for the server to use.
System Commands: True
Linux command:

Code: Select all


## Create array of stock maps for bzip2 to ignore.
StockMaps=('arena_badlands.bsp' 'cp_coldfront.bsp' 'cp_mountainlab.bsp' 'ctf_well.bsp' 'mvm_bigrock.bsp' 'plr_hightower.bsp' 'arena_granary.bsp' 'cp_degrootkeep.bsp' 'cp_process_final.bsp' 'graphs' 'mvm_coaltown.bsp' 'plr_hightower_event.bsp' 'arena_lumberyard.bsp' 'cp_dustbowl.bsp' 'cp_snakewater_final1.bsp' 'itemtest.bsp' 'mvm_decoy.bsp' 'plr_nightfall_final.bsp' 'arena_nucleus.bsp' 'cp_egypt_final.bsp' 'cp_standin_final.bsp' 'koth_badlands.bsp' 'mvm_ghost_town.bsp' 'plr_pipeline.bsp' 'arena_offblast_final.bsp' 'cp_fastlane.bsp' 'cp_steel.bsp' 'koth_harvest_event.bsp' 'mvm_mannhattan.bsp' 'pl_thundermountain.bsp' 'arena_ravine.bsp' 'cp_foundry.bsp' 'cp_well.bsp' 'koth_harvest_final.bsp' 'mvm_mannworks.bsp' 'pl_upward.bsp' 'arena_sawmill.bsp' 'cp_freight_final1.bsp' 'cp_yukon_final.bsp' 'koth_king.bsp' 'mvm_rottenburg.bsp' 'rd_asteroid.bsp' 'arena_watchtower.bsp' 'cp_gorge.bsp' 'ctf_2fort.bsp' 'koth_lakeside_event.bsp' 'pl_badwater.bsp' 'sd_doomsday.bsp' 'arena_well.bsp' 'cp_granary.bsp' 'ctf_doublecross.bsp' 'koth_lakeside_final.bsp' 'pl_barnblitz.bsp' 'sd_doomsday_event.bsp' 'background01.bsp' 'cp_gravelpit.bsp' 'ctf_foundry.bsp' 'koth_nucleus.bsp' 'pl_cactuscanyon.bsp' 'tc_hydro.bsp' 'cp_5gorge.bsp' 'cp_gullywash_final1.bsp' 'ctf_gorge.bsp' 'koth_sawmill.bsp' 'pl_frontier_final.bsp' 'tr_dustbowl.bsp' 'cp_badlands.bsp' 'cp_junction_final.bsp' 'ctf_sawmill.bsp' 'koth_viaduct.bsp' 'pl_goldrush.bsp' 'tr_target.bsp' 'cp_cloak.bsp' 'cp_manor_event.bsp' 'ctf_turbine.bsp' 'koth_viaduct_event.bsp' 'pl_hoodoo_final.bsp')

## Set work directory where the maps are.
cd {GameHomeDir}/tf/maps

## Start Loop to check if the map is ether already been compressed, or is a stock map.
for f in *.bsp; do
    if [[ ${StockMaps[*]} =~ $f ]]
    then
        echo "Not Compressing stock maps - Skipped"
    else
        if [ -f $f.bz2 ]
        then
            echo "Already Compressed $f.bz2"
        else
            echo "Compressing $f"
            bzip2 -k $f
        fi
    fi
done
Garry's Mod
Name: Bzip2 Maps
User Install: True
Description: This will compress all maps in the map directory for fast download. BSP file will still exist for the server to use.
System Commands: True
Linux command:

Code: Select all

## Create array of stock maps for bzip2 to ignore.
StockMaps=('gm_construct.bsp' 'gm_flatgrass.bsp')

## Set work directory where the maps are.
cd {GameHomeDir}/garrysmod/maps

## Start Loop to check if the map is ether already been compressed, or is a stock map.
for f in *.bsp; do
    if [[ ${StockMaps[*]} =~ $f ]]
    then
        echo "Not Compressing stock maps - Skipped"
    else
        if [ -f $f.bz2 ]
        then
            echo "Already Compressed $f.bz2"
        else
            echo "Compressing $f"
            bzip2 -k $f
        fi
    fi
done

beouellet
Posts: 3
Joined: Sat May 07, 2016 4:22 am

Re: Addon: Bzip2 all maps(Team Fortress 2, and Garry's Mod)

Post by beouellet » Sun May 08, 2016 4:42 pm

This not works at all for me

Post Reply