General Server Setup Information

From GMod Wiki

Jump to: navigation, search


Contents

Information in this section applies to all Operating Systems

Publishing a server

Once you have your server running, if it is your own machine, you have to let people connect to it. To do that, you have to open a pinhole in your firewall. This is not the place to go into the reasons why you should have a separate hardware firewall; we will simply assume that you do. Making a pinhole will require that you log in to your firewall (usually from Internet Explore, Firefox, or some other browser), lock your server to a single private IP address, and then direct a port to that address.

Locking a machine to a private IP address

The server must always be at the same address on your in-house network, otherwise game requests will go somewhere else and nobody will be able to log in. So you must ensure that every time your machine is turned on or connected, it gets the same address. The technique used to assign addresses to machines is called DHCP. On most hardware firewalls, on the DHCP page you have options to set "reservations". Many are particularly friendly in that you can find your machine's DHCP "lease" and just copy that into a reservation. Otherwise, you have to enter the "MAC address" of the server, and the IP address, into the reservation manually.

Once you have set a reservation for your server, record the IP address.

Port redirection

For the server to be reachable, network requests must reach it. On most hardware firewalls, you need to set this in the Advanced pages. You are looking for "pinholes", "virtual servers", or "port redirects". Once you have found the page you need, you want to set a rule that says incoming UDP requests on port 27015 are sent to port 27015 on the IP address of your server.

NOTE that if you set a non-standard port when you started the server, as described above, then the port you want to set to be redirected is the same as the nonstandard port. So for instance, if you are running a TF2 server on one machine at IP address 192.168.0.105 and a GM server on another machine at address 192.168.0.101, you would set the TF2 server to the default port 27015 and the GM server to port 27035, as described above. You would then set two port redirect rules, one that directs UDP port 27015 traffic to port 27015 at 192.168.0.105, and one that redirects UDP port 27035 traffic to port 27035 at 192.168.0.101.

Experience indicates that it is not a good idea to have two servers using the same UDP port and trying to use the port remap in the firewall to expose different external port numbers. The port number of the server itself apparently needs to be identical to the port number visible to the Internet at large.

Once you've completed this step, you may want to start your server and visit this SRCDS port checking utility to verify that the forwarding is working and that people will be able to connect to your server.

Done

Once your firewall is accepting traffic and forwarding it to your server, you are done. When your server starts up, it contacts the Steam servers, and from then on it will show up in the available server lists for GM, as long as it stays alive.

Fastdownload (sv_downloadurl)

What exactly is Fast Download or sv_downloadurl?

Fast Download (also know as sv_downloadurl) is a practice used to get content from the server to the client faster. By default the download limit is capped in Garrysmod at 20kb/s. So to get content to clients faster, we use Fast Download which allows the client to download at standard http speeds.

Requirements

Fast Download has some basic requirements. If you have a dedicated game server, you will most likely have the resources to make a fast download server.

Webspace

Webspace is required for a place to store the files so the client can download them. It is suggested that you have at least 1GB of space on the server, and at least 20GB of Bandwidth for a small server.

To find a webhost use www.google.com or a similar search engine.

Setup and Configuration

Setting up the initial configuration for Fastdownload is easy enough. In your garrysmod/cfg folder, you'll have a file called server.cfg. In that, add the following lines below:

And there you have it. The first part of Fast Download has been set up. It's now on to configuring the Webspace and preparing it to be used.

So how does Fast Download work exactly?

Fast Download works by mirroring your "garrysmod/" folder. However, it can only mirror certain folders for it to function. These are:

Note: the names of both the files and folders are case sensitive

Content that is automatically downloaded

There is some content which source will automatically attempt to send to the client. These are:

Content that must be manually added

Often there is content that a server owner will want clients to have however source does not automatically force these to be downloaded. Using resource.AddFile this can be forced and the files sent. The following content will not automatically be sent:

What exactly is needed for a server to function with sv_downloadurl?

The Cache

Found under garrysmod/cache/ the cache file contains 'all clientside data that the client has to know. This file(s) is autogenerated by your server each time it starts.

It is important that the cache file is on the Fast Download server for without it the client will not see the gamemode correctly and will be given a warning about the server cache being misconfigured.

Maps

Maps will automatically be downloaded from the server if the file is placed on the Web Server. The advantage of this is that instead of downloading the map at 20kb/s, the client will download it at their average internet speed. There are even tricks to help them download faster, however that will be discussed further on.

If you are using sv_downloadurl, you must upload the maps to the server otherwise clients will be unable to play on the server unless they already own the map.

Addons

For some, this can be slightly complex to understand. The Addons folder is "emulated" if you like in game to be the garrysmod folder, which is how the content is used and sent. So to use the models / materials / sounds, you must extract them from the /addons folder, and into the correct folders on the webserver. You can keep the addon normally on the game server, but on the webserver the extraction must occur.

Look below for an example.

Hopefully from the above examples you get the idea.

Gamemodes

You do not actually need to upload any gamemode files whatsoever to Fast Download. However, if you wish to use custom content in your Gamemode, you can under your gamemodes directory add a content folder, and then replicate materials / models under that. For example:

Content works similar to that of the addon format. If you can understand one, you can understand the other.

And you're done!

That is the general usage of Fast Download covered. However, below is some help, along with some tricks you can use to help your server and your players in the long run.

Extra Things

Automation Utilities

