Source Dedicated Server: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added notes on changing ports)
 
(19 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{LanguageBar}}
<!-- Add the categories to the main page, not here. Some template, such as {{This is a}}, and all Table templates should be placed to the main page. -->
{{toc-right}}
{{toc-right}}


The '''Source Dedicated Server''' or '''SRCDS''' is a tool that runs the server component of a [[Source]] game without the client component. In other words, it simulates the game without drawing it. SRCDS is chiefly used by server providers who want to serve up as many games from the same computer as they can.
The [[Source Dedicated Server]] (or '''SRCDS''') is a tool that runs the server component of a {{Source|4}} game without the client component.
 
In other words, it simulates the game without drawing it. SRCDS is chiefly used by server providers who want to serve up as many games from the same computer as they can.


This page, however, is aimed at mod developers who want to run SRCDS on their home computer. Doing this is a must if you are creating a multiplayer mod as the behaviour of dedicated servers differs from that of listenservers (those started from the main menu) in some areas. Crashes that only happen on a dedicated server are entirely possible!
This page, however, is aimed at mod developers who want to run SRCDS on their home computer. Doing this is a must if you are creating a multiplayer mod as the behaviour of dedicated servers differs from that of listenservers (those started from the main menu) in some areas. Crashes that only happen on a dedicated server are entirely possible!
== Hardware requirements ==
CPU - Depends on how many clients connected to the servers. To run a Source dedicated server you need at least a 1.0GHz Intel CPU or equivalent, many newer and mid-range CPU usually perform better. This will run a basic server with 20 slots at a good level of performance.
Memory: To run a normal server you will need at least 512MB RAM, you might need to restart the server every once in a while to clean up the memory. 1GB is enough to run over 60 player slots total. Please note that newer versions of Windows, such as Windows 10/11 (or some Linux distros) for example, it's highly recommended you to have at least 4GB RAM or more.
Bandwidth: Bandwidth is used a lot—more specifically, upload bandwidth. Here is a list of how fast your connection must be to run a certain number of players at lowest settings. (When talking about bandwidth for servers we always talk about upload, not download.) Note: these numbers are theoretical, your results may vary slightly!


== Connectivity ==
== Connectivity ==
Line 17: Line 30:
SRCDS has also been spotted opening connections on 27005 and 51840 UDP, but these may be outbound only.
SRCDS has also been spotted opening connections on 27005 and 51840 UDP, but these may be outbound only.


