![]() | ![]() |
|
Game Server HOWTOAnders Jensen-Urstad$Id: Game-Server-HOWTO.sgml,v 1.5 2003/04/08 20:49:11 andersju Exp $
1. IntroductionThis document describes how to install, configure and maintain dedicated servers for various popular multiplayer games, such as the Quake series, Half-Life/Counter-Strike and other first-person shooters. Linux makes a great operating system for game servers because of its stability and speed (not to mention it's Free). 1.1. Copyright and LicenseThis document is (c) 2001-2002 Anders Jensen-Urstad. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html. 1.2. HistoryI wrote this document because I couldn't find any decent documents covering more than one game. Wading through piles of readmes, guides, howtos and webpages can be quite tedious.
1.3. New versionsThe newest version of this document can be found at its homepage http://x.unix.se/howto/ (both HTML and its SGML source). Other versions may be found in different formats at the Linux Documentation Project. 1.4. CreditsI've gathered information from lots and lots of different READMEs, HOWTOs, web pages, and of course personal experience. The Unreal Tournament section was written by Knight Walker <kwalker@aros.net>.
1.5. FeedbackIf you have any questions, comments, suggestions, corrections or whatever, please mail them to <anders@unix.se>. 2. BasicsGame servers can consume a lot of CPU and bandwidth (depending on the game and the number of connected players). If you don't own the machine and want to run a server from your account, ask the system administrator first. 2.1. Security and permissionsAll dedicated servers are strongly recommended to be run from another user than root. I recommend that you create a new user that handles all the game servers. You may not have permission to create certain directories mentioned in this document as a normal user, for example /usr/local/games/quake3. If so, create it as root and then chown user:group /usr/local/games/quake, where user is your username and group your group, or simply create it in your home directory. 2.2. Keeping the server runningIf your game server crashes, a shell script like the one below might come in handy so you won't have to restart it manually. It can easily be modified for whatever server(s) you're running.
Put the script somewhere, name it sv_up or whatever you like, and make cron run it every 5-10 minutes:
Put this in crontab (crontab -e). It will execute sv_up.sh (the shell script above) every 10 minutes and its output is sent to /dev/null (in other words, it disappears instead of being mailed to you). 3. QuakeWorldQuakeWorld is a multiplayer-only version of Quake with optimized network code. id Software released the source code for Quake/QuakeWorld in 1999, spawning a number of projects set out to improve, optimize and add more features to the code and make it more secure. QuakeForge is quite well-developed on the client side, but mvdsv (part of the qwextended project) seems to be the most popular server in the QW community. It's famous for its ability to record demos from each player's POV (Point of View) and store them for retrieval by the players. 3.1. System requirementsHere are the minimum system requirements for the QW (QuakeWorld) server. Remember that the requirements vary depending on the number of clients.
3.2. Installingid Software's old qwsv is quite dated and should not be used (nor can it be used in most cases, since it's built for the ancient libc5). So, use either mvdsv or QuakeForge. Note: Both mvdsv QuakeForge are actively being developed (more or less), and it's highly possible that newer versions than the ones linked below have been released, so check http://qwex.does.it/ or http://quakeforge.net/files.php before you proceed further.
Create a directory for the QW server in your home directory:
If you downloaded the mvdsv source:
If you downloaded the mvdsv binary:
If you downloaded the QuakeForge source:
This will at least build qf-server, nq-server (RealQuake) and some client binaries. We don't need the latter; you can choose not to compile them, or simply remove them later. Anyway, if the compilation went fine you should now have a binary called qf-server in $HOME/quake, where $HOME is your home directory (usually /home/user). You might want to rename mdsv or qw-server to qwsv, since that's what I'll call it in the rest of this document. Now create the directory id1 in the quake directory and copy the pak0.pak and pak1.pak files from your Quake CD or wherever you have them into that directory:
You also need the qw files: Unzip it in your quake directory:
Now you're ready to run qwsv. Start it by running ./qwsv in the quake directory. It should work fine (if not, make sure all the filenames are in lower-case). Try connecting to your server with a client. 3.3. ConfiguringNow it's time to configure your QW server. Make a server.cfg file in the id1 directory containing the following:
As you can see the server.cfg file contains all kinds of variables the server uses.
The above command runs the qwsv server in the background and sends the output to /dev/null (if you want to log the output, just replace /dev/null with /blah/qw.log or whatever). -port specifies the port the server will use; QW's default is 27500. For a complete list of commands and the official QW manual, see QuakeWorld.net. For a list of special commands that can be used with mvdsv, see the qwex readme. 3.4. Threewave CTF (Capture The Flag)Capture The Flag, or CTF for short, is - or was, at least - the most popular Quake modification. There are many different CTF variants. Threewave CTF is the original and most popular CTF modification for QW. You need the following files:
Create a ctf directory and extract all the files you downloaded to it:
Now try to start the server (if you don't specify a map it'll default to an interesting modified version of Quake's start level):
For more information, read ctf/server.txt. 3.5. Kombat Teams ProKombat Teams is a very popular mod that's been around for a long time. Most QW servers run it. KTeams greatly simplifies all forms of DM games by supplying commands to set teams, timer, readiness and much more. Download the following: Extract it in your quake directory:
Start the server:
Default is a 1on1 server. To start a 2on2 server you'd add +exec 2on2.cfg, or +exec 4on4.cfg for a 4on4 server, or +exec free.cfg for a free for all server. KTPro comes with a bunch of scripts which do this; ktpro1on1, ktpron2on2, etc. in the quake directory. Check out all the configuration examples in ktprosrv/ and the documentation in ktpro.doc/. 3.6. Rocket ArenaRocket Arena is a very exciting modification. It's one-on-one games with the simple rule "winner stays, loser goes". Each player waits for his/her turn to fight in the arena. Every player gets full armor (200), 100 health and all weapons when they enter the arena. The winner stays to fight again, the loser goes back to the line. Simple? Yes. Boring? Not at all! Now, on to installing this modification. Get the following files:
Create a directory called arena in your quake directory and unzip the above files to it:
Start the server:
For the map rotation you can choose one of the following (of course you can edit these or make your own, remember that the last map must loop to the first):
4. Quake IIQuake II is the sequel to Quake, featuring great multiplayer capabilities just like its prequel. 4.1. System requirementsAs always, the minimum system requirements vary depending on the number of clients.
4.2. InstallingTo start a Q2 server you need the Q2 client package and the pak files from the Q2 CD. Download the one that suits your system (glibc, unless your distribution is really ancient):
Create a directory for Q2 and extract the Q2 client package to it:
Now create a baseq2 directory inside the quake2 directory and copy the pak files to it from the Q2 CD-ROM:
Go to the Quake2 directory and start the server:
It should work fine and people should be able to connect to it. 4.3. ConfiguringYou'll want to create a server config (cfg) file. Put the following in a file called server.cfg in the baseq2 directory and modify it as you like:
Settings:
Now start the server with ./quake2 +set dedicated 1 +exec server.cfg. Your config file will be read and the variables in it will be used. You can have different config files for different game types, for example ffa.cfg, ctf.cfg, etc. with customized settings. They should all be in the baseq2 directory. To have your server listed on the master servers (so people using GameSpy, XQF and similar programs can see your server), type set public 1 in the server console or in the config file. With the command set setmaster 'master server' you can change master server (default is id Software's master server). 4.4. Q2CTF (Capture The Flag)Download one of the following (you'll most likely want the glibc one, unless your distribution is ancient). It only contains the file gamei386.so. Create a ctf directory in your Q2 directory and extract the q2ctf archive:
You'll also want the Q2CTF package with the CTF maps, ftp://ftp.sunet.se/pub/pc/games/idgames2/idstuff/quake2/ctf/q2ctf150.zip (9.1 MB). Unzip it to the ctf directory. To start a CTF server, run ./quake2 +set dedicated 1 +set game ctf +exec server.cfg, where server.cfg is a file you should create in the ctf directory, containing this:
4.5. LMCTF (Loki's Minions CTF)LMCTF, Loki's Minions CTF, is a popular CTF modification for Q2. You need all the following files:
Create a lmctf directory in your Q2 directory and unzip all the files to it. Go to the Q2 root directory and start with the following command:
There are some files in the lmctf directory that you'll probably want to edit: server.cfg is the main cfg file containing many standard server options. maplist.txt contains the list of maps the server cycles through. To alter the map list, create a file in your root Q2 directory called maplist.txt containing the names of the maps and add +map mapname to the command line when you start the server, where mapname is the name of the first map in the maplist.txt you just created. The file motd.txt contains the "message of the day" clients will see when joining the server. For more information on LMCTF, see its homepage. 4.6. Rocket Arena 2To run a Rocket Arena 2 server you need the following files:
Create a directory called arena in your quake2 directory and extract the above files:
Edit server.cfg to your liking. Another file that you may want to edit is arena.cfg, which is used to customize settings on a per arena basis as well as map rotation information. Start the server:
4.7. Lithium IILithium II is a very popular and configurable server-side deathmatch mod, adding things like the grappling hook and letting you configure pretty much everything; see its readme.txt file for more information. Download the following file: Extract the file in your quake2 directory. All the files will be placed in a new directory called lithium:
Lithium II comes with four different config files, copy one of them to server.cfg and modify it to your liking:
Start a deathmatch server with the following command:
To start a CTF server, you must have Q2CTF installed. Extract the lithium archive to your ctf directory and start with the following command:
4.8. L-Fire DML-Fire DM is a server-side mod that adds many features to Q2, such as organized match support, anti-spam, highscore lists for each level, profanity filtering, etc. What you need:
You can run L-Fire DM from either the baseq2 directory (in that case it'll show up as a standard DM mod in GameSpy and similar tools, or you can give it its own directory (lfiredm or whatever you prefer). Extract the archive (actually, it only contains two files, gamei386.so and readme.txt), or in other words place gamei386.so in your directory of choice.
LFireDM_v1_11_Config.tar.gz contains many config files which you may want to edit. Extract it to the directory where you put gamei386.so:
Start the server:
4.9. L-Fire CTFL-Fire CTF is like L-Fire DM a server-side mod that adds many features to Q2CTF like match support, anti-spam, highscore lists for each level, rocket arena/sudden death overtime, etc. What you need:
Extract the archive to your Q2CTF directory:
LFireCTF_v1_20_Config.tar.gz contains a bunch of configuration files which you may want to edit. Extract it to the Q2CTF directory:
Start the server just as you normally would:
4.10. Q2AdminQ2Admin is a very good transparent proxy modificatiom that adds many admin functions, and the most important, ZBot/Ratbot (among other things) detection to preven cheating. Q2Admin works with all Q2 mods transparently by filtering communication between the server and the mod it's running on top of. I recommend that you install Q2Admin if you're going to run a public server. Download this file: Now extract the archive and compile it:
Now you should have a file called q2admin.so in the q2admin directory. For each mod you want to protect with Q2Admin, copy the install and q2admin.so files to each mod directory and optionally the *.txt files if you want to customize the Q2Admin settings for different mods. Run install, ./install (chmod +x install if it's not executable) and start the server as usual. The install script moves gamei386.so to gamei386.real.so and q2admin.so to gamei386.so. Run install again to move the files back to their original names. There's a huge number of commands; See readme.txt included in the q2admin package for everything you need to know. 5. Quake III ArenaQuake III is the latest game in the Quake series, designed as a multiplayer deathmatch game. 5.1. System requirementsAs always, the system requirements vary depending on the number of players on your server.
5.2. InstallingFirst download the latest Q3A Linux point release. As of this version of the HOWTO it's v1.32b, but that may have changed when you read this. Run the installer:
The default installation directory is /usr/local/games/quake3. Copy the *.pk3 files from the Q3A CD-ROM to the baseq3 directory.
Go to the Q3 directory and test the dedicated server, ./q3ded. 5.3. ConfiguringNow it's time to write some config files. They contain all the variables the server will use (maps to be played, gametype, etc..). All cfg's must be in the baseq3 directory. The file q3config.cfg is always executed. I recommend that you have different cfg's for different gametypes, for example ctf.cfg, ffa.cfg, and so on. You can use q3config.cfg for general settings, and then another cfg on top of it. Run ./linuxq3ded +exec configfile.cfg to start the dedicated server and execute the specified config file. This is what my FFA (Free For All) config file looks like:
Start the server with ./q3ded +exec configfile.cfg. You can execute cfg's directly from the server console with the command exec configfile.cfg. If you want to run the server in the background, immune to hangups, start using nohup ./q3ded +exec ffa.cfg &. 5.4. Q3CTF (Capture The Flag)CTF is built into Q3A (Q3CTF). Four CTF maps are included with Q3A, but you will want to download Dave 'Zoid' Kirsch's (the author of CTF for Q1/Q2/Q3) excellent Q3WCTF maps - ftp://ftp.sunet.se/pubi/pc/games/idgames2/planetquake/mappacks/q3wctf.zip (7.8 MB). Here's a CTF cfg which includes all CTF maps in the mapcycle. Paste it in a new file, ctf.cfg, in the baseq3 directory:
Start with ./q3ded +exec ctf.cfg. 5.5. Rocket Arena 3Rocket Arena 3 is the popular Quake3 version of Rocket Arena. You need the following files:
Create a directory for RA3 and extract the files:
Edit server.cfg to your liking. Start the server with the following command:
Use +set dedicated 1 to run a private server or +set dedicated 2 to run a public. For more info on RA3 configuration options, read readsrv.txt in your arena directory. 5.6. AllianceAlliance is a popular CTF/DM mod. It offers three different game styles:
All the above game styles can be played as CTF, FFA, Team DM or Tourney. Note that the mod was made with CTF in mind. Anyway, you need the following files:
Extract the files:
Now start the server running your desired gametype. Alliance:
Combat:
Instagib:
Edit maplist.cfg to change the map rotation. Two large Alliance map packs can be downloaded from its homepage. 6. Half-LifeHalf-Life is the most popular multiplayer first-person shooter on the Internet as of this version of the HOWTO - mainly thanks to the modification Counter-Strike, hereafter referred to as CS. 6.1. System requirementsThe system requirements vary depending on how many players you have on your server.
6.2. InstallingYou need the HLDS (dedicated server) package to run a Half-Life server: When you've downloaded the above file, create a directory for HLDS and run the downloaded file (specify $HOME/hlds as the directory to install to, if that's what you want):
Now we want hlds to see its dynamically linked libraries (*.so files). If you're running bash, which you most probably are, run:
This adds $HOME/hlds to the directories ld checks for libraries in. 6.3. ConfiguringNow you can start hlds; ./hlds_l to start a dedicated Half-Life server. It should work with the default settings, so try it:
At the end you should see something like this:
If the 'Auth' is missing it's probably because your server is using an incorrect IP address. Type status in the server console and it will spit out some info. If your IP isn't what it should be, quit the server with the exit command and start it again with this command:
If it doesn't work now, you might be behind a firewall. If that's the case, let's just hope the network admin is friendly - make him open the port(s) you need. 27015 is the default port. If you want to run a modification instead of regular DM or teamplay, pass the -game modname argument to hlds. Example: ./hlds_l -game tfc +maxplayers 12 +map 2fort. The server reads autoexec.cfg, server.cfg, motd.txt and mapcycle.txt. Edit these to your liking. Autoexec.cfg is only executed when you start the server. Server.cfg is executed at every map change. Motd.txt contains the text that players will see when they join your server; a good idea is to put your server name, homepage (server stats page?) and contact info in it. Mapcycle.txt contains the list of maps you want rotated on your server. Type in all the maps you want there, each on its own line, without the ".bsp" extension.
Min/max rates - The commands sv_maxrate xxxx and sv_minrate xxxx force clients to use the specified rate. This is useful if you, for example, don't want LPB's stealing bandwidth (which makes HPW's annoyed) - type sv_maxrate 6000 to do this. If you on the other hand want to run a server for LPB's, set the minimum rate to something around 9000 with sv_minrate 9000. Kicking/Banning - Each player is assigned an userid by the server. Type users in the server console to see the players id's. Usually you can kick people simply by typing kick nick, but this can be difficult if a client has a long nick or is using strange characters. If this is the case, you can kick clients by their id with kick # . If you want to ban a client, preventing them from coming back to the server, find their uniqueid with the users command and then ban with banid minutes uniqueid, where minutes is the number of minutes you want to ban the player (0 makes the ban permanent), and uniqueid the player's uniqueid. To keep players banned even after restarting the server, type writeid before you quit the server, and add exec banned.cfg to your server.cfg so that the next time you start your server, it will read the uniqueid's in banned.cfg. You can also kick and ban a client at the same time with banid uniqueid kick. Remove a ban with removeid id, and don't forget to remove it from server.cfg if it's there too. RCON - RCON lets clients on your server execute server commands remotely. Add the line rcon_password "password" to server.cfg. Clients type rcon_password password in the console and can then execute server commands, like rcon kick, rcon mapchange, etc. This is good if you want to deal with abusive players directly when you're playing on the server, or maybe let a few other trustworthy persons do it. To use rcon when playing on your server, type rcon_password password in the in-game console. You can now execute several commands if the password was correct, but remember that you must add rcon before every command, for example rcon kick player. 6.4. Counter-StrikeFirst you need, of course, a working Half-Life server. Download the latest CS package. As of this revision of the HOWTO it's 1.5, but that may have changed when you read this. Extract it to your HLDS directory:
Now run the CS server:
Edit the /usr/local/games/hlds/cstrike/server.cfg file to change it to your liking and optimize the server. The file mapcycle.txt contains the list of maps to be included in the map cycle, and motd.txt contains the MOTD - Message Of The Day. Maps - By typing mp_timelimit 1 in the console, the server will go to the next map in the cycle. The command changelevel followed by the mapname makes the server change to the specified map. The maps must be in your cstrike/maps directory. For more information on CS servers, see http://server.counter-strike.net. 7. Unreal TournamentUnreal Tournament is a very addictive first person shooter which is designed to be run in one of several modes; DeathMatch, Capture the Flag, Last Man Standing and Assault are the most popular. It features bots, a bevy of weapons and plenty of community support. It was originally ported as an in-house development effort at Epic but later releases are handled by Loki Software. Current version as of this writing is 436. 7.1. System requirementsAs always, the system requirements will vary slightly depending on the number of players on the server. Here are the basics:
7.2. InstallingFirst, download the latest ut-install file from Loki's website. As of this version of the HOWTO, that is 436.
Mount the Unreal Tournament CD (Usually /cdrom or /mnt/cdrom), and run the ut-install*.run file. It will verify the archive, check the CD for the appropriate files, and begin installing. It will ask you where you want to install UT to, as well as a few other questions. It is actually fairly painless. Once you have it installed, you will want to change ownership of the files to the user ID that they will be running under (See Security and permissions). 7.3. ConfiguringNow it's time to write a config file. Unreal Tournament uses an INI-style config file format which is exactly like Windows INI files. This config file will contain ALL the variables the server will use, including game types, defaults for those types, number of players, bots, etc. The cfg's should be kept in the System/ directory (either $UTROOT/System/ or ~/.loki/ut/System/). If you have an UnrealTournament.ini and/or User.ini in that System/ directory, it will be loaded and can override settings in the server's cfg file. This is a sanitized copy of my server's cfg file (called ucc.ini):
A few things of note here. The following values should be changed before the server is launched for the first time:
Should all be set to where Unreal Tournament is installed.
Should be uncommented if you wish to link your Unreal Tournament server into an existing Unreal Tournament league and have it accessible over the Internet.
Additionally, if you do want to link your UT server with an Internet league, you will need to allow UpLinking.
This should be set to the allocated bandwidth (in bytes per second) for each player. Leaving it at the recommended 20000 is good.
All of that should be changed.
An admin password should be set, and the Max Players should be set to a sane value (See ConfiguredInternetSpeed).
One of the most interesting aspects of running a UT server is the web-server interface for admins. By setting bEnabled to True and specifying a ListenPort, you can administer an UnrealTournament server via a normal Web Browser.
If you do decide to run the UT Webserver interface (Recommended), the above values should be set. AdminRealm is less important, but will be used by your browser to know when to ask for the administrator username and password. All other values should be checked and seasoned to taste. 7.4. Starting the serverTo start the Unreal Tournament server, you will need to use the command "ucc server" and specify a few things on the command line. These being:
Most of this is specified in the config file, but the mapname and Gametype are required. Here is an example:
I quoted the mapname and gametype because of the presence of the ? (Linux shells use that as a wild card) and because a lot of Unreal Tournament maps have odd characters in their name (DM-Deck16][ anyone?). I recommend they always be quoted. Once the server starts, it will load the settings specified in the System/ucc.ini file and load the game. I also recommend the server be started with the nohup command and placed in the background. All the configuration will take place in the web interface. 7.5. Administrating the serverAdministering the server is as easy as browsing a website. When you started the server, you should have seen something like this toward the end:
Notice the UWeb.Webserver and UWeb.so sections? Those are the webserver, and since it didn't give any errors, we know it's running. Now, in the configuration section, you told it what port to listen on:
So, to connect to the administration server, you would need to browse to http://utserver:5080/ServerAdmin The first thing that will happen is that your browser will ask you for authentication. Back in the configuration file, we specified that:
So in this case, you would sign in as utadmin with a password of utpasswd (You had better change these before you actually start the server). Once you are authenticated, you are presented with an interface that allows you to specify the game type, map, number of bots and connections as well as kick and ban users. It's all very point-n-click. |