Steam Users' Forums Setting up & running a L4D2 Server, the definitive guide.
 Register FAQ Search Today's Posts Mark Forums Read

 01-28-2010, 01:36 AM #1 dungeonseeker_1   Banned Join Date: May 2009 Reputation: 46 Posts: 511 Setting up & running a L4D2 Server, the definitive guide. I have recently got myself a L4D2 server and i have noticed that there are a lot of people who are confused about how these servers work (as i was when i first got mine) so i have decided to share everything i have learnt over the past week with everyone in an effort to help people better understand how all the different game modes work on the server side and explain some of the cvars and configs that are required to make your L4D2 server run in any mode you want it to. I must first link to this thread and give thanks to DarkNoghri who linked me to it, most of what i learned came from there, my intention is not the steal what was posted there but to make it more accessable and elaborate on it with the use of sourcemod. In this guide i am not going to be covering server installation or sourcemod installation, Valve already has a perfrectly good guide for that in the support section, if you are looking for that then go here, I will link to a sourcemod install guide later in the topic. I am also going to assume you have some previous source server experiance, this is not an idiots guide. Now on with the guide. 1)Local/Listen Servers a)Installing Sourcemod b)Running in different game modes c)Public/Friends only mode 2)Dedicated Servers a)Server Config b)Installing sourcemod c)Running in different game mode 1) Local/Listen Servers A local or listen server is a server that is created by the game and run from your PC. These are by far and away the easiest servers to use as they require no setup from yourself other than installing sourcemod onto them. Local servers can be set to public or friends only mode and are the best choice for you if you dont have the bandwidth or time to setup a full dedicated server for yourself, they are also the easiest servers to run in different modes. There are a few downsides to local servers, first unlike a dedicated server they do not run all the time, only when you play a game, secondly they rely on your internet connection to work so unless you have a fast connection lag can be an issue. a) Installing Sourcemod As i said at the start of this guide, i am not going to be covering how to install sourcemod, i am only going to provide the details you need to install sourcemod onto your server. Sourcemod have a great guide on how to install it on their website, see it here. Installing sourcemod onto your local server is easy, simply navigate to Code: c:\program files\steam\steamapps\your account name\common\left 4 dead 2\left4dead2\ and you will see an exisiting addons folder. Sourcemod is installed here in the exact same way as you would install it onto a dedicated server. Remember that once its installed you need to add your steam id to Code: ..\addons\sourcemod\configs\admins_simple.ini to allow yourself access to sourcemods admin menu. b)Running in different game modes This is waht makes a local server so much easier to run than a dedicated server. To run your local server in whatever mode you so choose all you need to do is the following, Run Left 4 Dead 2 Choose what game mode you want from the main menu Select Play Internet Game Select More Options Select Create Lobby From Inside the lobby select Game Options From the Server Type option select Local Server Now when you click Start Game L4D2 will run a server from your pc and connect you and anybody else in your lobby upto it. Its that simple. c) Pubic/Friends Only Mode This is fairly self explanitory, essentially setting your server to public means tht anyone can join, and it doesn't matter if your game is still in the lobby or playing, if someone trys to join a public game and they are looking for the same mode and campaign as you are playing then they could join your server. Friends only mode means that only people on your frineds list can join your game, that can be by either invite or by them joining your game via the L4D2 main menus Friends Currently Online option. Thats really all you need to know about local servers. 2) Dedicated Servers A dedicated server is a server which runs seperatly from the game, if you wish to run a dedicated server from your pc then you are required to download most of the game files from Valve using the HLDSUpdatetool, they also require much more configuration than a local server. That said they are the preferred choice for most gaming communitys/clans as they provide you with complete control of every aspect of your server. If you have purchased a game server from an internet company then it is a dedicated server. Dedicated servers are normally always running (unless you are running it from your PC in which case you can stop it/start it as required), they are more cpu and ram intensive then a local server but if setup properly can provide you with a much smoother gaming experiance. As i said at the start of this guide, i am not going to guide you through installing or using a dedicated server, if you need help with that then see here. ) Server Config The first thing you need to setup when running a dedicated server is the server config file which is located at Code: your server location/cfg Please note that your server location is the location you installed the dedicated serve to, i cannot tell you this as you are asked for the location during the server download process. If you have a rented server then simply log into your server using an FTP client and open Code: your server ip/cfg There should already be a server config (server.cfg) in there. I will provide a sample config which outlines all the various cvars and what they mean. Again this was taken from the guide i linked to at the top of the page, i have simply tweaked it to meet my needs and added many more sourcemod specific options. [code] // hostname// DO NOT REMOVE OR ALTER // BRANDING IN FRONT OF YOUR SERVER HOSTNAME WITHOUT AUTHORISATION //Host Name hostname "your server name" // Steam group ID number, this is used to broadcast your server to allm members of your steam group sv_steamgroup "xxxxxx" // RCON Password rcon_password "xxxxxx" // Server password //sv_password "" //Gametypes //this is ued to specify which gamemodes your server can run. Specifying a game mode here will lock your server to that game mode, if you want to run multiple modes leave this option alone //options are //----> Versus Only: sv_gametypes "versus" //----> Survival Only: sv_gametypes "survival" //----> Coop Only: sv_gametypes "coop" //----> Both: sv_gametypes "versus,coop" //sv_gametypes "" // Server Cvars mp_disable_autokick 1 //Prevents a userid from being auto-kicked sv_allow_color_correction 1 //Allow or disallow clients to use color correction on this server. sv_allow_wait_command 1 //Allow or disallow the wait command on clients connected to this server. sv_alltalk 1 //Players can hear all other players, no team restrictions sv_alternateticks 0 //If set, server only simulates entities on even numbered ticks. sv_cheats 0 //Allow cheats on server 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 “support@somewhere.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 //Server is a lan server ( no heartbeat, no authentication, no non-class C addresses ) sv_region 4 // 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 log on sv_rcon_log "1" sv_logsdir "logs" 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_maxupdaterate 100 // Sets the maximum value for cl_updaterate sv_minrate 25000 sv_maxrate 50000 sv_unlag 1 sv_maxunlag .5 //Fix to get your server onto the master lists setmaster add 68.142.72.250:27011 setmaster add 72.165.61.189:27011 // Difficulty of the current game (easy, normal, hard, impossible) z_difficulty expert //Set to 1 to only allow members of the steam group to make the initial connection to this server sv_steamgroup_exclusive 0 //Allow connections without creating lobby. Set to 1 to allow lobby connections only sv_allow_lobby_connect_only 1 heartbeat //----------------------------------------------------------- //--> Custom Modifications for a competitive hike //----------------------------------------------------------- //director_adrenaline_density 3.56 //--> How much Adrenaline should there be for every //--> 100 sq ft in each level. //director_convert_pills 0 //--> Convert all pills to medpacks in non-versus games. //--> "1" to Enable, "0" to Disable. Default: "0". //--> server error? If set to 0, disabled medpacks & pills. //director_defibrillator_density 0.0 //--> Reference director_adrenaline_density. //director_pain_pill_density 5 //--> Reference director_adrenaline_density. //director_super_weapon_density 0.0 //--> How much super weapons (Grenade Launcher, etc.) //--> should there be for every 100 sq ft in each level. //director_tank_force_offer 1 //--> Force the director to spawn a tank on each level. //--> Remember, the director can only force a tank spawn //--> On levels that have "possible" spawn locations already. //--> There are some levels that do not have tank spawn //--> Locations, and as a result, this does not work on all levels. //director_upgradepack_density 3.56 //--> Reference director_adrenaline_density. //--> Upgradepack refers to fire rounds, etc. //director_vomitjar_density 3.56 //--> Reference director_adrenaline_density. //versus_tank_chance 1.0000 //--> Percentile chance of tank spawn per team. //--> Refers to levels excluding first and last per campaign. //--> "1.0" = 100%, "0.95" = 95%, "0.9" = 90%, etc. //versus_tank_chance_finale 1.0 //--> Percentile chance of tank spawn per team. //--> Refers to finale level in each campaign. //--> "1.0" = 100%, "0.95" = 95%, "0.9" = 90%, etc. //versus_tank_chance_intro 1.0 //--> Percentile chance of tank spawn per team. //--> Refers to only first level of the campaign. //--> "1.0" = 100%, "0.95" = 95%, "0.9" = 90%, etc. //versus_tank_flow_team_variation 0.0 //--> Refers to the variable chance of tank spawning //--> in a different spot for each team. //--> "0.0" = same spawn spot per team. //--> "5.0" = 5% map distance variation CHANCE. //versus_witch_chance 1.0000 //--> See versus_tank_chance Above. //versus_witch_chance_finale 1.0 //--> See versus_tank_chance_finale Above. //versus_witch_chance_intro 1.0 //--> See versus_tank_chance_intro Above. //versus_witch_flow_team_variation 0.0 //--> See versus_tank_flow_team_variation Above. //tank_stuck_time_suicide 9999999999 //--> Prevents tank suicide when stuck. //versus_boss_flow_max_intro 0.9 //--> Tank can spawn up to 90% of map distance in first level. //versus_boss_flow_max 0.9 //--> Tank can spawn up to 90% of map distance in levels //--> Excluding the first level. //vs_max_team_switches 9999 //--> Removes the limit of team switches per map. //director_vs_convert_pills 0 //--> Convert all pills to medpacks in versus games. //--> "1" to Enable, "0" to Disable. Default: "0". //director_tank_lottery_selection_time "2" //--> How many seconds the tank waits to give an infected //--> Player control of the Tank. During this interval //--> The AI controls the Tank. //--> Default "4". Set to "0" to remove AI control completely. //z_ghost_delay_max 22 //z_ghost_delay_min 22 //--> Maximum/Minimum amount of time (in seconds) for players to //--> Wait to respawn as the Infected. //--> Ex: Min/Max both = "22", Infected will ALWAYS have a 22 //--> second spawn timer. If Max = "22" and Min = "15", the //--> Spawn timer will be random, between 15 and 22 seconds. //----------------------------------------------------------- //--> Tougher Witch //----------------------------------------------------------- z_witch_damage "100" z_witch_damage_per_kill_hit "60" z_witch_flashlight_range "1000" z_witch_health "2000" z_witch_personal_space "400" z_witch_speed "800" z_witch_threat_hostile_range "1000" z_witch_threat_normal_range "800" //----> End of editable settings [code] You can use this for your server if you wish. Go through it and change any options to suit your needs then save it as server.cfg and trnasfer it to the cfg folder on your gameserver. b) Installing Sourcemod As i said at the start of this guide, i am not going to be covering how to install sourcemod, i am only going to provide the details you need to install sourcemod onto your server. Sourcemod have a great guide on how to install it on their website, see it here. Installing sourcemod onto your dedicated server is done in exactly the same way as it is done on a local server, first you need to open up your server files to the root server directory, the one which contains the addons and cfg folders and then follow the guide i posted above. Remember that once its installed you need to add your steam id to Code: ..\addons\sourcemod\configs\admins_simple.ini to allow yourself access to sourcemods admin menu. c)Running in different game mode This is where things get tricky. Left 4 Dead 2 has 4 different game modes, Co-Op, Versus, Scavenge and Co-Op Realism. It is possible to set the game mode using a startup command line but for most people (anybody with a rented server) this is not feasable as you are not granted permission to edit your start up command line so everytime you want to switch mmode you have to ask your provider to do it for you. Because of this i devised a solution which you can use as long as sv_gametypes is not set in your server config and you have sourcemod installed. First you need to create 4 text files, name them as shown below and enter the text provided into each one. Name - coop.cfg Code: map c1m1_hotel Name - versus.cfg Code: map c1m1_hotel versus Name - scavenge.cfg Code: map c1m4_atrium teamscavenge Name - realism.cfg Code: map c1m1_hotel realism Once you have these 4 files place them into Code: your server/cfg Next go to Code: your server/addons/sourcemod/configs and grab a copy of the file called Code: adminmenu_cfgs.txt open it and enter the following text in it Code: Configs { "cfg/server.cfg" "Standard Server Setup" "cfg/coop.cfg" "Run Campaign Mode" "cfg/versus.cfg" "Run Versus Mode" "cfg/scavenge.cfg" "Run Scavenge Mode" "cfg/survival.cfg" "Run Survival Mode" "cfg/realism.cfg" "Run realism Mode" "cfg/sourcemod/sm_warmode_on.cfg" "War Mode On" "cfg/sourcemod/sm_warmode_off.cfg" "War Mode Off" } then copy it back into your server and reboot. Now when you wish to swap gamemodes simply bring up your sourcemod admin menu and choose Code: Server Commands > Execute Config and choose the config which corresponds to the mode you want. You will lose connection to your server as it swaps mode, this is normal, when you reconnect it will be running whatever mode you choose. Hopefully now you should be able to run your server in any mode you want. And that concludes this guide, i aimed to guide users through the process of changing their servers game mode using sourcemod and i have done that however if anyone has any other suggestions please let me know and i will add it to the guide. Thanks for reading this guide. Last edited by dungeonseeker_1: 01-28-2010 at 05:51 AM.
 02-01-2010, 04:27 AM #2 RugbyOddjob   Join Date: Mar 2009 Reputation: 815 Posts: 6,571 Thanks OP: I've just got my server and this is the sort of information that will help. Must admit I haven't gone through everything yet but am looking to use Confogl and CEVO + a config with slight Hunter buff and !pause functionality + a Vanilla config with no changes. Can you point me in the direction of doing this effectively? i.e where to put the various configs and how to activate them as Admin? Sorry if these are in the text but just telling me they are will suffice Thanks once again and +rep for taking the time to put this on the forum.
 02-20-2010, 08:33 PM #3 Travis Bickle   Join Date: Mar 2004 Reputation: 129 Posts: 3,015 Good guide, I installed a LFD2 server on my box today. I ran a cvarlist and I cannot for the life of me find the cvar's responsible for increasing the server FPS. Right now my server is stuck at 30 fps. fps_max is a "unknown command". Does anyone here know how to get higher server fps? Thanks.
 04-29-2010, 01:17 PM #4 Turbo13   Join Date: Dec 2008 Reputation: 0 Posts: 38 I have run into a problem using the Sourcemod menu. When I choose versus the server shuts down if someone doesn't join immediately since I am the only one on the server. Am I missing something? Is there a fix for this?
