User:Nosoop/Guide/Game Server Configuration

From AlliedModders Wiki
< User:Nosoop/Guide
Revision as of 22:45, 21 September 2023 by Nosoop (talk | contribs) (General: Add section on profiling)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Source Engine games often differ in configuration; here are some basic suggestions on how to set them up for either testing or production use.


The following section(s) apply to most, if not all games.

Fast Downloads

The Source Engine normally provides downloads over the same channel as gameplay, which is rather slow.

"Fast" downloads are downloads served out-of-band over HTTP, and as such you will need to have a web (HTTP) server up and running to take advantage of this functionality. This is highly recommended if you are running a server with any amount of custom content that a player needs to download (models, sounds, maps).

If you're using a game server provider, you may already have access to a web server for fast download purposes; check with your provider to confirm.

Examples of web servers include: nginx, Caddy, Apache, HFS, and many others (and many more not included in that list).

Once you have an HTTP server running, configure sv_downloadurl as follows:

sv_downloadurl "http://{your_server_location}/{path}";

The URL must be quoted, as // is treated as the start of a comment and if left unquoted, the rest of the line will be ignored. Do not include a trailing slash — the game client adds one when making the request; web servers are not guaranteed to collapse double slashes in the path.

{path} should be the path on your server that would translate to the root of your game server.

For example, if you have a file sound/my_server/fart.mp3 and an sv_downloadurl value of, the client will request (and its BZip2-compressed equivalent).

You will need to also copy the files from the game server to the web server.

SourceMod extension not loading

By default, if no plugin depends on an extension, it won't be loaded automatically, nor will it show up in sm exts list.

Use sm exts load ${extension} if you'd like to test if it loads and to see if it fails, or add an ${extension}.autoload file (empty or not) in the extensions directory if you always want it to load.


The Source RCON Protocol allows users to remotely issue console commands to dedicated server instances.

You likely won't need this, because you can issue console commands through

  • running the server instance in a terminal multiplexer session (with screen or tmux)
  • your game server provider providing a web interface that provides real-time console input and output

If you have full access to the machine that your server runs on, you can block RCON packets by dropping TCP packets going to the game port entirely.

Note that doing so will also prevent use of third-party extensions that process TCP connections on the game port, such as Conplex.

You can use the following on Linux, if you are using iptables:

# the following commands append rules to the firewall; the order here is important
# change 27015 to the game port

# accept RCON traffic that comes from the same machine, for things like SourceBans
# if you know you aren't using anything else that relies on RCON you may omit this
# if legitimate RCON traffic may come from elsewhere, change the source network (-s,
# or append additional rules for addresses that should be allowed
iptables -A INPUT -p tcp --dport 27015 -s -j ACCEPT

# drop everything else going to the game port
iptables -A INPUT -p tcp --dport 27015 -j DROP


In some cases you will run into server hitches. If you have a general idea of when it happens, you can start the Source Engine's profiler:

sm prof start vprof

Continue playing, then once you think you've gathered enough data, you can stop profiling and have it dumped out to a file:

sm prof stop
con_logfile "vproflog.txt"
sm prof dump vprof
con_logfile ""

The profiler results will be in vproflog.txt in your game directory.


Linux extension failing to load on outdated GLIBCXX_* version

Various Source Engine games (Counter Strike: Source, Day of Defeat: Source, Counter Strike: Global Offensive, third-party games using the Source SDK modding system, possibly others) bundle standard libraries that are older than what current operating systems ship with, but newer than those that Valve ships as a baseline.

Software that depends on new versions of libraries will fail to load. This includes Metamod:Source, SourceMod, and other native code / plugins / extension.

You can choose to do one of the following:

  • Remove any existing copies of bin/ and bin/ relative to your game install directory (not the root of the filesytem); this will let the game load the system libraries.
    • If you are on a 64-bit system, continue to the next section to ensure the system's 32-bit libraries are actually available after removing the Valve-bundled copies.
  • If your operating system is also dated, you will need rebuild the extension using an older build environment, or upgrade to a newer one. If you plan on recompiling the extension, the Steam Runtime SDK is considered the baseline of support.

