Difference between revisions of "Windows dedicated server"
(COMPLETELY fix update.bat) |
|||
(48 intermediate revisions by 30 users not shown) | |||
Line 1: | Line 1: | ||
− | 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 ' | + | 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 'TF2server'. |
− | |||
− | |||
==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 be able to 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 [ | + | * Download [https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip steamcmd.zip] |
− | *Unzip steamcmd.zip to a directory, for example | + | * Unzip steamcmd.zip to a directory, for example {{code|C:\TF2server}}. |
==Create a SteamCMD script== | ==Create a SteamCMD script== | ||
− | *Create a file called tf2_ds.txt in the folder where you installed the tool. In this example, that is | + | * Create a file called tf2_ds.txt in the folder where you installed the tool. In this example, that is {{code|C:\TF2server}} |
− | *Edit the file with this text: | + | * Edit the file with this text, remember to replace {{code|C:\TF2server\}} with your own directory: |
@ShutdownOnFailedCommand 1 | @ShutdownOnFailedCommand 1 | ||
@NoPromptForPassword 1 | @NoPromptForPassword 1 | ||
+ | force_install_dir C:\TF2server\ | ||
login anonymous | login anonymous | ||
− | |||
app_update 232250 | app_update 232250 | ||
quit | quit | ||
− | If you want to opt | + | If you want to opt for the prerelease version of the TF2 dedicated server, add this line after the app_update ID, in the same line: |
− | beta prerelease | + | -beta prerelease |
==Create an updating batch file== | ==Create an updating batch file== | ||
− | *Create a file called update.bat in the folder where you installed the tool. | + | * Create a file called {{code|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 | + | @echo off |
− | + | .\steamcmd.exe +runscript tf2_ds.txt | |
==Start the download/update== | ==Start the download/update== | ||
− | *Run the update.bat to start the download. This may take several hours as dedicated server content is | + | * Run the {{code|update.bat}} to start the download. This may take several hours as dedicated server content is very large. |
− | *You may need to run the file | + | * You may need to run the file ''multiple'' times until the message "Success! App '232250' fully installed." or "Success! App '232250' already up to date." displays. |
− | ==Create/ | + | ==Create/update server files== |
− | *Create a file | + | * Create a file {{code|server.cfg}} in {{code|C:\TF2server\steamapps\common\tf2\tf\cfg}} (make sure it's not a text file!) |
− | *Edit the file with these details: | + | {{Note|Note: In case the {{code|tf2}} folder is created somewhere else and the {{code|common}} folder is missing, simply create the {{code|common}} folder yourself and move the {{code|tf2}} folder into it.}} <!-- This may be unnecessary, if the "tf2" folder is created somewhere else it likely means the user changed the directory themselves and put in the wrong one. --> |
− | + | * Edit the file with these details: | |
− | + | // The server name that players will see in the server browser and in the scoreboard | |
− | + | hostname "Your server's name" | |
− | + | ||
− | + | // Leave empty if you do not want a password | |
− | + | sv_password "" | |
− | + | // Password to enable rcon access from the console | |
− | + | rcon_password "Your_Rcon_Password" | |
+ | |||
+ | // Time per map in the rotation, in minutes. 0 to never rotate the map on a timer. | ||
+ | mp_timelimit 30 | ||
+ | // Maximum number of rounds to play per map before forcing a mapchange | ||
+ | mp_maxrounds 10 | ||
+ | |||
+ | // Allow clients to upload customization files (e.g. sprays) | ||
+ | sv_allowupload 1 | ||
+ | // Allow clients to download files (e.g. sprays, custom maps, custom content, etc.) | ||
+ | sv_allowdownload 1 | ||
+ | // Maximum allowed file size for uploading in MB (Optional) | ||
+ | net_maxfilesize 15 | ||
<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> | ||
− | * Create the files '''motd.txt''' and '''mapcycle.txt''' in | + | * Create the files '''motd.txt''' and '''mapcycle.txt''' in {{code|C:\TF2server\steamapps\common\tf2\tf\cfg}} |
:<small>You may want to use the motd_default.txt and mapcycle_default.txt as references</small> | :<small>You may want to use the motd_default.txt and mapcycle_default.txt as references</small> | ||
− | * Create a file called '''pure_server_whitelist.txt''' in | + | * Create a file called '''pure_server_whitelist.txt''' in {{code|C:\TF2server\steamapps\common\tf2\tf\cfg}} |
:<small>'''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</small> | :<small>'''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</small> | ||
− | ==Create a | + | ==Create a file to run the server== |
− | *Create a file | + | * Create a shortcut that references to the file {{code|C:\TF2server\steamapps\common\tf2\srcds.exe}}. Name the shortcut an appropriate name, |
− | * | + | * Right click on the shorcut, select properties, |
− | tf2\srcds.exe -console -game tf +sv_pure 1 +map ctf_2fort +maxplayers 24 | + | * Set '''Target''' to: |
− | *Run the | + | "C:\TF2server\steamapps\common\tf2\srcds.exe" -console -game tf +sv_pure 1 +map ctf_2fort +maxplayers 24 |
+ | * Set '''Start in''' to: | ||
+ | C:\TF2Server\steamapps\common\tf2 | ||
+ | * Allow it to use networking when the pop-up appears. | ||
+ | * Run the shortcut you have created 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. | ||
+ | |||
+ | ==Connecting to the Server== | ||
− | + | * Once you have run the server, scroll up in the console until you find a line of the form: <code>Network: IP <your ip address>, mode MP, dedicated Yes, ports <your port> SV / 27005 CL</code>. | |
+ | * Launch Team Fortress 2, and open up the developer console and enter <code>connect <your ip address>:<your port></code>. | ||
+ | * You should now be successfully connected to your server. | ||
=== Other command line options === | === Other command line options === | ||
Line 63: | Line 82: | ||
* <code>-ip 1.2.3.4</code> - Bind to a specific IP address. By default, the server 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, the server will shut down instead of moving to the next available port. | * <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 when starts the server. |
− | * <code>+servercfgfile</code> - Which tf\cfg\ file to execute on map change, defaults to server.cfg | + | * <code>+servercfgfile</code> - Which {{code|tf\cfg\}} file to execute on map change, defaults to <code>server.cfg</code>. |
− | * <code>+mapcyclefile</code> - Which tf\cfg\ file contains this server's mapcycle, defaults to mapcycle.txt. Will also look in tf\ | + | * <code>+mapcyclefile</code> - Which {{code|tf\cfg\}} file contains this server's mapcycle, defaults to <code>mapcycle.txt</code>. Will also look in {{code|tf\}} |
− | * <code>-replay</code> - Executes replay.cfg and adds an | + | * <code>-replay</code> - Executes <code>replay.cfg</code> and adds an additional slot for the replay bot, but removes it from the player count. |
− | |||
− | |||
− | |||
− | |||
+ | <!--== External links == | ||
+ | * [http://www.srcds.com/db/engine.php?subaction=showfull&id=1097362093 srcds.com] | ||
+ | --> | ||
== See also == | == See also == | ||
* [[Linux dedicated server]] | * [[Linux dedicated server]] |
Latest revision as of 06:48, 16 August 2024
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 'TF2server'.
Contents
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:\TF2server
.
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:\TF2server
- Edit the file with this text, remember to replace
C:\TF2server\
with your own directory:
@ShutdownOnFailedCommand 1 @NoPromptForPassword 1 force_install_dir C:\TF2server\ login anonymous app_update 232250 quit
If you want to opt for the prerelease version of the TF2 dedicated server, add this line after the app_update ID, in the same 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:
@echo off .\steamcmd.exe +runscript tf2_ds.txt
Start the download/update
- Run the
update.bat
to start the download. This may take several hours as dedicated server content is very large. - You may need to run the file multiple times until the message "Success! App '232250' fully installed." or "Success! App '232250' already up to date." displays.
Create/update server files
- Create a file
server.cfg
inC:\TF2server\steamapps\common\tf2\tf\cfg
(make sure it's not a text file!)
Note: In case the
tf2
folder is created somewhere else and the common
folder is missing, simply create the common
folder yourself and move the tf2
folder into it.
- Edit the file with these details:
// The server name that players will see in the server browser and in the scoreboard hostname "Your server's name" // Leave empty if you do not want a password sv_password "" // Password to enable rcon access from the console rcon_password "Your_Rcon_Password" // Time per map in the rotation, in minutes. 0 to never rotate the map on a timer. mp_timelimit 30 // Maximum number of rounds to play per map before forcing a mapchange mp_maxrounds 10 // Allow clients to upload customization files (e.g. sprays) sv_allowupload 1 // Allow clients to download files (e.g. sprays, custom maps, custom content, etc.) sv_allowdownload 1 // Maximum allowed file size for uploading in MB (Optional) net_maxfilesize 15
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:\TF2server\steamapps\common\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:\TF2server\steamapps\common\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 file to run the server
- Create a shortcut that references to the file
C:\TF2server\steamapps\common\tf2\srcds.exe
. Name the shortcut an appropriate name, - Right click on the shorcut, select properties,
- Set Target to:
"C:\TF2server\steamapps\common\tf2\srcds.exe" -console -game tf +sv_pure 1 +map ctf_2fort +maxplayers 24
- Set Start in to:
C:\TF2Server\steamapps\common\tf2
- Allow it to use networking when the pop-up appears.
- Run the shortcut you have created 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.
Connecting to the Server
- Once you have run the server, scroll up in the console until you find a line of the form:
Network: IP <your ip address>, mode MP, dedicated Yes, ports <your port> SV / 27005 CL
. - Launch Team Fortress 2, and open up the developer console and enter
connect <your ip address>:<your port>
. - You should now be successfully connected to your server.
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 when starts the server.+servercfgfile
- Whichtf\cfg\
file to execute on map change, defaults toserver.cfg
.+mapcyclefile
- Whichtf\cfg\
file contains this server's mapcycle, defaults tomapcycle.txt
. Will also look intf\
-replay
- Executesreplay.cfg
and adds an additional slot for the replay bot, but removes it from the player count.