Tutorial L4D Server Configuration : Game Modes/Types by demand

The purpose of this tutorial is to show you how to set up a L4D server with the mode(s) of choice, then how to set up a lobby and bypass the public dedicated server search query, and force your L4D server for use with the lobby set up.

Step #1

To configure your L4D server you have to become familiar with the cvars (Console Variables), these variable values help determine and define what game instructions will load on your server. An example of a cvar is "hostname", this cvar allows use to set a unique identifying name to the server which is seen when running search queries or when connecting to a server.

We will jump right into the configuration at this point. The variables I will mention are very simple to set up, we will set up a L4D server that will allow any of the multiplayer game modes by demand. To control what game mode is being played depends on what game mode you select from the lobby.

Our first variable to look at when configuring game modes "sv_gametypes" is what will allow us to specify.. you guessed it game type or mode. The variable sv_gametypes has pre-defined values which are "coop,versus,survival".

So if you wish to allow all game modes define sv_gametypes like so in your config:

sv_gametypes "coop,versus,survival"

This will allow us to set the game modes or types. For coop I highly suggest not setting a difficulty by config, check my config example at the end of this tutorial to learn why. If you wish to only have one or two just remove one with the comma delimitation. Important do not put a space after the comma, if there are spaces the values will be parsed incorrectly when loaded by the server and some modes will not work.

Next cvar is "sv_search_key", which allows us to specify that we have our own server and do not want to search for a server. This is set in the configuration for the server, an example would be:

sv_search_key "Destroy"

I will show you how to use this in step two of the tutorial. But for now think of your own unique phrase, this variable allows a string of letters/numbers.

The cvar sv_search_key is kind of like a password don't give it to anyone unless you want them to be able to use your server, think of it like a key to your home or vehicle don't lend it to anyone unless you can trust them.

I will include an example configuration for your server and give a directory location of where to store this file on your server via FTP, at the end of step one.

The last step of configuring our server for game modes is setting up the server for execution (starting up the server) We have to set parameters for the server, such as map, how many players, and so on. To do this we have the game panel that allows use to modify or create new start up configs.

On the main menu for your game panel server set up there is an option labeled "Command line changer" go ahead and direct yourself to this and you should already have a default start up set up. Which would look something like this:

-game left4dead -console +ip X.X.X.X -port 27015 +maxplayers 8 +exec server.cfg +map l4d_vs_hospital01_apartment

This will suffice what we are trying to accomplish, which is to allow all game modes. Because when you select what mode from the lobby you send instruction to the server to change the mode and map. The only reason you would need more than one command line config is because you only specify one game mode at a time. Just remember you do want to start up the server with one of the game modes you are going to enable. To specify this we do so by using the map for the mode "l4d_vs_hospital01_apartment" is for versus (vs), if you're unsure what map to load just check your maps directory for the map name. Once you have your command line config changes select the desired one and save changes.

And finally we are almost complete with step one, but here is an example of a simple L4D server config can look like (forward slashes are used to comment out characters in our config, when server is loading any line beginning with "//" will be ignored):

//|-- Start of config --|

//Host Name
hostname "Destroy's Server"
// Rcon Cvars
rcon_password "password" //Change this to something secure, rcon is used for remote control of the server.

// Server password
//sv_password ""

//in game browser
sv_flags "Browser"

// Server Cvars
mp_disable_autokick 1 //Prevents a userid from being auto-kicked
sv_allow_color_correction 0 //Allow or disallow clients to use color correction on this server.
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_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 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 //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
//Fix to get your server onto the master lists
setmaster add 68.142.72.250:27011
setmaster add 72.165.61.189:27011

sv_search_key "Destroy" // Here is our search key
sv_gametypes "coop,versus,survival" // Here are our game modes defined

sv_steamgroup 999999 //this is your groups steam group id.. allows members to join from main menu add
sv_steamgroup_exclusive 0 //to make it exclusive and private

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

//|--- End of config ---|

I told you we would talk about the difficulty cvar for coop "z_difficulty". Do not define any value for this cvar just set the difficulty in the lobby. Reason being there are some bugs that break the server from time to time... yadda yadda I won't go into the details. So just set difficulty from the lobby and leave difficulty commented out in config for now.

Next copy this config into notepad or any text editor of your choice, make any changes you see fit to your liking, such as search_key, and any password related cvars for sure. Then you can once you're satisfied save the file and make sure you are saving as "all file types" then name the file "server.cfg" and save. Now upload the server.cfg to your l4d cfg folder "/l4d/left4dead/cfg/server.cfg"

Once saved.. START YOUR SERVER UP!!


Step # 2

Now that you have configured the server for your game modes start up L4D. Now once you have the game started up and the main menu loaded enable the developer console if you have not already, then go to: Options, keyboard/mouse, and then enable developer console.

Now press the tlide key (~), the console will appear now input your search key with cvar. Example, sv_search_key "Destroy"

This will tell your computer what key to use. Again make sure you have defined the same key in your server config and match the case (upper/lower) of the unique key, and yes make sure it is unique or it will conflict with others.

Then to make sure you have the key defined on your client computer type in sv_search_key in console and press enter it will return the current value set. And you should see your key that you have typed. And now finally set up a new lobby with the game mode of your choice, once you have all your players click search/start button and within seconds you should be connecting to your private L4D Server!!

  • 44 Users Found This Useful
Was this answer helpful?

Related Articles