64-bit Linux systems and 32-bit executables

Unlike Windows, 64-bit Linux systems are not guaranteed to ship with full compatibility for 32-bit executables by default.

Depending on your distribution, you will need to run one of the following commands as root to install the required packages / libraries:

  • Debian / Ubuntu: apt install gcc-multilib lib32z1
  • Arch: pacman -S lib32-gcc-libs lib32-zlib
  • Fedora: yum -y install glibc.i686 zlib.i686

Game Specific

Team Fortress 2

The Dedicated server configuration section on the Team Fortress 2 Official Wiki provides general configuration instructions. Depending on the platform you're working on, you may also be interested in the sections for Linux and Windows.

Mann vs. Machine

Set tf_mvm_min_players_to_start to 1 to only require one player to ready up and start the mission.

Steam Datagram Relay

The Steam Datagram Relay routes both server and client connections through the Steam network, hiding the IP address of each from the other.

Pass -enablefakeip in the server's launch options to enable. The server will then report "FakeIP allocation succeeded" at the end of startup; use that IP address / port combination in your game client to connect to the server. This allocation will change on every server startup.

Using Workshop maps

Note:This section has instructions specific to Team Fortress 2, and will likely not carry over to other games such as Counter-Strike: Global Offensive.

As described in the patch notes shortly after the feature was added, Valve's intent is for server operators to use map names in the form workshop/${mapid}, where ${mapid} is the ID of the map in the Workshop. For example, Sulfur has an ID of 619869471, so you would specify it as workshop/619869471.

This allows both the game server and any connected clients to retrieve the latest version of the map through Steam.

You can use that form in any place that accepts maps, such as the map, changelevel, and nextlevel commands (including +map as a launch option), as well as the mapcycle file. SourceMod itself has support to translate the names to their display forms and will do so in first-party plugins; third-party plugins and integrations (game server providers / panels and other software) may or may not support this functionality.

Disregard any suggestions to subscribe to the map and copy the file to your game / fast download servers. That is often repeated, yet bad advice, as:

  • Players will download the map from your download server instead of through Steam
  • You will need to manually update the map whenever the Workshop version is updated
  • Players may receive map mismatch errors and fail to connect if the non-Workshop release differs from the Workshop version

Keep things simple and use the Valve-documented method. If you insist on using a non-Workshop version, get it from the correct sources.

Games that aren't

Non-exhaustive list of Source Engine class-based shooters with a cartoon-like visual style based on the art of Dean Cornwell, J. C. Leyendecker, and Norman Rockwell, that aren't Team Fortress 2:

  • Team Fortress 2 Classic
  • Open Fortress

If you're developing plugins and asking questions about one of those games, please specifically name them. These games are not guaranteed to behave the same as "retail" Team Fortress 2, and solutions that work for retail aren't guaranteed to work on third-party mods.

Counter-Strike: Global Offensive

The Advanced Configuration section on the Valve Developer Wiki describes server configuration unique to CS:GO. It's different from most other mods.

Responsive server console when hibernating

Set sv_hibernate_ms to 0 to make the server console more responsive when no players are online.

Left 4 Dead 2

Disabling lobby system

While developing plugins, you generally don't want players being connected through Steam's lobby system. Add the following to server.cfg:

sv_allow_lobby_connect_only "0";
sv_password "password_to_connect_with";

Virtual Server Configuration

As a developer, you may need to test on multiple platforms. To avoid having another physical machine to work on, you can use virtualization to run an operating system on your desktop.



Network Address Translation

With NAT plus port forwarding, the minimum would be to forward UDP from one of the host's loopback IP addresses to the server port on the VM's address. Forwarding TCP isn't necessary unless you are interested in using the RCON protocol.

For example, given a virtual machine with an IP address of and the server listening on port 27015, you should configure NAT as follows:

  • (host) → (guest)

You can then connect to the server from the host OS by connecting to

Any loopback IP address on the host portion is acceptable to use (that is, any address starting with 127.*.*.*).

Host-Only Adapter

Enable the Host-Only Adapter on your VM and statically assign the address to be in the same network as your host operating system's adapter. This allows you to connect to the server without any additional networking complexities.