Left 4 Dead dedicated server

Posted by: Justin

Just for fun…was interested in creating a dedicated game server for Left 4 Dead.

Issue

It seems that when playing online, dedicated servers are often too busy during “peak” times. So, my friends and I often use a locally hosted game. This gives poor ping times for the players that are connecting to the shared server. Generally if my buddy hosts a game locally, I’ll get 250+/- ping times in the game, and the same goes for him if I host one. But…if we both connect to a dedicated one, we both get much better ping times.

Idea

What if I ran a dedicated server on a VM on my box? Would that improve ping times? Is there something in the L4D software that doesn’t allow a good “server” hosting experience when you are playing and hosting?

Plot

  • First, thanks to this site and this site for getting me the info to get started
  • Enter http://www.srcds.com/ for our gaming server software, I chose the Windows one for now since I have a ready VM for this
  • I downloaded the hldsupdatetool from the site and ran it on my test box
    • I used c:\srcds for the destination instead of the default, as the article said
    • Region selected was US East
  • Now to set up the game we want…we can run the following commands using the tool from the command line (c:\srcds\hldsupdatetool.exe)
    • Show us a list of games
      • hldsupdatetool -command list
      • I can see my game is “l4d_full”…but there is also “left4dead” – which one? Let’s go with full
    • Grab the game server files and install them
      • hldsupdatetool -command update -game l4d_full -dir c:\srcds
      • Wait for the download to finish
    • Create a server.cfg file and put it into c:\srcds\l4d\left4dead\cfg
    • Create a shortcut for srcds.exe and right-click it to bring up shortcut properties
      • I changed the target setting to be this:
        • C:\srcds\l4d\srcds.exe -autoupdate -console -game left4dead +hostip [public ip] +ip [private ip] +hostport 27015 +map l4d_hospital01_apartment.bsp
      • The config file would go in c:\srcds\l4d\left4dead\cfg
    • Executing the shortcut got me a nice console window showing success!
      • I was able to join my server at the title menu in L4D by hitting ~ to bring up the game console (have to enable this in game options first)
      • Command is…with x.x.x.x being your server ip
        • connect x.x.x.x
        • It seems you have to launch the srcds program with a map, but you can always change it by calling a vote
  • Overall, not too bad of a setup process, albeit it took me some tinkering to troubleshoot a problem that turned out to be a typo. If you have trouble starting the server process, be sure to double-check commands, spelling, etc!

Results

I tried connecting locally using both my local and public IPs (using game console and connect command). I got very good pings, with the local IP coming in under 20 and the public IP coming in between 40 and 80. I would expect little latency with the server on my network and slightly more latency when connecting via the public IP.

Now to test it with a friend!

Comments are closed.