Member
Join Date: Nov 2007
Location: Principality of Liechten
|
12-25-2007
, 19:48
Re: HTTP Downloader
|
#5
|
Quote:
Originally Posted by Alka
Not really, you can't download other files than ".wav/.mp3/.bsp/...", with this you can download any file ;)
WootZ! Gj
|
You are lying, tell tall stories...
Quote:
Overview This tutorial is to explain the purpose of RES files. What they're for, how to create them, where to put them, etc. You only need to be concerned with RES files if you're putting a custom map on an online server (Counter-Strike, HL Deathmatch, TFC, etc.) You need to use a RES file if you want to "push" to clients a WAD file, sky textures, sounds, etc. that are required in the map. If you're making a single-player map for people to download, you needn't be concerned with RES files at all.
What is a RES file?
A RES file is simply a text file, containing a list of other files. The RES file goes along with your compiled BSP file. A RES file is used to instruct the Half-Life server to send the specified files to clients that do not have your custom art or sounds. The RES file must be named just like your BSP file, except with a .RES extension. So if your map was named cs_mymap.bsp, you would create a RES file called cs_mymap.res. The RES file must be in the same directory as your BSP... in other words, the maps directory under the mod.
It works like this:
1. The server changes to your custom map, or a client connects while your map is on
2. The server looks for a RES file that matches the name of the BSP
3. The server loads the RES file and looks for images/sounds/stuff that need to be sent to clients
4. If the client machine does not have the specified file(s) (or the file(s) are not the same date/size,) the server will send them to the client
5. Once ALL files referenced in the RES file are downloaded by the client, the client connects and is able to play
It is important to note that the client will be unable to play your map until all of the files have been received. This is because you will likely have textures and other such files that are critical to the HL engine. As such, if you've got a lot of custom files or a large WAD file, you might want to consider either trimming down the size. You can do this by removing any unused textures from your WAD so it is as small as possible. Another method would be to try and find any textures that you're only using in a couple places. Are they really necessary? Would it be possible to use some other texture and get the same effect? Clients generally do not have much patience while waiting for large numbers of big files to download, and they'll likely just cancel out. So the more clean-up you do the better off everyone else will be.
Creating your RES file
Since RES files are just text files, you can use any generic text application to create and edit it. I use notepad, but anything will do, so long as it writes a generic ASCII text file with no special formatting.
There are utility programs out there that will edit RES files specifically, but I haven't worked with any of them so I can't describe what they can be used for.
RES layout
The layout of the RES file is pretty straight-forward. You describe exactly one file per line. In order for the server to find your files in the directory structure of a mod (like cstrike,) you need to specify its path. This path relative to the "root" directory. In all cases, the "root" directory is always the mod directory that the server is playing. For a Counter-Strike server, this would be c:\hlserver\cstrike. For a TFC server, this would be c:\hlserver\tfc. So consider the "root" directory as the absolute base for where your custom files would be referenced from.
You may be thinking to yourself already, "Does that mean I can't send files that exist outside of the mod directory?" Good question! The answer is: no you cannot. In fact, if you try and specify files that reside elsewhere, the server crashes. While testing this tutorial, I did just that on a public CS server while trying to specify a file at the root of the hard drive. Not pretty. Lesson: only files that exist at or under the mod directory structure can be specified.
Now how do you actually specify the path, relative to this "root" directory? It's fairly easy: just prepend the name of your file with the folder(s) that your file is stored in. For example, let's say you're working on a map for Counter-Strike. The root directory for this mod is c:\hlserver\cstrike. You've made a cool map, and you have some sky textures that need to go with it. Sky textures are stored in the c:\hlserver\cstrike\gfx\env folder. Since c:\hlserver\cstrike is to be considered the root, you only need to specify the gfx\env part. So with those 6 sky textures, here's what your RES file would look like:
gfx\env\mysky_up.tga
gfx\env\mysky_dn.tga
gfx\env\mysky_lf.tga
gfx\env\mysky_rt.tga
gfx\env\mysky_ft.tga
gfx\env\mysky_bk.tga
Now let's say we've got some sound files that also need to go with those sky textures. The sounds are stored in the c:\hlserver\cstrike\sound\misc directory. Here, the relative path is just sound\misc. Here's the updated RES file, with our sounds added:
gfx\env\mysky_up.tga
gfx\env\mysky_dn.tga
gfx\env\mysky_lf.tga
gfx\env\mysky_rt.tga
gfx\env\mysky_ft.tga
gfx\env\mysky_bk.tga
sound\misc\metaldoor.wav
sound\misc\heavychain.wav
Is there any way to avoid a RES file?
For wall textures in your map, the answer is Yes. For sky textures, sounds, models, or anything else you might have created, the answer is No. If you've just got a WAD file to go with the map and you want to avoid having to use a RES file, you can just re-compile your map with a command-line option:
qcsg -nowadtextures mymap.map This will force the compiler to put the actual textures directly inside the compiled BSP file. This has its advantages and disadvantages. On the pro side, if you only have custom textures, you can keep everything together in one BSP file which makes it really easy to put up on servers and give to people. You won't need a RES file at all.
On the con side, if you're using lots of textures from Half-Life, or any other of the pre-existing WAD files that either came with the mod, those textures are also going to be stored inside your BSP. This, of course, makes your BSP much larger than if you kept them separate. There is no way to stop this from happening; it is either all or nothing. This could potentially be a huge waste of file space and download time since the client may already have them. The more unique textures you add, the larger your BSP grows. 5, 6, 7 meg files are not uncommon. For modem users, this is an unbearable download, and the map might even change before they get the entire BSP downloaded.
Another con for the -nowadtextures option is that if you make even a small change to the map, say for something as simple as some new spawn points, the entire BSP (all 5 megs of it) will have to be downloaded again. If you keep the WAD file separate, you can make changes to the BSP and the clients will only have to download that portion (read: smaller!)
Which way you go is up to you, and varies depending on exactly what textures you're using and where your map is going to be located. If you don't mind working with RES files, it really is the best option.
|
|
|