PDA

View Full Version : How to create RES files for Source servers:


ocarD
12-04-2004, 08:08 AM
For custom maps that have new resources (such as models or sounds) you
need a file in the maps directory called <map name>.res that lists all
the custom resources required by that map. It should contain the list of
files that a client will download when they get the custom map from the
server.
The format of the file is:
-----------------------------------------------
"resources"
{
"blabla.txt" "file"
"sounds/blabla2.txt" "file"
}
--------------------------------------------------
Note the "file" parameter, the .res file consists of key values pairs
and each value parameter must be "file" for map resource files.

This file is needed for both in game downloading and for the http
external downloader.

nnuex
12-04-2004, 11:12 AM
thanks! please add to the SDK Documentation

ocarD
12-04-2004, 08:05 PM
I'll pass along the request.

showdax
12-05-2004, 10:55 AM
Are only files allowed in the list, or can you have it scan whole directories? For maps like zt_assualt, the res file would become pretty big if the latter wasn't supported.

ocarD
12-05-2004, 08:54 PM
scan? You have to create the RES files yourself.

showdax
12-06-2004, 06:48 AM
No, I meant something like:

"resources"
{
"some/random/directory/" "directory"
}

KrezerJ
12-08-2004, 11:34 PM
well, until United Admins write an HL2 version of ResGen (http://www.unitedadmins.com/resgen.php), i will be using my own tool.

It is extremely simple. Extract a map zip to a new folder. Make sure all files are organized into their appropriate sub folders (example: maps, sound, materials). Then just drag the extrated map folder to my program and it creates the res file (by listing the files).

you know... the map zt_assualt has 400 dependancies. you'd have to be crazy to make that list manually.

krezerj_hl2_folder2res.exe (http://download.krezerj.com/krezerj_hl2_folder2res.exe) (533KB)
This file is a self extracting RAR, i reccomend extracting to your desktop. Just follow the readme and you should be good to go.

Additional Notes:
This program is actually just a php script and a win32 php.exe binairy so the source code is there, feel free to use your own copy of php binairy if you dont trust me
You are free to modify or redistribute any origional materials (as long as credit with a url to my site is included)
This script/program is provided AS IS. I'm not responsible if your computer blows up or calls you funny names
i have tested it for in-game downloading; i have not tested for the url download trick.

Emanon
12-19-2004, 11:48 AM
Works great thanks!

aXeR
12-26-2004, 03:42 PM
Originally posted by KrezerJ
; i have not tested for the url download trick.

Doesnt appear to work for sv_download ... :(

KrezerJ
12-26-2004, 04:31 PM
i'm using sv_downloadurl now, it seems to work fine, one problem may be if someone runs the command changelevel DE_DusT, or something like that and the webserver is case sensitive(ie. Linux/Apache). you should have spelling correction enabled on apache for that host/virtual host (CheckSpelling on) and of-course have all the files listed in the res files in their appropriate subfolders. annother note, the url should not end in a / since hl2 automatically adds one. check annother thread for working examples and information. (dont forget to put the res file in the http://url/maps/ folder too)

evydaemon
12-31-2004, 07:09 AM
it aint working.

ive put the res file both to the webserver maps directory and the css servers maps directory and the only thing which gets downloaded is the map file itself (at full speed)

the res file looks like that:

"resources"
{
"materials/congo/fall.vmt" "file"
"materials/congo/fall.vtf" "file"
"materials/congo/fall_under.vmt" "file"
"sound/jungle/3dmriver.wav" "file"
"sound/jungle/congo.wav" "file"
}

the directory structure seems ok on the webserver (the files are not available on the css server - do they need to be stored on both?? would be a mess).
files were copied case sensitive.


sv_allowdownload is not set

sv_downloadurl is set to "http://mywebserver/bin/css/unpacked_maps/"


in this directory there are the maps/, materials/, sound/,... folders with the files.

any suggestions?

evydaemon
12-31-2004, 07:46 AM
Originally posted by KrezerJ


you know... the map zt_assualt has 400 dependancies. you'd have to be crazy to make that list manually.

krezerj_hl2_folder2res.exe (http://download.krezerj.com/krezerj_hl2_folder2res.exe) (533KB)
This file is a self extracting RAR, i reccomend extracting to your desktop. Just follow the readme and you should be good to go.


works perfectly, thx for this fellow!

but it does not solve my problem with downloading the custom content resources.

EDIT:

ok problem solved. you have to copy all custom resources to both locations (the http server and the css server itself)
then this will work.

coolplayer2000
01-22-2005, 06:01 PM
Hello,

I think it's great you have posted this info about uploading custom texture and MODELS.


However there is a problem with uploading all model content.
Example:

"resources"
{
"maps/test.bsp" "file"
"maps/test.res" "file"
"models/test.mdl" "file"

"models/test.dx80.vtx" "file"
"models/test.dx90.vtx" "file"
"models/test.sw.vtx" "file"
"models/test.dvv" "file"

"materials/test.vmt" "file"
"materials/test.vtf" "file"
}

These files will not upload:
"models/test.dx80.vtx" "file"
"models/test.dx90.vtx" "file"
"models/test.sw.vtx" "file"
"models/test.dvv" "file"

Does valve solution to this problem? Maybe you do?
However this has not worked for 2 months. I have emailed valve at sdk@valvesoftware.com with no answer back in one full month to this problem.

Need help,

Thank you,

Leroy





Originally posted by ocarD
For custom maps that have new resources (such as models or sounds) you
need a file in the maps directory called <map name>.res that lists all
the custom resources required by that map. It should contain the list of
files that a client will download when they get the custom map from the
server.
The format of the file is:
-----------------------------------------------
"resources"
{
"blabla.txt" "file"
"sounds/blabla2.txt" "file"
}
--------------------------------------------------
Note the "file" parameter, the .res file consists of key values pairs
and each value parameter must be "file" for map resource files.

This file is needed for both in game downloading and for the http
external downloader.

KrezerJ
01-22-2005, 07:22 PM
um, dont you mean "<modname>\materials\Models" or "<modname>\materials\Props" ?

I dont have a single custom map with a "<modname>\models\" directory

coolplayer2000
01-22-2005, 07:51 PM
Nope,

I am talking about any place the model files are it will not upload
anything with test.dx80.vtx test.dx90.vtx or test.sw.vtx.

Try it yourself please don't take my word for it.

Have you uploaded your own custom models automaticly.

It uploads the mdl file no sweat.

THank you,
Leroy

Originally posted by KrezerJ
um, dont you mean "<modname>\materials\Models" or "<modname>\materials\Props" ?

I dont have a single custom map with a "<modname>\models\" directory

psxmaster
02-16-2005, 02:39 PM
Hello,

I think it's great you have posted this info about uploading custom texture and MODELS.


However there is a problem with uploading all model content.
Example:

"resources"
{
"maps/test.bsp" "file"
"maps/test.res" "file"
"models/test.mdl" "file"

"models/test.dx80.vtx" "file"
"models/test.dx90.vtx" "file"
"models/test.sw.vtx" "file"
"models/test.dvv" "file"

"materials/test.vmt" "file"
"materials/test.vtf" "file"
}

These files will not upload:
"models/test.dx80.vtx" "file"
"models/test.dx90.vtx" "file"
"models/test.sw.vtx" "file"
"models/test.dvv" "file"



Just be sure you dont leave some empty line

do like this


However there is a problem with uploading all model content.
Example:

"resources"
{
"maps/test.bsp" "file"
"maps/test.res" "file"
"models/test.mdl" "file"
"models/test.dx80.vtx" "file"
"models/test.dx90.vtx" "file"
"models/test.sw.vtx" "file"
"models/test.dvv" "file"
"materials/test.vmt" "file"
"materials/test.vtf" "file"
}

it gonna work!!

[BMC] PsX

Mr._N_e_o
02-19-2005, 02:16 AM
Hello,

i think i a have the same problem with some RES files :( For example de_mcdonalds.res.
Is there a limit for size of the RES oder number of files in it? Smaller one work properly but lager one won´t work.
(de_mcdonalds, zt_assualt, de_rats)
The only file that is downloading ist the mcdonalds.bsp :(

Meanwhile i found a solution.
The RES file should be on the LINUX source server and the server where the downloadurl leads to.

HeX314
06-10-2005, 04:28 AM
#!/bin/bash

loop=1
total=1
let total=`cat $1 | wc -l`
echo "\"resource\"" > $2
echo "{" >> $2
while [ $loop -le $total ]; do
echo "\"`head -n $loop $1 | tail -n 1`\" \"file\"" >> $2
let loop+=1
done
echo "}" >> $2
Parameter 1: Original .res file or file with list of files with paths relative to cstrike.
Parameter 2: Destination .res file (source compatible)

Spoonman
06-14-2005, 07:15 AM
Originally posted by Mr._N_e_o
Meanwhile i found a solution.
The RES file should be on the LINUX source server and the server where the downloadurl leads to.


Exactly WHERE on the Linux server ? (location, mapnames etc.).

ScottZz
06-23-2005, 03:59 AM
In your local server maps folder.

I've been knocking my brains out on this one for a few hours.
It's just plain weird, but true.

The .res file I was working with had about 40 entries in it and wasn't working.

I saw this post, put it in the local maps directory and viola, it works. I don't have to do this with other (smaller) .res files.

Very weird. Thought .res files were for URL downloads only and the local server didn't care about them.

Pvt_Ryan1_00
09-28-2005, 06:11 PM
Here is one I scripted and I use:



#!/bin/bash
# res_file_creator.sh
#
# By Pvt Ryan...
#
# Find me at one of these 2 locations:
# http://s11.invisionfree.com/Pvt_Ryan/index.php
# http://www.lathwood.co.uk
#
# ----------------------------------------------
#
# Resoure file maker for CSS
# Lists all files in the sub dirs of current dir and outputs them to a resource file.
#
# To use place in the dir into which the map was extracted.
# eg
# uzip map.zip -d resMaker
# ./resMaker/res_file_creator.sh
# ./resMaker/maps
# ./resMaker/sound
# ./resMaker/materials
#
# Then run with the command: sh res_file_creator.sh <mapName>
# eg
# sh res_file_creator.sh cs_office
#
#-------------------------------------------------------------------------------------


# Declare Variables
mapName=""

# Test for cmd line args
if [ $# != 1 ]
then
echo -e "You need to add the map name as an argument."
echo -e "E.G. sh scipt.sh de_map"
else
mapName=$1
touch $mapName.res1
touch $mapName.res
echo '"resources"' > $mapName.res
echo { >> $mapName.res
fi

# Search the materials folder first if it exists
if [ -r ./materials ]
then
find ./materials *.* -mindepth 1 | cut -f2,3 -d. | cut -f2- -d/ | grep -i '\.' >> $mapName.res1
fi

# Search the sound folder if it exists
if [ -r ./sound ]
then
find ./sound *.* -mindepth 1 | cut -f2,3 -d. | cut -f2- -d/ | grep -i '\.' >> $mapName.res1
fi

# Search the models folder if it exists

if [ -r ./models ]
then
find ./models *.* -mindepth 1 | cut -f2,3 -d. | cut -f2- -d/ | grep -i '\.' >> $mapName.res1
fi

cat $mapName.res1 | while read line;
do
{
echo '"'$line'"' '"file"' >> $mapName.res
}
done

echo } >> $mapName.res

rm -r $mapName.res1

echo -e "Output in the file $mapName.res"

exit 0

WW2-WARDOG
10-19-2005, 10:24 AM
The .res always goes in the server map folder, not the fast DL url.

Sometimes when creating a .res it will miss or scip files that are in one or more of the map folders you are installing, maybe sounds,or resource, or models.

You have to manually double check and compare the .res to the folders and add any directory thats missing in them to the .res, then your good to go.

stuttering.john
02-28-2006, 09:54 AM
you should regularly check this site for a professional tool that generates a
.res file by parsing the .bsp, currently it only supports half-life maps (not hl2 maps)
http://www.unitedadmins.com/resgen.php
hm, so, like, i dunno, why is this in the srcds forum?

de_contra is being a pain in my rear on our linux srcds. this is the .res file i came up with. i can't test it atm, but i'm assuming it won't work :)

"resources"
{
"de_contra.bsp" "file"
"de_contra.txt" "file"
"/cstrike/materials/de_contra/de_contra_asign.vmt" "file"
"/cstrike/materials/de_contra/de_contra_asign.vtf" "file"
"/cstrike/materials/de_contra/de_contra_bsign.vmt" "file"
"/cstrike/materials/de_contra/de_contra_bsign.vtf" "file"
"/cstrike/materials/de_contra/de_contra_cred.vmt" "file"
"/cstrike/materials/de_contra/de_contra_cred.vtf" "file"
}


de_contra.res is in /cstrike/maps/de_contra.res

Better|Off|Dead
04-19-2006, 05:01 AM
Bumped to avoid being purged.

vaD
12-13-2006, 12:10 AM
Thanks man.

smash
03-15-2007, 05:04 PM
Bump to avoid yet another purge.