Tuesday, January 20, 2009

L4d Server Basic Howto

Here's the steps I used to setup a Left4Dead server on my Windows Server 2003 box.

Step 1: Get the files to install the source dedicated server (I used C:\srcds as my dir)
http://www.srcds.com/

Step 2: Run hldsupdatetool and agree to the terms of use etc

Step 3: Update/Install your game
C:\srcds\hldsupdatetool.exe -command update -game "left4dead" -dir C:\srcds

Step 4: Create a server.cfg file in C:\srcds\l4d\left4dead\cfg to look like the following
// server
name
hostname

// password for rcon

rcon_password ""

// Difficulty of the current game (easy, normal, hard, impossible)

z_difficulty normal


// Only allows connections from game
lobbies
sv_allow_lobby_connect_only 0


Step 5: Run the game server
C:\srcds\l4d\srcds.exe -console -game left4dead +ip -port 27015 -nohltv +sv_lan 0 +map l4d_vs_hospital01_apartment


Tips and Tricks:
  • You can control your server by joining the game from a different machine and using rcon.
    1. Open the developers console by hitting tilde (enable it from keyboard setup first)
    2. Type: rcon_password
    3. Now that you're authenticated you can disable autokick by simply typing: rcon
    4. You can also change game settings and more by typing things like: rcon sv_cheats 1
    5. To see each player's latency just type: ping
  • There are useful commands you can run from the console too!
    1. You can see when people type in the game, here's how to respond: say "blah blah"
    2. To kick a player: kick "playername"
    3. To shutdown the server: quit
  • You need a public IP address bound to your server's NIC in order to host a game, here's how to do it while keeping your home network intact.
    1. First off, there are a few requirements for what I'm about to tell you. You must have DHCP based cable or DSL without an authentication mechanism like PPPOE. You must have Windows 2000 or newer with two NICs. Your cable modem must be bridged or otherwise setup so that your NIC will be assigned the public IP address directly from your ISP upon being connected (Not NAT'd through your modem and given a private IP). You'll also need a crossover cable. Got all that? Then read on...
    2. Connect an ethernet cable from your modem to NIC1 on your server.
    3. Connect a crossover cable from NIC2 on your server to the WAN port of your router.
    4. On NIC1, Right click -> Properties -> Advanced -> Check the box for Internet Connection Sharing.
    5. Assuming your router, NIC1, and NIC2 were all set for DHCP, you should now have a server with a public IP address and your home network should still allow all the rest of your machines to access the internet. If you have problems getting the addresses assigned, trying rebooting your router and/or the server. You can also try using DHCP release/renew commands.
Happy gaming!