{{tip|1=Pinging your own server will fail with some routers and/or ISPs. The most reliable way to test whether your connection is open is either to get a friend to try connecting, or to install the [http://www.microsoft.com/downloads/details.aspx?FamilyID=983b941d-06cb-4658-b7f6-3088333d062f Microsoft Network Monitor] (apply the filter <code>Udp.Port == 27015</code>) and watch for requests coming in from random people around the world. Note that the heartbeats you will see being sent to the two master servers do not mean that the connection is open.}}
{{tip|1=Pinging your own server will fail with some routers and/or ISPs. The most reliable way to test whether your connection is open is either to get a friend to try connecting, or to install the [https://www.microsoft.com/en-gb/download/details.aspx?id=4865 Microsoft Network Monitor] (apply the filter <code>Udp.Port == 27015</code>) and watch for requests coming in from random people around the world. Note that the heartbeats you will see being sent to the two master servers do not mean that the connection is open.}}


{{note|A residential internet connection may not have the upload capacity to support large games.}}
{{note|A residential internet connection may not have the upload capacity to support large games.}}
Line 24: Line 37:


{{note|Servers won't respond to [[Server_queries|queries]] until a map is loaded.}}
{{note|Servers won't respond to [[Server_queries|queries]] until a map is loaded.}}
{{note|A residential internet connection may not have the upload capacity to support large games.}}
{{note|If you receive the error "Could not establish connection to Steam servers." with a result number of 18 or 106, [https://steamcommunity.com/dev/managegameservers you need to go here] and either regenerate your token, or create a new one and replace it in your sv_setsteamaccount startup parameter}}


== Installation ==
== Installation ==
Line 29: Line 46:


=== For modders ===
=== For modders ===
{{note|The Source 2006 dedicated server has been removed from Steam, leaving only the Source 2009 version (its GCF says 2007, but don't be fooled). Mods, whether for 2006 or 2007, can now only be run from SRCDS installs. Errors about "SetupArrayProps_R" will appear if you mix versions.}}
{{note|The HLDS Update Tool does not provide [[Lost Coast]], even though [[SDK Base]] does. Multiplayer mods should either not use anything from Lost Coast, or include what they do use in their dedicated server download.}}
{{note|The HLDS Update Tool does not provide [[Lost Coast]], even though [[SDK Base]] does. Multiplayer mods should either not use anything from Lost Coast, or include what they do use in their dedicated server download.}}


Line 55: Line 71:
  ./srcds_run -game hl2mp +map dm_lockdown +maxplayers 8 -autoupdate
  ./srcds_run -game hl2mp +map dm_lockdown +maxplayers 8 -autoupdate


== See Also ==
== See also ==
* [[SteamCMD]]
* [[SteamCMD]]
* [[HLDSUpdateTool]]
* [[HLDSUpdateTool]]
Line 63: Line 79:
* [[Command Line Options#Source Games]]
* [[Command Line Options#Source Games]]


== External Links ==
== External links ==
* [https://support.steampowered.com/kb_article.php?ref=6758-TCMF-2234 Setting up a Standalone Dedicated Server]
* [https://support.steampowered.com/kb_article.php?ref=6758-TCMF-2234 Setting up a Standalone Dedicated Server]
* [https://support.steampowered.com/kb_article.php?ref=7017-UJBN-6785 Setting up a Steam Source Dedicated Server]
* [https://support.steampowered.com/kb_article.php?ref=7017-UJBN-6785 Setting up a Steam Source Dedicated Server]

Latest revision as of 14:52, 2 October 2024

English (en)Español (es)Русский (ru)Türkçe (tr)中文 (zh)Translate (Translate)


The Source Dedicated Server (or SRCDS) is a tool that runs the server component of a Source Source game without the client component.

In other words, it simulates the game without drawing it. SRCDS is chiefly used by server providers who want to serve up as many games from the same computer as they can.

This page, however, is aimed at mod developers who want to run SRCDS on their home computer. Doing this is a must if you are creating a multiplayer mod as the behaviour of dedicated servers differs from that of listenservers (those started from the main menu) in some areas. Crashes that only happen on a dedicated server are entirely possible!

Hardware requirements

CPU - Depends on how many clients connected to the servers. To run a Source dedicated server you need at least a 1.0GHz Intel CPU or equivalent, many newer and mid-range CPU usually perform better. This will run a basic server with 20 slots at a good level of performance.

Memory: To run a normal server you will need at least 512MB RAM, you might need to restart the server every once in a while to clean up the memory. 1GB is enough to run over 60 player slots total. Please note that newer versions of Windows, such as Windows 10/11 (or some Linux distros) for example, it's highly recommended you to have at least 4GB RAM or more.

Bandwidth: Bandwidth is used a lot—more specifically, upload bandwidth. Here is a list of how fast your connection must be to run a certain number of players at lowest settings. (When talking about bandwidth for servers we always talk about upload, not download.) Note: these numbers are theoretical, your results may vary slightly!

Connectivity

No matter which type of server you are using, your computer must be able to receive unsolicited incoming connections. This is exactly what routers and software firewalls exist to prevent, so if you are using either you will have to reconfigure. Refer to the manufacturer instructions for how to do this.

The ports SRCDS officially requires are:

  • 27015 TCP/UDP (game transmission, pings and RCON) - Can be changed using -port on startup
  • 27020 UDP (SourceTV transmission) - Can be changed using +tv_port on startup
  • 27005 UDP (Client Port) - Can be changed using -clientport on startup
  • 26900 UDP (Steam Port, outgoing) - Can be changed using -sport on startup

SRCDS has also been spotted opening connections on 27005 and 51840 UDP, but these may be outbound only.

Tip.pngTip:Pinging your own server will fail with some routers and/or ISPs. The most reliable way to test whether your connection is open is either to get a friend to try connecting, or to install the Microsoft Network Monitor (apply the filter Udp.Port == 27015) and watch for requests coming in from random people around the world. Note that the heartbeats you will see being sent to the two master servers do not mean that the connection is open.
Note.pngNote:A residential internet connection may not have the upload capacity to support large games.
Note.pngNote:Using service providers which use CGNAT (such as mobile providers or an increasing amount of residential providers) may make it impossible to host any kind of server.
Note.pngNote:Servers won't respond to queries until a map is loaded.
Note.pngNote:A residential internet connection may not have the upload capacity to support large games.
Note.pngNote:If you receive the error "Could not establish connection to Steam servers." with a result number of 18 or 106, you need to go here and either regenerate your token, or create a new one and replace it in your sv_setsteamaccount startup parameter

Installation

See SteamCMD for installation instructions.

For modders

Note.pngNote:The HLDS Update Tool does not provide Lost Coast, even though SDK Base does. Multiplayer mods should either not use anything from Lost Coast, or include what they do use in their dedicated server download.
Note.pngNote:The appid for Source 2006 server is 205. The appid for Source 2007 server is 310. The appid for Source 2013 server is 244310.
  1. Install SteamCMD
  2. Run the update tool with +login anonymous +app_update [appid]. The appid you should use is listed in a note above. Optionally, add +force_install_dir <path> to download to a custom location; it must appear before the +app_update command.
  3. To start the server, run orangebox\srcds.exe -console -game <vproject>.
Tip.pngTip:If you already have the game client installed, you can cancel the tool with Ctrl+C once it starts downloading materials in step 1. You can skip the bulk of the downloading by extracting the GCFs already on your system with GCFScape instead.
  • You will need to extract sounds, materials and models; do the "source X" GCFs before the "source 2007 X" ones.
  • You should end up with <server_path>\hl2 from your GCFs and <server_path>\orangebox from the update tool.
  • You may want to run the update tool again after extracting to make sure that everything is correct.

Configuring and running the server

Navigate to the folder you just installed your server in. There should be a bunch of files and folders, including a directory with the name of the game you have just installed, e.g. hl2mp for HL2: Deathmatch. The configuration files are located in the <game>/cfg/ e.g. hl2mp/cfg/ directory.

Edit the main configuration file: <game>/cfg/server.cfg. Change the hostname line (this is the name people will see in the server browser) and other options to your liking.

Open a terminal where you have installed the server and start the server:

./srcds_run (or ./srcds.exe on Windows) -game <game> +map <map> +maxplayers X -autoupdate

On Windows:

./srcds.exe -game <game> +map <map> +maxplayers X -autoupdate

For example:

./srcds_run -game hl2mp +map dm_lockdown +maxplayers 8 -autoupdate

See also

External links