SRCDS Steam group


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
resource files - how to make them quickly
#1
[ I had to split this into 2 posts as apparently my tutorial includes too many images. Yay. I wouldn't even care but I'm hosting the images so I figure I should be able to post as many as I bloody well want to :-). -knoid ]

Scope

This tutorial is aimed at Windows users. If you have a Linux server you can still create resource files using the method given in this tutorial but you will need to use a Linux-compatible text editor such as NoteTab Light to edit the .res file - text files from Notepad give Linux fits Smile.

Linux users can use the base method outlined here but the console commands will be different - I believe something like "find > mapname.txt" should do the trick once you've cd'd to the relevant directory.


Introduction

Running custom maps can be a pain on a Source server as the majority of customs come with millions of small resource files but without a resource file to enable proper downloading from the server/webserver.

Here, then, is a short tutorial to show you how to put together a resource file in the shortest possible amount of time. It should take you much longer to read this tutorial than to actually make the files Big Grin.

The basic format of a resource file is:

Code:
"resources"
{
"path\to\resource.ext" "file"
.
.
.
"path\to\resource.ext" "file"
}

It's fairly simple, but rather tedious to put together by hand unless you know a few short workarounds.


Creating a list of the custom files

First off, unzip the map and all it's associated files into a clean directory that's outside of your server directory - e.g c:\downloads\mapname.

Now, open a DOS box (Start -> Accessories -> Command Prompt) and type in the following commands:

Code:
cd \path\to\map

dir /s /b >mapname.txt

Replace "\path\to\map" with the path that you unzipped the map to. If you have trouble figuring out the path, open windows explorer and browse to the directory - you can then grab the full path from the 'address' box.

[Image: res2.jpg]

The first command gets you to the location of the map files on your HD. The second command creates a text file called mapname.txt (or any other name you specify) with the name and location of every file and directory contained inside \path\to\map.

[Image: res3.jpg]

After you run those two commands, you should see a text file (mapname.txt) in your \path\to\map. Double-click on it to open the file in Notepad - if everything went to plan, you should see something like this:

[Image: res4.jpg]


Removing unnecessary info

The next thing we need to do is remove all spurious information from the file. This is done in two steps:

1. remove the unnecessary path info from each line, and
2. remove the unnecessary entries at the top of the file.

Both steps are done using the Find/Replace tool:

[Image: res5.jpg]

For step one, you need to enter the \path\to\map that we found above in the "Find" box, and leave the "Replace" box blank:

[Image: res6.jpg]

Now hit "Replace All", and every instance of \path\to\map will be replaced with nothing. Resource files use path names relative to the mod directory (e.g. 'cstrike' or 'hl2mp') - if we didn't remove the \path\to\map then the resource file would be completely useless.

For step two, highlight every line that doesn't have a proper filename. We can also remove lines for things like README.txt and the map.bsp file - we're only interested in stuff inside the materials\, models\ and sound\ directories.

[Image: res7.jpg]

Hit the 'Del' key to remove the highlighted lines.
knoid || Admin, joe.to gaming community
tf2.joe.to - challenge maps
tf4.joe.to - custom maps
#2
[ part two -knoid ]

Turning a directory list into a proper .res file

Now we have a list of every custom texture, sound and model that came with the map. While this is all very nice, it's not particularly useful to us in it's current form. For your SRCDS server to interpret it properly, we have to add a few things.

Firstly, add the following at the very top of the file:

Code:
"resources"
{

[Image: res8.jpg]

At the bottom, add a single closing curly bracket:

[Image: res9.jpg]

Finally, we need to add quotes to the beginning and end of each line. We also need to add a "file" to each line. The quickest and simplest way to do this is to use our handy-dandy Find/Replace tool again Big Grin.

In the Find box, type:

materials

In Replace, type:

"materials

[Image: res10.jpg]

Now hit "Replace All", and you should end up with a quote at the beginning of each line.

If there are any custom files in models\ or sounds\ then you will need to do a Find/Replace for those in the same manner as for materials\.

To add the quote and "file" at the end of each line, you will need to do a Find/Replace for each extension type (e.g. .vmt, .vtf, .wav etc). This means that you will need to do at least 2 Find/Replace steps (for .vmt and .vtf), possibly more if the map comes with custom sounds or models.

For each extension type, you need to do a "Replace All" with the following:

Find: ext

Replace: ext" "file"

I am substituting .ext for the actual extension here, but I hope you get the point. As an example, for .vtf you would do:

[Image: res11.jpg]

and for .vmt:

[Image: res12.jpg]


Committing the resources to memory

For your SRCDS server to see the resource file it needs to be saved with a .res extension - so go to File -> Save and save the file as "mapname.res":

[Image: res14.jpg]

Make sure you set "Save as Type" to "All files" or your file will probably be saved as "mapname.res.txt" - this is not a good thing, as it will be overlooked by your server.

Copy or upload the .res file to the maps\ directory on your server and you should be good to go - you will now be able to download custom maps and all their resources properly.
knoid || Admin, joe.to gaming community
tf2.joe.to - challenge maps
tf4.joe.to - custom maps
#3
nice tutorial, i wanted to do a .lst file for de_rats, its now easy, thank you
#4
You're welcome Big Grin. Thanks for the kind words.
knoid || Admin, joe.to gaming community
tf2.joe.to - challenge maps
tf4.joe.to - custom maps
#5
I have something easier than all that. That is a lot to do. This program will automatically create them for you.



Attached Files
.zip   ResGen.zip (Size: 601.55 KB / Downloads: 182)
#6
Any way to include URL's in .res files?
#7
Exclamation 
[font=Courier][color=navy]I'm really having an issue with ping.... first off, I created my server. Now i get a connection problem once i join a team, then my ping rockets sky high to an outrageous 500+!!! Someone please help!!!!
#8
I have a question or 2 Smile in your tutorial post you use \ in the resgen app it uses / so which do i use? also what are the files in the downloadlists folder for eg mapname.lst is this the same as a .res file? is .res windows and .lst linux? or do i create both files. on looking at the files they both seem very alike in structure.
Ive got 2 servers running linux and im having trouble getting stuff from materials to be d/led from the server when players d/l the map.
thanks in advance
Wisey.


Forum Jump:


Users browsing this thread: 1 Guest(s)