SourceRSC can update your fast download server automatically. If custom content is missing from the fast download server it will bzip the files, create the appropriate folder structure, and properly 'virtualize' the addons and gamemodes folders on the fast download server. Supports accessing the game and fastdownload server locally or with FTP. Works on Windows and Linux.

Bzip2 File Compression

Bzip2 is a program which can be used to significantly reduce the size of the files on the Fast Download server. Source natively supports Bzip2, so it's known that this will work. Bzip2 can reduce a file's size by up to 75%. This means a 50mb file can be 15mb or less, allowing players to download it faster. This also means if you have bandwidth limits, you'll save bandwidth with smaller files. Every single file that can be used by Fast Download can be Bzipped. However, the files on the Game Server must be the original files. Only the Web Server needs the bzipped files The normal files do not need to be on the web server if you use Bzip2.

Once the files have been uploaded to the Fast Download server (and put in the appropriate places), that's your work done. Source automates the rest, when the client downloads the file, they'll be automatically unzipped and cached etc.

You can either get Bzip2 and use the command line, or use 7Zip which has support for zipping into Bzip2 format.

Note: As of Gmod update 81, the cache is now one file ranging between 100 - 275kb. This means zipping the cache could be useless and actually increase the size of the file.


I see red error models / purple and black textures!

This means you haven't placed or added the files correctly on the Fast Download Server

People have to download files every time they join!

This means you forgot something on the FastDL folder. It's trying to download it every time they join. It also tells you what you have to move there. If you have the files already, you will not need to re-download them.

There could also be an issue regarding the files name. Case sensitivity matters with sv_downloadurl, so ensure that the filepath and filename are exactly the same on both the webserver and gameserver.

Overall

Fast Download is certainly worth the time and money to set up. Your players get their models and whatnot faster and you get a slight peace of mind knowing that your server is that bit more secure and safer.


SetupArrayProps_R: array prop '(null)' is at index zero.

If you receive this message trying to run your Garry's Mod dedicated server, it means it is conflicting with the Team Fortress 2 version of the source engine. You can fix this by first updating all your other games, and then running update on Garry's Mod by using the following command (notice the -verify_all -retry):

hldsupdatetool -command update -dir <yourdirectory> -game "garrysmod" -verify_all -retry

Thanks to g0dFather at facepunch.com (link: http://www.facepunch.com/showpost.php?p=16926473&postcount=21)

A second way of fixing this error is to delete everything in orangebox/bin and orangebox/garrysmod/bin and then updating Garry's Mod through the hldsupdatetool.

tier0.dll error

The procedure entry point GetThreadedLoadLibraryFunc could not be located in the dynamic link library tier0.dll

Go to the root directory of your dedicated server (C:\srcds if you followed this tutorial exactly) , and rename tier0.dll and vstdlib.dll to something else. Now try starting your server again.


How many slots can I get on my connection?

In my experience, each player slot takes up about 32 kilobits per second. That's upload speed. As long as your download speed isn't the bottleneck, the following seems to hold:

Those are calculated values. They may be not correct on every PC/Server, due many factors would need to be calculated in.

Extra content

If you don't wish to add extra content (Counter-Strike: Source, Day of Defeat: Source), then you can skip this section.

Counter Strike: Source

The following lines will add Counter Strike:Source content to your server

Windows / ReactOS:

hldsupdatetool -command update -game "Counter-Strike Source" -dir .

Linux:

Info 64.png If css does not mount, open up the css folder (root/css) and move the cstrike folder in it to the orangebox folder (root/orangebox).
./steam -command update -game "Counter-Strike Source" -dir .

Wine:

wine hldsupdatetool -command update -game "Counter-Strike Source" -dir .

Day of Defeat: Source

The following lines will add Day of Defeat:Source content to your server

Windows / ReactOS:

hldsupdatetool -command update -game "dods" -dir .

Linux:

./steam -command update -game "dods" -dir .

Wine:

wine hldsupdatetool -command update -game "dods" -dir .

Half Life 2: Deathmatch

The following lines will add Half Life 2: Deathmatch content to your server

Windows / ReactOS:

hldsupdatetool -command update -game "hl2mp" -dir .

Linux:

./steam -command update -game "hl2mp" -dir .

Wine:

wine hldsupdatetool -command update -game "hl2mp" -dir .

Team Fortress 2

The following lines will add Team Fortress 2 content to your server

Windows / ReactOS:

hldsupdatetool -command update -game "tf" -dir .

Linux:

./steam -command update -game "tf" -dir .

Wine:

wine hldsupdatetool -command update -game "tf" -dir .

Episodic content

The following lines will add the episodic content to your server (episode 1 and 2)

Windows / ReactOS:

hldsupdatetool -command update -game "episode1" -dir .

Linux:

./steam -command update -game "episode1" -dir .

Wine:

wine hldsupdatetool -command update -game "episode1" -dir .

Left 4 Dead/Left 4 Dead 2 content

The following lines will add content from Left 4 Dead to your server. To install content for Left 4 Dead 2, replace "left4dead" with "left4dead2".

Windows / ReactOS:

hldsupdatetool -command update -game "left4dead" -dir .

Linux:

./steam -command update -game "left4dead" -dir .

Wine:

wine hldsupdatetool -command update -game "left4dead" -dir .

Portal

Portal is single-player game, and thus, you will need to extract the content from the GCFs manually. All of these go into the orangebox/ subfolder of your srcds folder:

portal content.gcf
portal english.gcf
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox