Raised This Month: $51 Target: $400
 12% 

Bzip2 Compression on the fly ! (fastdownload/sv_downloadurl)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 08-29-2009 , 20:03   Bzip2 Compression on the fly ! (fastdownload/sv_downloadurl)
Reply With Quote #1





I always found it annoying, having to compress files everytime I upload a new map/texture/sound to my server manually. That's why I started thinking about if it would be possible to compress files on the fly while the client is downloading it.

And yes, it's possible

I've spent some hours writing a PHP script and filed it out allot.

Requirements:
  • Apache2 webserver running on the server machine where the gameserver is
  • Apache2 mod_rewrite
  • PHP 5
Features:
  • On the fly bzip2 compression of any files (you can specify the allowed file extensions in config.inc.php)
  • File caching (so already compressed files don't have to be compressed again)
  • Simultanous file sending to clients (clients don't have to wait for the first client to be finished)
  • Multiple server support
  • Specify allowed file extensions
Installation
  1. Simply unzip and upload the attached directory to your webserver directory.
  2. Edit config.inc.php to match your needs
  3. Set chmod of cache to 0770 (rwxrwx---)
  4. Change the sv_downloadurl of your gameserver(s):
Example: sv_downloadurl www.your-domain-or-ip.tld/bzip2_onthefly/configname

Put this line into your cfg/server.cfg file.

Enjoy

Note: Doesn't work for TF2 (and other orangebox games ?) atm.
Attached Files
File Type: zip bzip2_onthefly.zip (2.1 KB, 777 views)
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0

Last edited by berni; 09-13-2009 at 05:00.
berni is offline
Chris-_-
SourceMod Donor
Join Date: Oct 2008
Old 08-29-2009 , 20:12   Re: Bzip2 Compression on the fly !
Reply With Quote #2

Whoa!
Chris-_- is offline
busy.orange
Member
Join Date: May 2009
Old 08-30-2009 , 04:02   Re: Bzip2 Compression on the fly !
Reply With Quote #3

looks awesome
busy.orange is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 08-30-2009 , 08:50   Re: Bzip2 Compression on the fly !
Reply With Quote #4

Why does it have to be running on the same machine as the gameserver? Wouldn't that kind've negate the whole purpose of fastdl?

Last edited by Dragonshadow; 08-30-2009 at 09:36.
Dragonshadow is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 08-30-2009 , 09:50   Re: Bzip2 Compression on the fly !
Reply With Quote #5

Quote:
Originally Posted by Dragonshadow View Post
Why does it have to be running on the same machine as the gameserver? Wouldn't that kind've negate the whole purpose of fastdl?
Show me how you want to zip a file without the source file ! difficult eh
What's the purpose of fastdownload for you ? Well a webserver can give you faster download rates than the gameserver.
Well, if you have your gameserver running on a 3 Mbit Box, I wouldn't recommend you to use this.
The webserver just needs access to the files of the gameserver over the local filesystem, but if both servers are in the same network and you can mount the server over the local network it should also work, never tried that tho.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0

Last edited by berni; 08-30-2009 at 09:56.
berni is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 09-05-2009 , 11:35   Re: Bzip2 Compression on the fly !
Reply With Quote #6

Updated
  • Fixed wrong path description in the config file (Path has to include the gamedir)
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
busy.orange
Member
Join Date: May 2009
Old 09-12-2009 , 08:32   Re: Bzip2 Compression on the fly ! (fastdownload/sv_downloadurl)
Reply With Quote #7

I tested today on TF2 server.
TF2 client can't open bz2. (winrar opens normal)

define("BUFFER_SIZE", 4096);

Attach maps downloaded on my server
Attached Files
File Type: zip maps.zip (2.7 KB, 199 views)
busy.orange is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 09-12-2009 , 08:51   Re: Bzip2 Compression on the fly ! (fastdownload/sv_downloadurl)
Reply With Quote #8

I need more details how you configured your server, can I message you somewhere ?
TF2 should be able to open bz2 compressed maps like Hl2dm too.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 09-12-2009 , 11:12   Re: Bzip2 Compression on the fly ! (fastdownload/sv_downloadurl)
Reply With Quote #9

I'm not able to get this working for TF2 atm.
Orangebox seems to use a different bzip2 compression, unable to decompress the generated files.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 09-12-2009 , 21:44   Re: Bzip2 Compression on the fly ! (fastdownload/sv_downloadurl)
Reply With Quote #10

I just compress everything into bzip with 7zip since I use a external webserver lol.
Dragonshadow is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode