Monday, December 26, 2011

Making a res file

Res file is very important for server admins. If you are to make a complete map with custom assets, it is important to add a res file. You can also use a res file generator to create a res file

Introduction
Back in the days, Valve made their file system in such a way that whenever a user hosted a custom map on the server, the bsp and the txt file would automatically get transferred to the clients. But they did not anticipate the large influx of custom maps and assets. So, they updated their system in a patch.
 
         Now whenever you host a custom map, the server checks for a res file. If it finds one, it will automatically upload the files mentioned in the res file along with the bsp,txt and the res file to the client. Otherwise it will only transfer the bsp and the txt file.

Step 1
Open a new notepad file and change the extension to .res Now open it up.
The res file syntax allows double slashes for comments. Like this:
//This is a res file for de_muhahaha
It is not necessary to add comments but it is a good practice.
Also, you can leave as much whitespace as you want to.(Blank space)
Now , I have a sample map having two custom models in models/de_muha folder. So type in:
models/de_muha1.mdl
models/de_muha2.mdl
This also applies for every other game asset. Keep in mind that bundling the wad file in your bsp is the best option. I will post a tutorial about integrating your wad files in your bsp file later on.

Step 2
After you have added a couple of sound and model files, the res file should look like this:
//This is a res file for de_muha

models/de_muha/deadbody.mdl
models/de_muha/pinetree.mdl

sound/de_muha/rusting.wav
sound/de_muha/ambience.wav

de_muha.wad

As you can see, I have also added a wad file to the res file. Keep in mind that you do not have to add the bsp, txt file and the res file in the res file. This will make the client download the assets again after download.

Now just paste the res file in you maps directory and change its name to the name of your map. Eg: de_muha.res

Res file generator
Many people prefer the res file generator. This app automatically generates a res file of your map. Downside is that it is command line only so it may be a bit intimidating for people without any command line programming experience.
Anyways, its quite simple to make a res file with a res file generator. First, download the generator from here.
Extract the file contents anywhere. It is recommended to read the manual.txt file. Now copy the contents of the res file in your maps folder. Now start cmd by clicking windows+r and typing cmd in run. This will open up command prompt. Type c:\ <Path of your maps folder in here> -f -gg.bsp -resgen.exe in the cmd window.(gg.bsp is our sample map. Type in some map which has custom assets to try out)
For example, I will type c:\cs\cstrike\maps -resgen.exe -f -gg.bsp. This will create a res file for gg.bsp


Notes:
Making a res file is really simple. But a res file generator is only needed if you are a server admin as it has a parameter by which you can generate res files of all the maps in a given folder. What server admins really hate is to see a really good custom map without a res file. So don't forget to make one for your next big map.

No comments:

Post a Comment

Post your views here