05-06-2010, 08:46 PM   #5
ebiljebus

Join Date: Mar 2010
Reputation: 1
Posts: 60
Quote:
 Originally Posted by Turbo13 I have run into a problem using the Sourcemod menu. When I choose versus the server shuts down if someone doesn't join immediately since I am the only one on the server. Am I missing something? Is there a fix for this?
If you're running CEVO, I think you can set it to have sb_all_bot_team 1, so that the server will count the bots as players and not shut down.

 02-07-2012, 02:17 PM #6 Bear809      Banned Join Date: Dec 2011 Reputation: 51 Posts: 848 Doesnt work. Connection aborted after 10 retrys. I followed this through.
 04-09-2012, 08:09 AM #7 oltem4682      Join Date: May 2010 Reputation: 0 Posts: 57 Do I need to portforward for a public listenserver? Because if i make a listenserver nobody can join and the console say this: (Im Nl LZ FOZ oltem,btw) Terminate 110000104e690e9 Destroy connection to 0.0.0.1:1/110000104e690e9 == handle(17) Got disconnected state 22 Local Disconnected for handle 17 listen 65551 [NL]|LZ| -=FOZ=- Oltem unpaused the game Got connected state for handle 19 listen 65551 creating socket 19 for listener Incoming connection to 0.0.0.3:1/11000010426eef4 == handle(19) state == connected for 0.0.0.3:1 11000010426eef4 == handle(19) And my server is on ip: 127.0.0.1:27015 And everybody that connect looks like this in the console: Client "grayserega" connected (0.0.0.6:1). So I dont think its right... Can somebody help me with this? Last edited by oltem4682: 04-09-2012 at 08:29 AM. Reason: Forgot something
 09-16-2013, 05:17 PM #8 blackwidower      Join Date: Jul 2013 Reputation: 0 Posts: 13 So, is there no way to set up a cfg file on a local/listen server? Or is that only for dedicated servers? Because you seem to skip that for no discernable reason.

 Steam Users' Forums Setting up & running a L4D2 Server, the definitive guide.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

All times are GMT -7. The time now is 11:46 PM.