Left 4 Dead 2 Dedicated Server Setup
Looking for a copy of L4D2?
So the Left 4 Dead 2 early access demo for the PC and 360 goes live Tuesday and I figured I should grab it and setup a Left 4 Dead 2 dedicated server. Getting the files was easy, but setting up and getting the Left 4 Dead 2 dedicated server up wasn't.
The setup process for running your own Left 4 Dead 2 dedicated should be the same as my previous guide on a Left 4 Dead dedicated server but with a few tweaks. Sharing my steps for setting up a Windows Left 4 Dead 2 dedicated server will save everybody else some time and effort.
I am using a Windows host, so if you are using linux you will have to follow DOA's write up setting up a Left 4 Dead dedicated server on Ubuntu.
The main tool needed is the hldsupdatetool from Steam. You can go and grab the Windows version is located on the bottom right of the page. Open up the command prompt (Go to Start Menu-->Run type cmd and hit enter). Now go to the directory where you installed the hldsupatetool.
For me it looks like this:
C:\HLServerhldsupdatetool -command update -game left4dead2 -dir C:\HLServer
Easier way is to make a batch file and put that command into it; you can use that batch file to keep your Left 4 Dead 2 dedicated server updated. Just put the command into a text file and change the file extension to .bat
That command will hit Valve's server and grab all the files you need for your Left 4 Dead 2 Dedicated server; this is also how you keep your dedicated server up to date. Pretty easy to do (sofar).
Now what you should do is head to \HLServer\l4d\left4dead2 and make two text files named mapcycle.txt and maplist.txt.
Next head to HLServer\l4d\left4dead2\cfg and make a text file named server.cfg and put this in as a minimum:
hostname Server Name Here
// Rcon Cvars
rcon_password "your recon password" //Set's remote control password
// Server Cvars
mp_disable_autokick 1 //Prevents a userid from being auto-kicked
sv_allow_wait_command 0 //Allow or disallow the wait command on clients connected to this server.
sv_alltalk 0 //Players can hear all other players, no team restrictions
sv_alternateticks 0 //If set, server only simulates entities on even numbered ticks.
sv_clearhinthistory 0 //Clear memory of server side hints displayed to the player.
sv_consistency 1 //Whether the server enforces file consistency for critical files
sv_contact "your_admin@whatever.com" //Contact email for server sysop
sv_downloadurl "" //Location from which clients can download missing files// Lan or internet play, Server region cvars
//sv_lan 0 //If set to 1,Server is a lan server ( no heartbeat, no authentication, no non-class C addresses )
sv_region 255 // Region Codes: 0 - US East coast, 1 - US West coast, 2 - South America, 3 - Europe, 4 - Asia, 5 - Australia, 6 - Middle East, 7 - Africa, 255 - world// Server Logging
sv_log_onefile 0 //Log server information to only one file.
sv_logbans 1 //Log server bans in the server logs.
sv_logecho 0 //Echo log information to the console.
sv_logfile 1 //Log server information in the log file.
//sv_logflush 0 //Flush the log file to disk on each write (slow).
sv_logsdir "logs" //Folder in the game directory where server logs will be stored.//Server Rates
sv_maxcmdrate 100 //(If sv_mincmdrate is > 0), this sets the maximum value for cl_cmdrate.
sv_unlag 1
sv_maxunlag .5
You could probably put more cvars and whatnot in there, but for now this will give you a basic setup that will get you going. From what I have seen, you could use a Team Fortress 2 config generator, but I am not sure what will work and what wont.
The final step for getting your Left 4 Dead 2 Dedicated server up is to start it. This is done by either the command line, a batch file or making a shortcut to the srcds.exe in your left4dead 2 directory. I did it the last way and added this command to the end of the Target parameter (after making a shortcut on my desktop):
-console -game left4dead2 +ip "your ip address" +hostport 27015 +"map" c5m1_waterfront.bsp
All you have to change is the ip address and put in the mapname (take out the "" characters) and your Left 4 Dead 2 dedicated server will be up and running in no time. By having the -console in there, it will bring up a console of the server when you double click on the shortcut, making for easy administration. The +map will start your server with the specified map. If you don't have it, your server won't work properly.
If you have any questions, leave a comment or follow me on twitter and I will help you with setting up your Left 4 Dead 2 dedicated server as best as I can.
If you need to contact me for help, you can follow me on Twitter
Edit: I was unable to get it to work with the shortcut to SRCDS.exe, but after you configure your server.cfg, just launch the SRCDS.exe manually and it will pick up on your server config file. That was quick, thanks to the comments I changed the article to reflect how to get it server started.
edit: If you want to connect to your own L4D 2 Dedicated server, use this command BEFORE starting the lobby: mm_dedicated_force_servers ServerIP . You also have to be the lobby leader. Replace the ServerIP with the IP of your server and it will connect to yours. Make sure that it isn't full though.
October 27th, 2009 - 22:15
Fantastic, thanks.
October 28th, 2009 - 02:50
To get the shortcut (or BAT file in my case) working, I had to remove all the ‘-’ parameters. Which I think means all the launch parameters are handled by server.cfg and/or the GUI in this version of srcds. Anyway here’s my launch command:
srcds.exe +ip “my IP” +hostport 27015 +map c5m1_waterfront.bsp
I put my external IP (dyndns name actually) and the server picked it up successfully. I thought this was required in order to be listed in the server browser (outside your LAN) but I could be mistaken. And yes, you’d need to forward port 27015.
(Accidentally posted this on the old Left 4 Dead article, sorry :-\)
October 28th, 2009 - 09:17
need to remove the demo part when starting the server
srcds.exe -game left4dead2 -console
October 28th, 2009 - 10:52
That was the ticket for me! It was weird, since the HLDSupdatetool lists the game as the left4dead2_demo and I figured that would be the correct to launch as a batch.
October 29th, 2009 - 14:26
Whats wrong?
I have set permission with chmod and chown.
Failed to open bin/dedicated_linux.so (./bin/vstdlib_linux.so: cannot restore segment prot after reloc: Permission denied)
November 1st, 2009 - 20:47
do we delete l4d_hospital01_apartment.bsp since thats for the old left 4 dead, and add the map c5m1_waterfront or c5m1_waterfront.bsp
November 1st, 2009 - 21:46
why cant i get cheats to work? and do souce mod l4d plugins work with l4d2?
November 2nd, 2009 - 04:05
I love it! Thx!
November 2nd, 2009 - 05:13
Thanks for putting this guide up, I’ve got a couple of questions:
When you say, “create a file named server.cfg”, do you actually mean config.cfg? I can see a default_config.cfg file in the cfg folder, and the comments there say that it’s loaded unless there’s a config.cfg file. I can’t see a default server.cfg file anywhere.
November 2nd, 2009 - 10:09
Nick, he says create because it doesn’t exist. Config.cfg is for a players and not for the dedicated server. Server.cfg gets executed whenever your server changes map, this file is where you want to have your servers default settings.
November 2nd, 2009 - 11:59
@Nick: Anonymous has it; config.cfg is just for the player and the dedicated server will not use that file, it needs the server.cfg
@CakroackCrakrox: yeah, it should be the new map, I thought I had changed that. Fixed now. As for the source mod stuff, you might have to wait until those authors update them to work with Left 4 Dead 2. I know when I used them with the original L4D, it would cause problems whenever you tried to slap a player, etc.
November 16th, 2009 - 09:30
Well I have a problem, I was able to install and run the server just fine, but.. I can’t join my server when it’s at 0/4 players nor can I create a new lobby and start a game from there that’d use my server even when using this:
mm_dedicated_force_servers 0.0.0.0|192.168.0.100:27015
I indeed do get the log for the request and the server readies up for my game to start, BUT instead of my client connecting to the server it just loads a while in the lobby and creates a localhost server. -.- Then my dedicated server on the other machine decides that the request expired and closes my newly opened game in which I never even got to.
When trying to join my server when it’s at 0/4 players the server reacts fine by starting the new session, but the game client ignores this and tells me that the session has expired and doesn’t let me join the server.
I can however join whenever there is already a game in-progress on my server, started by someone else online.
November 19th, 2009 - 03:58
I started srcds.exe with the target perimeter, then when I launched my left 4 dead 2 and try to join in to my server it said “session out of …..”, did anyone come cross this? btw on the C:\HLServerhldsupdatetool -command update -game left4dead2 -dir C:\HLServer, is it LEFT4DEAD2? or is it l4d2_full?or l4d2? (NOT THE DEMO), which one is the full version?
November 19th, 2009 - 04:46
ahhh nvm I fix it by deleteing the clientbob registry in the steam folder, but now I have a new problem, if you wanted to enable sv_cheats 1 in your dedicated server, it says can’t use cheats now; make your own listen server…..I did it without the srcds.exe shortcut target line and it said the same, but when I did with the shortcut target with “map c1m1_hotel.bsp” and then in the game typed “rcon_password wutevers” and “rcon sv_cheats 1″ it says Unable to connect to remote server (111.111.1.1:27015), does anyone have a fix on that? or does anyone know how to enable sv_cheats on your dedicated server
November 19th, 2009 - 11:30
fredfrep: if you want to enable cheats on your server, you have to set it either in the l4d2 server config file, or you have to be in your server to do the rcon command. You could also try to use HLSW ( http://www.hlsw.org/ ) to try enabling cheats that way.
November 19th, 2009 - 16:35
I try doing the server to do rcon command same message and the server config files didn’t work, how do you enable cheats through HLSW, I downloaded the program, now wut?
November 21st, 2009 - 07:35
How do I let the server run vs mode only?
November 21st, 2009 - 11:03
fredfrep: So setting sv_cheats 1 in the server.cfg did not enable them? Weird. With HLSW you would add your server to the list, add your RCON password and goto the console tab.
testing: The server doesn’t work that way really, the game type is set by the connecting lobby. In L4D you were able to remove the single player maps and it would only do the versus, now I don’t believe it is possible.
November 22nd, 2009 - 13:53
So how do you even start versus mode map on the server? Im running a dedicated server and Im frustrated by not being able to find a way to start versus on it at all..
November 23rd, 2009 - 06:12
Yea, thats was what i was looking for, defaut versus mode and versus mode only.
November 23rd, 2009 - 10:50
Yeah.. the reason why im trying to do that is that I would enjoy being able to connect to my own server whenever I feel like playing the game. I only play the versus only anyway. Im really puzzled by for example if you would want to play versus on LAN only server how would you do it?
November 23rd, 2009 - 15:02
King Hopy: You can’t set the server via configs. the game mode is set when a lobby connects to the server; then the game mode is set and you play. use the mm_dedicated_force_servers command to connect to your own server (you have to set it before creating the lobby though)
December 1st, 2009 - 00:39
Hey.
I get this error whenever I try to connect to my own server:
Invalid protocol, expecting 2001, got 2002
BinkOpen( d:\left 4 dead 2\left4dead2\media\l4d2_background04.bik )
I suppose it has something to do with my patch. The server is up to date and so is my game. I’ve tried to find a 2002 patch, but that doesn’t exist?
And where do I write in the mm_dedicated_force_servers IP? I tried putting it into th shortcut, but that doesn’t work.
December 3rd, 2009 - 08:08
@Nico:
It looks like it is an error with your end of things. Try verifying the integrity of your game cache on your machine.
January 29th, 2010 - 14:28
The ubuntu link is for left 4 dead 1,
u know how to get left 4 dead 2 instead?