Table of Contents
Installing a Counter-Strike: Source server
by Flubber, for Gandi
I - Downloading the HL-Dedicated Server
The server's principle is the same for all mods (at least those officially offered by Valve) conceived with this engine, such as Counter Strike Source, Half Life 2 Deathmatch or Team Fortress 2.
To begin with, you need to download the server and then the files corresponding to the game you're going to install.
Let's start by creating a directory in which to deploy the installation tool, and then download the file (Source Server, or srcds).
cd srv mkdir srcds cd srcds wget http://storefront.steampowered.com/download/hldsupdatetool.bin chmod +x hldsupdatetool.bin
Now let's launch an update for this tool, and for Steam
./hldsupdatetool.bin ./steam
II - Installing the game files
Now let's fetch the files corresponding to Counter-Strike Source. But let's begin by creating a directory for these files:
mkdir css ./steam -command update -game "Counter-Strike Source" -dir css
Needless to say that this part of the installation is by far the longest! If you wish to accelerate the download and the treatment of files, you can buy a couple more shares for the time of the installation.
We'll therefore tell Steam to update the installation (-command update) for Counter Strike Source (-game “Counter-Strike Source”) in the current directory (-dir .). In our case it is inexistent: the game will be completely downloaded.
Once the download is finished, it's good to check that the files are all in good state. This step is not compulsory, but isn't very time consuming either and ensures the server will work properly.
./steam -command update -game Counter-Strike Source -dir css -verify all
The game server is now completely downloaded and ready to be launched. But you need to configure it in order to obtain a customized - and optimized - server.
III - Customizing the server
server.cfg
All necessary infos required by the server are in the server.cfg file which is itself in the cfg directory. If it doesn't exist, create it.
These are the basic infos the server will need. There are an enormous amount of variables which are not worth presenting here, but you'll find everything you need easily on the web. It may look a little daunting like this, but it's necessary to know a minimum amount of these variables to manage your server properly.
server.cfg
// Server name - Provide a name for your server here hostname "Father Flubber's Counter-Strike Server @ Gandi" // rcon Password (this is your server's administration password, do not share it with anyone) rcon_password "password"
//Server password (here you can provide a password to restrict access to your server, or leave this field empty if you want a public server) sv_password ""
Server cvars (here begins the long list of server variables)
In a majority of cases :
0 disables the function
1 activates the function
Sometimes you'll need to give a value, especially in the case of time variables.
Values marked by // are the most important.
// activates friendly fire mp_friendlyfire 0 mp_footsteps 1 mp_autoteambalance 1 // Automatic kick of players mp_autokick 0 // Allows flashlights mp_flashlight 0 //Automatic punishment for team-killing mp_tkpunish 1 //Blocks camera for dead players mp_forcecamera 0 //Activates vocal discussion for both teams sv_alltalk 0 //Allows the server to be paused sv_pausable 0 //Allows cheating sv_cheats 0 //Checks integrity of data to ensure the client and server have the same files sv_consistency 1 //Allows upload and download (tags or maps you've added for example) sv_allowupload 1 sv_allowdownload 1 sv_maxspeed 320 mp_limitteams 2 mp_hostagepenalty 5 sv_voiceenable 1 mp_allowspectators 1 //Time limit for each map (in minutes) mp_timelimit 25 mp_chattime 10 //Time before inactive player is kicked (in seconds) sv_timeout 65
// round variables //Time where players are frozen at the beginning of the round (in seconds) mp_freezetime 6 //Length of a round (in minutes) mp_roundtime 5 //Amount of money with which players begin round mp_startmoney 800 //Length of the bomb timer mp_c4timer 45 //Maximum amount of rounds before changing maps mp_maxrounds 0 //Maximum amount of team victories before changing maps mp_winlimit 0 //Player protection time before the beginning of a round (in seconds) mp_spawnprotectiontime 5
Network settings
These settings allow you to force player machines to transmit info at the same time for fairness' sake, regardless of their connexion speed
sv_minrate 4000 sv_maxrate 8000 decalfrequency 60 sv_maxupdaterate 100 sv_minupdaterate 60
// Server logs //Activates server logging (variables: on/off) log on
//Log banned players sv_logbans 1 sv_logecho 1 sv_logfile 1 sv_log_onefile 0
//Miscellaneous //Defines if server is local or online (always leave this variable on 0) sv_lan 0 //Defines the server's region (For Europe, put 3) sv_region 3 //Disables Valve's dynamic pricing system (very few servers use it) mp_dynamicpricing 0
// execute ban files //Server will read list of banned users exec banned_user.cfg //Server will read list of banned IPs exec banned_ip.cfg
For example: http://www.cstrike-planet.com/cfgmaker?cfg=srcds
B - Adding maps
Few servers run with the original maps today. Many players have indeed played them countless times.
Servers usually host a selection of maps which correspond to a certain “tone”, and to your clan members' and visitors' wants.
One can't really give you advice on the maps you should be installing. I can only recommend a site that I consider to be a reference: fpsbanana.com, which lists almost every map created and a ranking of the most downloaded.
Maps must be copied into the “maps” folder which is in your installation's root directory.
Once they have been copied, you need to add them to the mapcycle. To do so, nothing simpler: edit the mapcycle.txt file which is also at the root of your server, add the name of the recently installed map and save it.
It will be taken into account as soon as the server changes to the next map being played, without even needing to restart.
All files needing to be compressed can be compressed. This is the way to go about it:
cd maps bzip2 newmap.bsp
You'll then obtain a file, newmap.bsp.bz2, which will take half as much space as the original map, thus dividing the download time for players by two.
Any file can be compressed, not only the .bsp files for maps, but also the accompanying text files and the sound files you may have wanted to add.
It's possible to create a download mirror in order to avoid the game server being overloaded when a player doesn't have the map. It is imperative to keep the same architecture on this server as you do on the game server.
For instance, suppose my mirror is on "http://www.cssmirror.com". I should therefore create a css folder in which I will create a maps folder, where all the new maps in .bz2 format will go (it's necessary to put both). Once the mirror is set up, you must add the following to the server.cfg file:
// Maximum file size allowed for downloadable files (Original value is 15Mo) net_maxfilesize 60 //Provide mirror URL sv_downloadurl "http://www.cssmirror.com/css/"
IV - Launching the server
After this long but necessary configuration phase, let's launch our brand new CS:S server.
Go to the /srcds/ folder and launch the Source Dedicated Server in the following way:
In our example, the server will have 24 player spots, a tickrate of 100 and will start with the de_dust2 map.
cd srv/srcds/ ./srcds_run -console -game cstrike +map de_dust2 -maxplayers 24 -autoupdate -tickrate 100
A high tickrate enables you, for example, to avoid having a player who has just run for cover being killed because of a lag in his positioning to other players, who wrongly see him as being still in the clear.
Put simply, the higher the tickrate, the higher the information about player positions will be precise, and you'll receive fewer player complaints :)
screen -A -m -d -S css-server ./srcds_run -console -game cstrike +map de_dust2 -maxplayers 24 -autoupdate -tickrate 100
A css-server screen will be created. To access it, type:
screen-x css-server
There you go, have fun, and don't be afraid to ask any question to the Gandi community!