]>
So you want to run your own Counter-Strike server eh? It's not that hard to be honest. Just make sure you have the requirements for one. Each player consumes bursting bandwidth of ~7K/sec. Most will use 4K/sec until fire fights break out then it will go up. This means if you want to run a 16 man server on the Internet you'll need an upload speed of about 896Kbps. Normal modem users have ~33kbps upsteam. Cable users: 128kbps, ADSL users: 256kbps.
As for hardware you want a 500MHz or faster CPU, anything less will mean maps take too long to load. RAM depends on the operating system. 256MB's is usually ok. If you are planning on using a dedicated box for CS servers you should be able to get 4 CS servers running perfectly on: 1GHz CPU, 512MB RAM, UDMA100 Hard Drives.
HLDS or Half-Life Dedicated Server is the software that runs the server. It's a console based application, meaning you can run it as a Service on Win32 or use nohup on Linux. Download and install the latest version of HLDS (old ones simply won't work online) along with the latest version of Counter-Strike. I'll presume you have installed a Win32 copy to C:\HLDS\ just to make this document easier for me to write :) However you are planning to launch the server you'll need to get the command line correct with the correct arguments to start the server correctly. Use this:
C:\HLDS\hlds.exe -game cstrike +maxplayers 16 +map de_dust +exec start.cfg
This will start the game and load Counter-Strike. It'll set the maximum players to 16 and set de_dust as the first map (I generally choose this as it's one of the quickest to load, and is popular so people will come back after a crash). The last part executes a console script called start.cfg. This is useful for any commands you want to be executed on server start up, but not done every time the map is changed. Such as server passwords, you may want to have one on, but then take it off. If you have it in the server.cfg it will put it back on every time the map changes.
Server.cfg
This is the configuration file for your server (in your cstrike directory), and will be executed *every* time the map changes. Put permanent settings here, and one-off settings in start.cfg. Here is a sample server.cfg:
Before I run through the config, this is a nice new bit for Valve's new world of Steam Powered servers. Which all their games are now supporting, the plan is to turn off WON. Now setting up a Steam server isn't as easy, naturally it's supposed to be easier, but it's not due to poor design at Valve. I highly suggest you download the 500MB full install of the original Steam servers and then download the updates from bit-torrent (Valve release on bit-torrent as they are aware that their network cannot support themselves). This is the best method for most server admins as the Steam network coughs up data at about 45K/Sec tops, which is no good for us on backbones and usually download at 2MB/Sec.
Once you have downloaded and figured out how to extract the files you will need to run the Steam updater. Do this (we are now presuming you are running Linux):
cd <HLDS install dir>
./steam -create <email> <password> <question> <answer>
./steam -update <game> <HLDS install dir> <email> <password> Y
[^ do that line twice]
./hlds_run -autoupdate -game cstrike blah blah blah
Of course, some people are still using Windows for servers (fools) so what we do for them is the exact same as above but in a command prompt window. Just change the './steam' bit to 'hldsupdatetool.exe'.
Take note of your e-mail and password you created an account with, as Steam will forget it, even if you ask it to remember it (the Y one the end of the update line asks it to save it).
Server.cfg entry | Purpose |
// My Config |
Anything preceded with // is a comment and won't be executed. |
hostname "Deep-Thought - sponsored by aligrant.com" | This is the server's name. |
mapchangefile "server.cfg" | Makes the server reload this file on every map change. |
exec banned.cfg | This loads any previous bans made. |
sv_aim 0 | Turns off automatic aiming for snipers. |
sv_cheats 0 | Turns off cheats (such as unlimited money). |
sv_maxspeed 320 | Sets forward speed (default). |
sv_allowupload 1 | Allows people to upload their logos. |
sv_allowdownload 1 | Allows people to download logos and maps. |
pausable 0 | Prevents people from pausing the game. |
decalfrequency 60 | Seconds between each spray of a players logo. |
log on | Turns on logging. |
sv_logdetail | Logs each bullet (massive files). |
mp_falldamage 1 | Turns on fall damage |
mp_flashlight 1 | Allows players to use the Torch. |
mp_footsteps 1 | Will make footsteps audible. |
sv_maxrate 7000 | Maximum bandwidth for players in KiloByte per second. |
sv_minrate 3800 | Minimum rate, don't set too low otherwise 56K'ers can't play. |
rcon_password "mypassword" | Remote control password. |
sv_lan 1 | Tells the server if it should announce itself to the Internet as there. |
sv_friendlyfire 1 | Turns on friendly fire |
mp_timelimit 30 | Length of the map |
mp_roundtime 5 | Length of each round |
mp_buytime 1.5 | Minutes people can buy for (90 seconds) |
mp_autoteambalance 1 | Auto balances the teams. |
mp_teamlimit 1 | Maximum extra of players on a team. |
That's about it. Your server should now be ready to use. You can edit your mapcycle.txt to adjust in which order new maps are loaded. To control your server remotely use "rcon". You use this from your Half-Life console. Connect to your server in CS and type this in your console:
rcon_password "mypassword"
Make sure your password matches the one in your server.cfg. If you don't specify one then you won't be able to control it remotely. You can now issue all console commands to the server the same way as if you were looking at it, but just prefix rcon to the command. So, to list the details of all the players on the server you could type:
rcon stat
or
rcon users
Valve made the hlds_run script, what this does is create a watcher process that monitors the HLDS process, and restarts it if it crashes. The down-side to this script is that it doesn't help when an admin types "rcon quit", as that is not seen as a crash.
In order to combat this I modified the script slightly by taking out a few lines. I also added in an error check to stop the script if it's run from 'root' (which is just a very bad, and unsafe idea).
You can download the modified script from here. Just over-write your current one (NB: this is only applicable to Linux users, Win32 should set HLDS up as a service (see Win2K resource kit)).
The other thing to save on time is to have the games start automatically when the server is switched on. To do this you can create a simple shell script that will start all your games. Such as:
cd /home/servers/hlds_l/
nohup /home/servers/hlds_l/hlds_run -game cstrike +maxplayers 12 +map cs_docks > /var/log/hlds_l.log &
You will need to make this file executable (chmod 755 ). Then you will need to create a link to it from the system start up (for this you will need root access to create a startup file). To save the server from trying to start the games as root you should use the "su" command to get around it.
S99hlds_l shell script:
su - -c <username> <startupscript>