Jump to content
News ticker
  • Bienvenue sur le nouveau forum VeryGames
  • Welcome to the new VeryGames forum
  • VeryNews

    CS-Source => Compress your BSP Files with BZIP2


    Recommended Posts

    The last update of Valve came brought small problems, but also of the very useful things, such as format BZIP2.


    Here I explain you how to use BZIP2 to optimize your game server


    Tuto made by Cedrsan, may 15 2005

    (My french version => http://forum.verygames.net/viewtopic.php?t=3544 )


    What is BZIP2 ?


    bzip2 is a freely available, patent free , high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression.


    Command line flags are similar to those of GNU Gzip, so if you know how to use gzip, you know how to use bzip2.


    The code is organised as a library with a programming interface. The bzip2 program itself is a client of the library. You can use the library in your own programs, to directly read and write .bz2 files, or even just to compress data in memory using the bzip2 algorithms.


    Its only a one to one zipping of files, you should just bzip2 each file (to the name <filename>.bz2) and put it up on the web server (it works like the .ztmp files).



    Which is the relationship between BZIP2 with Valve Source Engine ?


    Source Engine integrates BZIP2 algorithm and thus allows the use of this one.


    Who can use it ?


    Only the admins which have a Web Server where the files of the game are stored which will be downloaded by the players (with the sv_downloadurl cvar)


    I recommend to use this function only for the maps which are the largest files of the play (not necessary for other files as materials or sounds).


    Which utility can one have some ?


    With BZIP2, it is from now on possible to compress large files which the players must download before being able to play (e.g. Maps...)


    For example :


    For the moment your de_dust3.bsp file have his origin size. A player who does not have this map will have automatically to download it on your Web server.

    The size of this .BSP is of 14,2Mo. For small connections, it takes very a long time to download.


    You can optimize that with BZIP2 !!


    Indeed, with BZIP2 you can reduce the size of this file to....3,63Mo !!

    That allows an enormous saving of time at the time of the remote loading.


    Another examples :


    cs_bikini before => 32Mo

    cs_bikini after => 10Mo


    de_alivemetal before => 9,48Mo

    de_alivemetal after => 4,09Mo


    de_dust_pcg before => 7,25Mo

    de_dust_pcg after => 2,89Mo


    cs_assault_2005 before => 3,53 Mo

    cs_assault_2005 after => 1,57Mo


    It's not a dream ;) You can reduce by 50 percent the size of your files :!:



    How can use it ?


    BZIP2 Files are used only with the Web server. It is in this place that they will be stored. (NOT ON THE GAME SERVER :!: )


    It is enough for you simply to remove your BSP files which are on your Web server, and to replace them by the new compressed files which you will create :


    First, download BZIP2 executable for your plateform => http://www.bzip.org/downloads.html


    When you downloaded the file, save it at the root of your hard disk 'C:\' for a more practical use.


    Now, create a directory named BZIP2, Always at the root of the hard disk 'C:\'.


    Copy all the BSP file which were on your Web Server in the 'c:\BZIP2 ' directory that you have just created.



    Now we will compress these maps :


    We need to make the operation in a DOS command line.


    Click on START => RUN => type cmd => click OK




    Go to the root





    Compress BSP files

    Type bzip2 \bzip2\*.* (or for just 1 map, replace *.* by his complete name. e.g c:\bzip2 \bzip2\de_dust3.bsp )




    Now if you look at your BZIP2 directory, it contains all your maps compressed



    That's it !


    Now you can upload these files to your Web Server. (don't remember to delete all .BSP files !!! )


    All the players who do not have a map which is on your Game Server will automatically download the map from your Web Server. The compressed map that they will download will be automatically decompressed in less than 3 seconds by their Game ;)


    If you wish to test before creating your own maps compressed, I put a map here that I already compressed de_dust_pcg.bsp.bz2


    Download it and simply upload to your Web Server :wink:


    Have fun :)



    Link to comment
    Share on other sites

    • 1 year later...

    Another Question regarding this subject!


    Before I begin I must say thank you for such a well doen tut, it has certainly cleared up my question of leaving replacing the .bsp files with .bz2's...

    I hope someone who reads this can respond in english as I do not know how to responf in french.


    My question is this.


    If i use the sv_downloadurl command in my server.cfg then when does the hlds server know when to pull the maps from the webserver to the clients and not the hlds server? As not all my content will be served from the webserver.


    I started using the webserver to serve .bz2's but I ran into a problem when serving the admin_plugin sounds. I saw that it was not downloading them but looking at the webserver for them. When loading a map u would see...


    waitingforsusoect.wav go by then when it couldn't find it it would look 4



    as soon as i removed the sv_downloadurl it downloaded them from our hlds without a hitch


    So is there a way to differentiate the sv_downloadurl command to only serve .bz2 or would i have to copy all my content onto the server?


    I have posted the similar questions here:


    I would appreciate it if you took a look at my other post that no one has reponded to.


    TIA hope to hear from you soon


    Link to comment
    Share on other sites



    you can compress your sounds as well as maps and host them in www\cstrike\sound\admin_plugin\yourteamname\, in www\cstrike\sound\quake for quake sounds...

    You simply need to respect the same directory structure than your game server.



    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


    • Create New...