Difference between revisions of "Windows dedicated server"

From Team Fortress Wiki
Jump to: navigation, search
m (Undo edit by Vojmar (Talk) (1802279) Stop adding this, it has been removed multiple times, including by an administrator.)
(Stylistic changes and added some info)
Line 5: Line 5:
 
==Download and install the SteamCMD Tool==
 
==Download and install the SteamCMD Tool==
 
'''It is recommended you create a separate user to install and run game servers.'''
 
'''It is recommended you create a separate user to install and run game servers.'''
'''It is also recommended you use the non-beta version of the steam client, otherwise it won't locate steam libraries'''
+
'''It is also recommended you use the non-beta version of the Steam client, otherwise it won't be able to locate Steam libraries.'''
  
 
*Download [http://media.steampowered.com/installer/steamcmd.zip steamcmd.zip]
 
*Download [http://media.steampowered.com/installer/steamcmd.zip steamcmd.zip]
*Unzip steamcmd.zip to a directory, for example 'c:\hlserver'.
+
*Unzip steamcmd.zip to a directory, for example 'C:\hlserver'.
  
==Create a steamcmd script==
+
==Create a SteamCMD script==
*Create a file called tf2_ds.txt in the folder where you install the tool, i.e. 'c:\hlserver'
+
*Create a file called tf2_ds.txt in the folder where you installed the tool. In this example, that is 'C:\hlserver'
 
*Edit the file with this text:
 
*Edit the file with this text:
 
  @ShutdownOnFailedCommand 1
 
  @ShutdownOnFailedCommand 1
Line 24: Line 24:
  
 
==Create an updating batch file==
 
==Create an updating batch file==
*Create a file called update.bat in the folder where you installed the tool, i.e. 'c:\hlserver'
+
*Create a file called update.bat in the folder where you installed the tool.
 
*Edit the file with this text:  
 
*Edit the file with this text:  
 
  steamcmd +runscript tf2_ds.txt
 
  steamcmd +runscript tf2_ds.txt
Line 30: Line 30:
  
 
==Start the download/update==
 
==Start the download/update==
*Run the update.bat to start the download, may take several hours as dedicated server content is currently 5.0GB
+
*Run the update.bat to start the download. This may take several hours as dedicated server content is currently 5.1 GB.
 
*You may need to run the file *multiple* times until the message "Success! App '232250' fully installed." displays.
 
*You may need to run the file *multiple* times until the message "Success! App '232250' fully installed." displays.
  
Line 36: Line 36:
 
*Create a file called '''server.cfg''' in <nowiki>'</nowiki>''C:\hlserver\tf2\tf\cfg''<nowiki>'</nowiki>
 
*Create a file called '''server.cfg''' in <nowiki>'</nowiki>''C:\hlserver\tf2\tf\cfg''<nowiki>'</nowiki>
 
*Edit the file with these details:
 
*Edit the file with these details:
  hostname "Your_Servers_Name" //The Name of your Server that players will see
+
  hostname "Your server's name" //The server name that players will see in the server browser and in the scoreboard
 
  sv_password "" //Leave empty if you do not want a password
 
  sv_password "" //Leave empty if you do not want a password
 
  rcon_password "Your_Rcon_Password" //Password to enable rcon access from the console
 
  rcon_password "Your_Rcon_Password" //Password to enable rcon access from the console
  mp_timelimit 30 //Round Timelimit
+
  mp_timelimit 30 //Time per map in the rotation, in minutes. 0 to never rotate the map on a timer.
  mp_maxrounds 10 //Maximum Rounds Playable before map change
+
  mp_maxrounds 10 //Maximum number of rounds to play per map before forcing a mapchange
  sv_allowupload 1 // Allow clients to upload customization files (Optional Line, Used for Sprays)
+
  sv_allowupload 1 // Allow clients to upload customization files (e.g. sprays)
  sv_allowdownload 1 // Allow clients to download files (Optional Line, Used for Sprays)
+
  sv_allowdownload 1 // Allow clients to download files (e.g. sprays, custom maps, custom content, etc.)
 
  net_maxfilesize 15 // Maximum allowed file size for uploading in MB (Optional)
 
  net_maxfilesize 15 // Maximum allowed file size for uploading in MB (Optional)
 
<sup>An example with more cvars (console variables) can be found in [[Dedicated_server_configuration#Example_Server.cfg_for_TF2_dedicated_server|Example Server.cfg for TF2 dedicated server]].</sup>
 
<sup>An example with more cvars (console variables) can be found in [[Dedicated_server_configuration#Example_Server.cfg_for_TF2_dedicated_server|Example Server.cfg for TF2 dedicated server]].</sup>
Line 55: Line 55:
 
  tf2\srcds.exe -console -game tf +sv_pure 1 +map ctf_2fort +maxplayers 24
 
  tf2\srcds.exe -console -game tf +sv_pure 1 +map ctf_2fort +maxplayers 24
 
*Run the file tf.bat to start your server
 
*Run the file tf.bat to start your server
 +
 +
This will start a [[vdc:Pure Servers|pure server]] with 24 slots running on [[2Fort]] by default. If you don't wish to apply pure server rules, you can remove <code>+sv_pure 1</code>. You can also change the value of <code>maxplayers</code> up to 32.
  
 
=== Other command line options ===
 
=== Other command line options ===
Line 60: Line 62:
 
Some other common command-line options for TF2 are:
 
Some other common command-line options for TF2 are:
  
* <code>+ip 1.2.3.4</code> - Bind to a specific IP. By default, listens on all network interfaces
+
* <code>-ip 1.2.3.4</code> - Bind to a specific IP address. By default, the server listens on all network interfaces.
 
* <code>-port 27015</code> - Bind to a different port (27015 is the default)
 
* <code>-port 27015</code> - Bind to a different port (27015 is the default)
* <code>-strictportbind</code> - If a server is already running on the specified port, stop the server from running
+
* <code>-strictportbind</code> - If a server is already running on the specified port, the server will shut down instead of moving to the next available port.
 
* <code>+randommap</code> - Use instead of +map to select a map at random
 
* <code>+randommap</code> - Use instead of +map to select a map at random
 
* <code>+servercfgfile</code> - Which tf\cfg\ file to execute on map change, defaults to server.cfg
 
* <code>+servercfgfile</code> - Which tf\cfg\ file to execute on map change, defaults to server.cfg

Revision as of 17:06, 10 November 2014

This is a setup guide that allows you to install a basic Team Fortress 2 Windows dedicated server. In the below example the server is installed onto the C drive in a folder called 'hlserver'.


Download and install the SteamCMD Tool

It is recommended you create a separate user to install and run game servers. It is also recommended you use the non-beta version of the Steam client, otherwise it won't be able to locate Steam libraries.

  • Download steamcmd.zip
  • Unzip steamcmd.zip to a directory, for example 'C:\hlserver'.

Create a SteamCMD script

  • Create a file called tf2_ds.txt in the folder where you installed the tool. In this example, that is 'C:\hlserver'
  • Edit the file with this text:
@ShutdownOnFailedCommand 1
@NoPromptForPassword 1
login anonymous
force_install_dir c:\hlserver\tf2
app_update 232250
quit

If you want to opt in to the prerelease version of the TF2 dedicated server, add this line before the app_update line:

beta prerelease

Create an updating batch file

  • Create a file called update.bat in the folder where you installed the tool.
  • Edit the file with this text:
steamcmd +runscript tf2_ds.txt
pause

Start the download/update

  • Run the update.bat to start the download. This may take several hours as dedicated server content is currently 5.1 GB.
  • You may need to run the file *multiple* times until the message "Success! App '232250' fully installed." displays.

Create/Update server files

  • Create a file called server.cfg in 'C:\hlserver\tf2\tf\cfg'
  • Edit the file with these details:
hostname "Your server's name"		//The server name that players will see in the server browser and in the scoreboard
sv_password ""				//Leave empty if you do not want a password
rcon_password "Your_Rcon_Password"	//Password to enable rcon access from the console
mp_timelimit 30 			//Time per map in the rotation, in minutes. 0 to never rotate the map on a timer.
mp_maxrounds 10				//Maximum number of rounds to play per map before forcing a mapchange
sv_allowupload 1			// Allow clients to upload customization files (e.g. sprays)
sv_allowdownload 1			// Allow clients to download files (e.g. sprays, custom maps, custom content, etc.)
net_maxfilesize 15			// Maximum allowed file size for uploading in MB (Optional)

An example with more cvars (console variables) can be found in Example Server.cfg for TF2 dedicated server.

  • Create the files motd.txt and mapcycle.txt in 'C:\hlserver\tf2\tf\cfg'
You may want to use the motd_default.txt and mapcycle_default.txt as references
  • Create a file called pure_server_whitelist.txt in 'C:\hlserver\tf2\tf\cfg'
It is advised that you copy and paste the contents of the pure_server_whitelist_example.txt file into your file first, and then apply any modifications you may want

Create a batch file to run the server

  • Create a file in 'C:\hlserver\' called tf.bat
  • Edit the file with this text:
tf2\srcds.exe -console -game tf +sv_pure 1 +map ctf_2fort +maxplayers 24
  • Run the file tf.bat to start your server

This will start a pure server with 24 slots running on 2Fort by default. If you don't wish to apply pure server rules, you can remove +sv_pure 1. You can also change the value of maxplayers up to 32.

Other command line options

Some other common command-line options for TF2 are:

  • -ip 1.2.3.4 - Bind to a specific IP address. By default, the server listens on all network interfaces.
  • -port 27015 - Bind to a different port (27015 is the default)
  • -strictportbind - If a server is already running on the specified port, the server will shut down instead of moving to the next available port.
  • +randommap - Use instead of +map to select a map at random
  • +servercfgfile - Which tf\cfg\ file to execute on map change, defaults to server.cfg
  • +mapcyclefile - Which tf\cfg\ file contains this server's mapcycle, defaults to mapcycle.txt. Will also look in tf\
  • -replay - Executes replay.cfg and adds an additonal slot for the replay bot, but removes it from the player count.


External links

See also