Posts Tagged ‘hldsupdatetool’

Team Fortress 2 – Dedicated Server

October 18th, 2007 68 comments

Ok, in this short tutorial I will show you how to set up a TF2 dedicated server on a windows machine.

  1. Download the HLDS Update Tool from the Steam site.
  2. Run the tool to get it installed.
  3. Create a directory for steam, the game files will be created in this directory.
  4. Run the hldsupdatetool executable: (I ran a windows installation, but linux will be similar)

    Windows command:

        -command update 
        -game tf 
        -dir <directory name created in step 3, surround with quotes if spaces are in it>

    Linux command:

        -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.

  5. This will take some time, grab a beer, a cup of coffee, or something else that will help you relax.
  6. 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.
  7. Create a server.cfg file in the orangebox/tf/cfg directory.
  8. Fill it with some basic info. See a small example below.
  9. // The name of your server shown in the server browser
    hostname "TF2 Server"
    // Server e-mail contact
    // 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 ""
    // 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)
  10. Create a shortcut to the srcds.exe executable in the /orangebox directory
  11. Edit the shortcut and change the startup command to look like something like this
  12. "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.

  13. Start the server by running the shortcut

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.

  1. Visit this page and follow the directives there. Be sure to download the a version >= 1.6 of MetaMod:Source.
  2. 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!