Serving maps from http server

Got a tip you think would benefit someone? maybe you know a good strategy for a particular map?

Moderators: boat, rickh

Post Reply
User avatar
Grummun
[NME] tried and true
[NME] tried and true
Posts: 205
Joined: Wed Jan 12, 2005 3:49 pm
Location: Central OH
Contact:

Serving maps from http server

Post by Grummun » Thu Mar 17, 2005 2:43 pm

After a lot of people spent a lot of time waiting for the weekend-mapcycle maps to download, someone mentioned that an HLDS server can be configured to refer clients that need to download part or all of a map to an alternate server, instead of downloading the files from the HLDS server. The benefit is that the alternate server will send the files via HTTP, at the best rate possible, as opposed to the HLDS server sending the files at a throttled rate. I vaguely recalled hearing about this in the past, but had to do some googling to run down the details. Here's a summary of what I've learned:

On the HLDS server, set cvar 'sv_downloadurl' to point to the root of the TFC directory structure on your HTTP server. In my case, that's:

sv_downloadurl "http://www.grummun.com/ta/dl/tfc"

Also, you need to have complete .res files for all the maps on your HLDS server. The steam client determines which files to download from the HTTP server by looking at the .res file on the HLDS server. Boat pointed me to a package called resgen that roots through the .bsp file and determines dependencies to put in the .res file. This works pretty good, but it has some failings. First, it doesn't include the map's .txt file, probably because if you're downloading from the HLDS server, you get the .txt file without it having to be in the .res file. If you want the .txt file to come down from the HTTP server, it does need to be in the .res file. Second, if a map has custom environment files (in gfx/env/), but only has .bmp files and not .tga files, resgen will not include the .bmp files in the .res file. Initially, I thought that the .bsp file needed to be in the .res file also; that is not the case, and in fact, if the .bsp file is in the .res file, you'll end up downloading it twice. :o

On the HTTP server, you need a directory structure that looks like the mod directory on your HLDS server, in my case, the tfc/ directory. So, on the HTTP server, if http://www.grummun.com/ta is located in:

/var/www/path/to/grummun/com/ta

and sv_downloadurl is set to 'http://www.grummun.com/ta/dl/tfc'

then there needs to be

/var/www/path/to/grummun/com/ta/dl/tfc

and under that there needs to be maps/, sound/, sprites/, models/ etc. just like on the HLDS server. If you want the steam client to put up a little plug for you, create a 340x56 .gif called 'banner.gif' and put it under gfx/ on the HTTP server. This gif will be displayed by the steam client while files are downloading from the HTTP server.

If, like me, you've got your HTTP server running on a case-senstitive OS (that is, not windows), you need to be careful with filenames. Resgen by default creates .res files in all lower-case. All the files under tfc/ should also have all lower-case names. A lot of map zips have mixed-case filenames; if the HTTP sever can't find a file because the case is wrong, you'll end up getting that file from the HLDS server.

So that's all I got. At this point, all the maps on TA should be available through HTTP, so hopefully map downloads won't be so painful.

Grum

User avatar
boat
[NME] tried and true
[NME] tried and true
Posts: 2753
Joined: Fri Dec 07, 2001 8:00 pm
Location: Hampton Roads, VA
Contact:

Post by boat » Thu Mar 17, 2005 3:51 pm

thx. :ohyeah:

so if the bsp shouldnt be in the .res file, why wasnt it working before? case-sensetivity? :?:

User avatar
Grummun
[NME] tried and true
[NME] tried and true
Posts: 205
Joined: Wed Jan 12, 2005 3:49 pm
Location: Central OH
Contact:

Post by Grummun » Thu Mar 17, 2005 8:10 pm

boat wrote:thx. :ohyeah:

so if the bsp shouldnt be in the .res file, why wasnt it working before? case-sensetivity? :?:
Exacltly. The map I tested with was 2desert, which unzips as '2Desert.bsp'. The HLDS server apparently told the client to look for '2desert.bsp', which wasn't on the HTTP server. So it fell back to downloading the file from the HLDS server, 'cause it's a windows box and doesn't know diddly 'bout case. I misinterpreted this behaviour, only to ponder later why I was downloading the .bsp twice. Doh.

G

Post Reply