Team Fortress 2 – Dedicated Server
Ok, in this short tutorial I will show you how to set up a TF2 dedicated server on a windows machine.
- Download the HLDS Update Tool from the Steam site.
- Run the tool to get it installed.
- Create a directory for steam, the game files will be created in this directory.
- Run the hldsupdatetool executable: (I ran a windows installation, but linux will be similar)
Windows command:
HldsUpdateTool.exe -command update -game tf -dir <directory name created in step 3, surround with quotes if spaces are in it>
Linux command:
./steam -command update -game tf -dir <directory name created in step 3, surround with quotes if spaces are in it>
You can use the same command when you need to update your server to the latest version.
- This will take some time, grab a beer, a cup of coffee, or something else that will help you relax.
- Don’t relax too much! You might get some ‘Connection reset by peer’ exceptions. Don’t worry, just rerun the same command again and again and again and again until finally you have received all files.
- Create a server.cfg file in the orangebox/tf/cfg directory.
- Fill it with some basic info. See a small example below.
- Create a shortcut to the srcds.exe executable in the /orangebox directory
- Edit the shortcut and change the startup command to look like something like this
- Start the server by running the shortcut
// The name of your server shown in the server browser hostname "TF2 Server" // Server e-mail contact sv_contact youremail@here.com // Password used for remote console access rcon_password "asillypassword" // If you are having trouble connecting with rcon try enabling the rcon_address line. // Also make sure your ports are forwarded (tcp: 27000-27020) // rcon_address "your_ip_address" // 1 for private LAN, 0 for internet play sv_lan 1 // Region that the server is located in // U.S. East - sv_region 0 // U.S. West - sv_region 1 // South America - sv_region 2 // Europe - sv_region 3 // Asia - sv_region 4 // Australia - sv_region 5 // Middle East - sv_region 6 // Africa - sv_region 7 // Rest of the World - sv_region 255 sv_region 3 // Network settings sv_mincmdrate 30 sv_minupdaterate 20 sv_maxcmdrate 100 sv_maxupdaterate 100 sv_maxrate 100000 sv_minrate 1000 //sv_unlag 1 Unknown Command // Enforces fair and optimal settings sv_client_predict 1 sv_client_interpolate 1 sv_client_min_interp_ratio 1.0 sv_client_max_interp_ratio 2.0 sv_client_cmdrate_difference 30 // External download server // sv_downloadurl "http://yoursite.com/cstrike" // Max download size of 100 MB net_maxfilesize 100 // mp_capstyle (Sets the style of capture points used. 0 = Fixed players required to cap. 1 = More players cap faster, but longer cap times) // mp_respawnwavetime (Time between respawn waves) // mp_capdeteriorate_time 90.0 (Time it takes for a full capture point to deteriorate) // mp_teams_unbalance_limit (Teams are unbalanced when one team has this many more players than the other team. (0 disables check)) // mp_bonusroundtime (Time after round win until round restarts) // mp_winlimit (Max number of rounds one team can win before server changes maps) // mp_stalemate_timelimit (Timelimit (in seconds) of the stalemate round.) // mp_switchteams (Switch teams and restart the game) // mp_scrambleteams (Scramble the teams and restart the game) // mp_forcerespawnplayers (Force all players to respawn.) // mp_disable_respawn_times (Disable respawn timer) // mp_timelimit (Set timelimit for map) // mp_maxrounds (Set number of rounds before reset. Mutually exclusive with mp_timelimit. So if this is enabled disable the mp_timelimit) // mp_tournament (Enable or Disable tournament mode) // tf_weapon_criticals (Enable or disable weapon crits) // tf_flag_caps_per_round (Number of flag caps before round ends) |
"C:\Program Files\Valve\HLServer\orangebox\srcds.exe" -game tf -console +exec server.cfg +maxplayers 24 +map ctf_2fort |
This will make the server run the TF2 game, with console enabled and it will execute the server.cfg file we created. Next to that it will set the player limit to 24 and load the map ctf_2fort at startup.
Please note that you can also create custom map cfg files which will run automatically when a mapchange occurs. Eg: If you have the map cp_dustbowl you could create a custom cp_dustbowl.cfg file and place it in the cfg directory and it will be auto-executed when the level is loaded. This will enable you to use settings that are map specific.
The next part in this tutorial will describe how to install MetaMod:Source and SourceMod on your (TF2) dedicated server.
MetaMod and SourceMod are plugin API’s/frameworks that will allow you to run custom administration/game plugins on your server.
Visit this link to see what mods are available for SourceMod.
- Visit this page and follow the directives there. Be sure to download the a version >= 1.6 of MetaMod:Source.
- Go to the SourceMod site and download the latest release. Then follow the directives found here.
If you got SourceMod running you can install any plugins you like. Have fun!
I have a dynamic ip is it a posibility of connecting without paying for a static because in my isp it costs about 20 euros ebery month 🙁
You need something like DynDNS which will allow you to have a dns name which will follow your ip through an update mechanism.
You can register several names for free. You might be interested in something like:
gianakhs.game-host.org or gianakhs.game-server.cc or something like that.
Have a look at http://www.dyndns.com/services/dns/dyndns/ for more information.
I did all the tutorial forwarded my ports 27000-27020 tcp/udb and i made a hostname and also I installed an update client but with sv_lan=1 i can connect with sv_lan=0 i cannot connect neither from lan nor from internet.
Any suggestions?
I finaly made it! thx to your awesome tutorial and your quick help.Thank you a lot!!
Well, I installed the HLDS Update tool, but I don’t get the rest.
Once I also updated it to “version 35” it went fast, but do I put the commands when I open the HLDSupdatetool again? Or is it else where?
What commands are you referring to? The HLDS Update Tool is only used for installing/updating the files on your machine. The tool will install the necessary game files and the binaries required to run the server. On windows this will be srcds.exe. You will have to add the parameters by starting the executable from the command line or you can make a shortcut and add the parameters there. You could even make a batch file and fill it with the path of the srcds.exe executable and the required parameters. Something like:
start “c:\Program Files\SRCDS\srcds.exe” +exec server.cfg …etc
for example.
Cool, can’t wait to try this
Hi I cant get past step 4. Where do you want me to put the ./steam command???
You have to run it in the directory where the hldsupdatetool.bin extracted the files.
Or you can give in the full path like /home/wytze/steam to run it.
Wytze you said “Have you tried adding/connecting the server with your internet-ip?
According to your image everything is working fine. So it is strange it doesn’t show in the list. I don’t know if icmp requests need to be enabled on the server so it might show up on the list. It is something I will have a look at.”
how do you add your server through ip or whatever, i seem to be having the same problem as inf. cheers and plz respond! :]
You will first need to retrieve your internet ip. (Use something like whatismyip.com)
You can then add the server by using the “Servers” screen in your steam account. After adding it and you configured your server and firewall/port forwarding ok it should show. You should be able to connect.
You could also try to use the connect command in the developer console. You need to enable this in the tf2 settings menu within the game. (settings->advanced->developer console) Once enabled you can press the ~ key to bring up the console. Type connect ‘serverip’ to check if the connection to your server is working ok.
Note: Remember that a server will never display directly in the server list as it might take some time to send the heartbeat signal to the master server. A heartbeat signal is sent once every five minutes to let the master server know that the server is still up and running.
i got a question ,, i want to create a lan game on a small network but i dont got steam …how can other players from the network connect ? pls answer , i need steam to see a god damn lan server?
If you know the ip and port the easiest way is to enable the console, press ~ and type connect <ip>:<port>.
sorry .. the console doesnt work .. how do i fix this ?
I fixed the console, now the lan works , but when somebody try to connect to me my game is shuting down and gives me a windows error , why ?
Hard to say without any error report I guess. Make sure all your software is up-to-date and install some stable drivers is the best advice I can give at this point.
I always heard about problems with the steam account. Some account get even hijacked? Do you still think it is wise to get a steam account, I am usually to lazy to get a game in a store, so I would prefere to download them. Or are there any other options.
Hi all. I’ve a problem: while i was setting the dedicated server I , as suggested by the tutorial, set sv_lan to 0(which means internet game) to let other people to join. But if i write in the console sv_lan it says that it is set to 0 but the server is a lan server.