QuadaverNet : HowtoQuake2Server

StartSeite :: TextSearch :: PageIndex :: RecentChanges :: Login/Account :: You are 38.103.63.57

HOWTO... Make a Quake II server


Introduction

This little howto is to describe what one would generally do when trying to create a Quake 2 server. Step by step.
Later on, I'll describe especially how to make a server for ActionQuake 2... That's the mod for Quake 2 that I know best. ;}

Many people happen to have a Unix-like server, such as Linux, which is good. You won't find much info here about creating a Quake 2 server for Windows since a server should be a server, and not a stupid Windows box.
From my last sentence you can already imagine my direction. Nevertheless, Windows has of course its right to exist...
...somewhere else. :)

This document is supposed to change time after time. For the moment, the content here is more or less standard for the year 2005.
Noticing the year the document was written is very important. How often have you run across an old Quake 2 "howto", only to only notice that it was far too outdated?


Index

- Linux and various tools for it
  • A shell-account on a linux box
  • Do you even have "root"? What's that?
  • Transferring files to the account
- The Quake 2 installation
  • Directory- and filestructure
  • r1q2 dedicated server
- Installing a modification (a mod) for Quake 2
  • Examples of start-files
    • using nohup
    • using screen and &
    • respawn the server if it went down
  • ActionQuake 2 (The Next Generation)
    • Config Files
    • Good Things To Know
    • Shellscripts to help with Administration
- Other resources
  • q2admin
- Contact
- Credits

Linux and various tools for it

Firstly, we need to clarify some unix-like things that are good to know, since I want this howto easy to understand even for Linux newbies.

SSH means "secure shell", it's the way people log in into their Linux server boxes.
PuTTy is a well-known free windows-client for logging into servers with ssh.
zip unzip tar are archiver-programs for the CLI of Linux. They are most likely already installed.
CLI means Command Line Interface. You could as well say, it's the shell you log into.
GUI Graphical User Interface. It's the opposite of CLI :) you could say.
WinSCP is a GUI to transfer files to your ssh-account.
A binary is called an executable file on a Unix system


The most important shell-commands you will most likely need are:
mv = with mv you move files from somewhere to somewhere else. Also used to rename files.
rm = remove files
ls = lists files
cd = change your working directory
pwd = tells you your current working directory


A shell-account on a linux box

Your own computer is a windows computer, right? But you want to install your Quake 2 server to a remote linux machine - located somewhere in a computer center, for example. So what do you need to get there?

Firstly, you need someone to give you a "shell-account" on a Linux box. Perhaps you are going to buy an account at some ISP (Internet Service Provider) or you're having a nice friend who can supply you with an account. Either way, you will always receive some data to login to the machine as a user.

So, when you have the account-data consisting of username, password and host, then you are ready to login with PuTTy, our favorite ssh-client. Fire up PuTTy and configure your session:
http://paul.klumpp.net/q2ded/putty.png
http://www.chiark.greenend.org.uk/~sgtatham/putty/

Don't forget to click on "ssh" and then click "open".
Enter your username and password... there you are - on your shell.

The best would be, of course, you're administrating a Linux machine yourself with "root"-access privileges... If you are one of these people who already have root access, you already most likely know how to do your things in linux. And well, if not, there's help.


Do you even have "root"? What's that?

"root" is called the only user that is allowed to do everything on the Linux box. It's the administrator of the whole system. The root-guy is allowed to add and delete users, add and delete software, control logfiles etc...
So you can imagine - having "root" on a box is very powerful.
And if you happen to have "root" but you still don't know very much about Linux, let me first tell you that no publicly available server-appliance, such as databases or webserver-programs, ever run with "root-privileges". These applications always run as if a normal user started them to minimize impact on security breaches by those applications.

Now, think about your Quake 2 server.. It's a game and there are many many people that will connect to it. There are many intelligent, and even bad people, that perhaps just want to take over your machine, if you don't run your server as a normal unprivileged user with no system rights.
If, on a really bad occasion, someone breaks over your quake2 server in and gets root privileges, your machine won't be YOUR machine anymore and is likely to be abused for other malicious attacks on other not-so-well-secured machines as well. Break that circle..!

So, what do we learn here? Never EVER run a server-application as ROOT.

To add a user which will run your server, type..
# adduser --help
..to see how it is done on your Linux. If you happen to have SuSE, you will have to use "yast" to add a new user.
example
# adduser -g users -d /home/q2server -s /bin/bash -c "This is my Quake 2 Server" q2server
After you created a user (let's call this user "q2server"), give it a password by typing:
# passwd q2server
..you still would have to create its home directory:
# mkdir /home/q2server
and give the new user the ownership of his home directory:
# chown q2server:users /home/q2server
.. now you can remotely login with PuTTy as well.

Transferring files to the account

With the sole shell-login you can't transfer files that easily... you would have to know a command line tool that is called "scp" or "pscp"... to counter this, we recommend use of WinSCP. WinSCP is a GUI for Windows that lets you easily login to your shell with the given account-data and transfer files explorer-like. Drag and drop is supported, as far as I know.

WinSCP is free software that doesn't cost you a dime. So why not go for it?

http://winscp.sourceforge.net



The Quake2 installation

The quake2 installation of a server is rather small.
A server doesn't necessarily need all the data files to work perfectly. A server doesn't need graphics to work with... all it really needs is:
- The quake2 server binary :),
- the quake2 game-dll OR a game-dll of a modification,
- its configuration and
- maps to play on.
First, we start with the general quake2 file setup that has to be put on the server...

Directory- and filestructure

Assume our users home directory looks like this:
/home/q2server/
Then a final quake2 server installation would have at least these directories:

For the quake2 server binary:
/home/q2server/q2sv/

For the normal quake2 game:
/home/q2server/q2sv/baseq2/

For another mod like actionquake2 it's like:
/home/q2server/q2sv/action/
and many more subdirectories...

For short notation later on in this document, I will use "./" to refer to the "/home/q2server/q2sv/"-directory and "./baseq2/" .. or "./action/" or just "the game directory" respectively.

So, at this time, we create the q2sv/ directory in your home by typing:
$ mkdir q2sv

Every mod needs a gamei386.so, which basically is the game-file. It gets loaded by the server binary.
The mod directories are searched by default for a "server.cfg" in order for the server binary to customize your server a bit.

Let's go on with the Quake 2 server binary...


r1q2 dedicated server

As of today, there's one Quake 2 server binary which is best for everything... other Quake 2 server binaries were fading out the last three years, like NcServer or the original Quake 2 3.20 and 3.21 server. I can easily say, there's only one server binary that you really want to install:
The r1q2 dedicated server.

To get it, goto http://www.r1ch.net/stuff/r1q2/ and have a read first.

Use your userlogin to your shell, change to your server directory /home/q2server/q2sv/ by typing:
$ cd q2sv

and get the server binary package there, by typing:
$ wget http://www.r1ch.net/stuff/r1q2/download/r1q2ded.zip
Notice: Later, if your game-dll has problems running, (i.e. "Segmentation fault" after starting or joining the server) get the r1q2ded-old.zip from the r1q2 site (http://www.r1ch.net/stuff/r1q2/ or http://www.r1ch.net/stuff/r1q2/download/r1q2ded-old.zip) to have compatibilty with old mods (such as the original gamei386.so files) or just compile the gamei386.so freshly and r1q2ded from sources - which I always recommend

If "wget" is not found as a valid command, then you would have to use WinSCP to transfer this file to your account from your local computer.

Now, extract the r1q2ded package by typing:
$ unzip r1q2ded.zip

Move the archive to a safe place (the ~ represents the home-directory):
$ mv r1q2ded.zip ~

To make sure the file we just extracted (r1q2ded) of the zip-archive is executable, you type:
$ chmod u+x r1q2ded

For more information on how to set up different useful features of r1q2 dedicated, see the forum:
http://www.r1ch.net/forum/index.php?board=8




Installing a modification (a mod) for quake2

So far, we installed the server binary ... yet we have no clue about installing a game for our server.

A game can be either the original baseq2/ installation or any other modification for quake2 - like ActionQuake 2 is one.

The game-directories, in our case, ./action/ or ./baseq2/ will need the right game-dll and some maps. The game-dll is called "gamei386.so" whereas the maps have to be placed either in a .pak-file or in the maps/ directory.
Notice the wording: You don't always need all the datafiles for a valid installation. Most of the datafiles are only used to be available when a client, that connects to your server, is missing some data... so the server can send it. The maps and the game-dll are needed.

What's needed again?
- gamei386.so, that resides in your mod directory
- .pak-files which include maps, or just
- maps that resides in ./mod-dir/maps/

If you want to have baseq2-standard installation, go on here or skip:

The big datafiles of baseq2/ (pak0.pak-pak2.pak) can be installed too. It's failsafe to copy them:
pak0.pak can be obtained from your Quake 2 CD or your personal client installation.

You can get the other files (old and original) by running these searches at google:
http://www.google.com/search?q=q2-3.20-x86-full.exe
http://www.google.com/search?quake2-3.20-glibc-i386-unknown-linux2.0.tar.gz

Copy the two files to your ./q2sv/ directory. Unzip the .exe (yeah, just unzip the .exe file, it works) and extract the linux archive:
$ unzip q2-3.20-x86-full.exe *pak *cfg *read*
$ tar xzvf quake2-3.20-glibc-i386-unknown-linux2.0.tar.gz *pak *game*so *md2

Move the archives to a safe place (just somewhere else):
$ mv q2-3.20-x86-full.exe ..
$ mv quake2-3.20-glibc-i386-unknown-linux2.0.tar.gz ..

We now have the standard gamei386.so files as well as some standard data files. If you want to compile a gamei386.so freshly to be sure it's compatible with your system, you can use the r1q2-sources .. there you can compile the old baseq2 "game" as well.

All the baseq2/maps are now installed too. The .pak-files have them.


If you want Quake 2 ctf gamei386.so and maps, goto: http://www.threewave.com/quake2/q2files.html or search google for:
"q2ctf150-glibc-i386-unknown-linux.tar.gz" (about 200kb)
"q2ctf150.zip" (9mb)
and extract these archives the same way :)

You'll want to edit the server.cfg that resides in the mod-directories to configure your server a bit.


Examples of start-files

Since ages, people started their servers like (our example is standard Quake 2 here):
./quake2 +set dedicated 1 +set game baseq2

Well, this has changed a bit, a general starting line with r1q2ded will rather look like:
./r1q2ded +set game baseq2
:) Small difference.. and you will think, that was easy. Hell yeah, it is.

People kept asking me, "how do we put the server into background?". Easy speaking, there are two ways for accomplishing this.
"screen" and "nohup".

using screen

When your server has screen installed, you can be lucky. It's perhaps the easiest and nicest way to put a server into background.

Start it:
$ screen ./r1q2ded +set game baseq2
To put it to background press CTRL + A and then D .. the screen now detaches into background :)

To get it back into foreground, use:
$ screen -r

To get a list of running screen processes, type:
$ screen -list

The screen-process will survive the quit from your ssh-login.


using nohup and &

Using nohup and & is kinda nice too .. but in a different way :) - At least, I like it.
A & modifier to a commandline puts every command into the background, the only problem is, when you disconnect from ssh-login, the server gets shut down. the "nohup" command is to counter that.

This will put your server into background:
$ nohup ./r1q2ded +set game baseq2 &
.. but console logging still appears and annoys.

Here, console logging will be off:
$ nohup ./r1q2ded +set game baseq2 > /dev/null &

To kill a running server, just quit the server over rcon - OR do:
$ killall r1q2ded
notice: this will kill all r1q2ded instances.

If you want to kill a single instance:
$ ps ax | grep r1q2ded
$ kill 42463
The number is the process id found out by "ps ax" :)


respawn the server if it went down

You can use both, the nohup and the screen-possibility, to make a loop.. thus, in a very unlikely event, that the server crashes, it will respawn:

In every case, we need a looping script:
--myserver.sh--
#!/bin/sh
while true
do
./r1q2ded +set game baseq2 +set port 27910
echo
echo --sleeping 5 seconds-- break with ctrl+c if you don\'t want a restart of the server.
sleep 5
done

--eof--

screen:

The screen command in a script.. you can type this manually though:
--runme_screen.sh--
#!/bin/sh
screen ./myserver.sh

--eof--

Start with:
$ ./runme_screen.sh

The script myserver.sh will start as a foreground screen. CTRL + A then D to detach it into background. (see the above help with "screen")


nohup:

The nohup starting script:
--runme_nohup.sh--
#!/bin/sh
nohup ./myserver.sh > /dev/null &

--eof--

So, I start my server by the command:
$ ./runme_nohup.sh

The script myserver.sh will go into background and last forever.. until you kill it. (see ps ax, grep and killall)
Don't forget to make your scripts executable after you created them. You remember?
$ chmod u+x *sh
.. otherwise you can't start it and the shell would spit out something like: "Permission denied."

ActionQuake 2 (The Next Generation)

Until now, we saw how to install r1q2ded as a server binary, how to cope with the original data-files and how to make some starting scripts. It's time for some action I guess. ActionQuake 2 is one of the most played modifications till now. One of the reasons it still kept running may be the fact that the tng-source got released to the public as GPL. So, serveradmins could always have a look at it, and some could be easily submitting bug reports.

Just for your information, the real home of TNG is here:
http://aq2-tng.sourceforge.net/

You can obtain a copy of ActionQuake 2 here:
https://sourceforge.net/project/showfiles.php?group_id=26661

From there, we take the server-pak (data):
http://prdownloads.sourceforge.net/aq2-tng/tng_serverpak_2.81.zip?download

And the glibc compiled gamei386.so:
http://prdownloads.sourceforge.net/aq2-tng/aq2tng_2.81_x86_linux-glibc.tar.gz?download

If you don't want to use the pre-build gamei386.so, because you ran into trouble running the server stable, then you'll have to get the
sources and compile the gamei386.so yourself.


Put the serverpak to /home/q2server/q2sv/ and unzip it:
$ unzip tng_serverpak_2.81.zip

Then, put aq2tng_2.81_x86_linux-glibc.tar.gz into action/ and extract the gamei386.so:
$ tar xzvf aq2tng_2.81_x86_linux-glibc.tar.gz


building aq2tng (gamei386.so) from source:
If you don't want to use the above pre-built gamei386.so, then read https://sourceforge.net/cvs/?group_id=26661 and follow the upcoming steps (or skip if you don't want to build from source):

First, make a temporary directory:
$ mkdir aqtemp
$ cd aqtemp

Now, to login into the cvs system, type:
$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/aq2-tng login
.. and press enter.

Then, to download the sources, type:
$ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/aq2-tng co -P aq2-tng

Now, change to the sources directory, and type make:
$ cd sources
$ make

A gamei386.so has now been created. You can copy this to your real ./action/ directory.
$ cp gamei386.so /home/q2server/q2sv/action/

The Step, building from source is completed now, you can go on with the other steps...


Move the downloaded archives out of our sight now:
$ mv *gz ~
$ cd ..
$ mv *zip ~

Now, that you have a gamei386.so and many data files, you could already start the server... but hey, we forgot some maps.. the aq2 tng package does NOT come with maps.
You can find maps by using google: http://www.google.com/search?q=aq2+maps
The first two hits are aq2 map archives. The Quadaver AQ2 Map Archive is one of my websites.

Get a map (like urban.zip), put into action/ and run:
$ unzip urban.zip *bsp
I only install the .bsp file, which is the mapfile itself. The textures and other map-supplemental data is not needed to run a server except you want people allowed to download such directly from your gameserver. Downloading from the gameserver takes very long with vanilla netcode clients but there are emerging some Quake 2 clients which are capable of fast downloading. So if you want to allow downloading, just extract all data of the map-package by typing:
$ unzip urban.zip



Config Files

The point "Config Files" is a veeeeery big point indeed. There are thousands of possibilities and of course, things may be changing or may be done better in the future. So config files are mostly supposed to be done by yourself reading the aq2 tng documentation.. see /action/doc/.

For your aq2 tng server configs, I first recommend visiting the official aq2 config generator:
http://aq2-tng.sourceforge.net/config/config-generator.html
This will help you create appropriate configs for your server...

If you don't want to fill in all the data, you can as well go for my small "aq2 clanwar server config package". Which is available here: http://quad.netdome.biz/aq2/aq2_cwsv.zip
Put the .zip-file into the action/-folder and unzip it :) - It's a very handy package with some helping administration scripts. Q2Admin and the game logic itself is NOT included. You will have to install the .so-files yourself. (everything described above)
Keep in mind that this is just a pre-configured package that may still need tweaking here and there. So if something fails, it's for sure not my fault, you are the serveradmin, you should be able to handle that stuff.


Good Things To Know
Random facts about ActionQuake 2 and servers...

  • If you allow clients to set cl_maxfps 10 to 20, they will be able to "RUN" away with leg-damage on ActionQuake2 - to counter this cheat, you'll want to install q2admin and edit q2admin.txt appropriately to only allow maxfps over 25!!

  • If you want maps being voteable, you need to adjust your maplist action/config/maplist.ini Your server config should then contain the following line:
    set maplistname config/maplist.ini

  • A normal starting line of ActionQuake 2 looks like this (still, see starting scripts above):
    ./r1q2ded +set game action +set port 27910 +exec my_aq2.cfg

  • To enlist your server at a masterserver, add the lines to your configs:
    setmaster b4r.org satan.idsoftware.com master.gamespy.com
    set public 1


Shellscripts to help with administration
The small package http://quad.netdome.biz/aq2/aq2_cwsv.zip contains some nice shellscripts to help with administration tasks, that a aq2 server is going to be.

After extraction, you will find them here:
./action/maps/getmap.sh
./action/admin/make_maplist.sh
./action/admin/check_maps.sh
./action/admin/makesndlist.sh

This will get you the map urban.bsp:
$ ./getmap.sh urban

This will create a full maplist.ini of all maps found in ./action/maps/:
$ ./make_maplist.sh

This will check the difference between your maplist and your installed maps:
$ ./check_maps.sh

This will create the soundlist of sound that should be downloaded to each client on connect, (if allow_download_sounds 1 on clients):
$ ./makesndlist.sh


Other resources

q2 server binaries
http://www.r1ch.net/stuff/r1q2/ - R1Q2 Enhanced Server/Client
http://www.r1ch.net/forum/ - The Forums of R1Q2

mods, games
ftp://ftp.sunet.se/pub/pc/games/idgames2/idstuff/quake2/unix/ - A ftp directory with the old Quake 2 binaries and gamei386.so
http://aq2-tng.sourceforge.net/ - AQ2 The Next Generation

tools
http://www.chiark.greenend.org.uk/~sgtatham/putty/ - PuTTy ssh client
http://winscp.sourceforge.net - WinSCP scp GUI

other howtos - deprecated
http://www.tldp.org/HOWTO/Game-Server-HOWTO/quake2.html - A very old Quake 2 Server Howto


q2admin

Q2admin is a program to help with certain common tasks on a server. Q2admin itself works similar to a normal game-dll. It gets loaded from the q2 server binary first (see before: gamei386.so) .. and then q2admin normally loads a file called "gamei386.real.so" which should be the real game-dll that supplies the game itself.

The only problem so far is, there are many different q2admin versions, and you don't really know which one to use. Also q2admin was supposed to be opensource under GNU General Public License... still people tend to release their q2admin-version closed-source for some reason.
But be advised to not use the original q2admin 1.17. It's full of bugs and security problems.

If you want to incorporate q2admin, please have a look at the following resources:
http://www.planetquake.com/q2admin/
http://www.r1ch.net/forum/index.php?topic=253.0
http://www.r1ch.net/forum/index.php?topic=478.0

So, it's recommended to use iENOs and R1CHs q2admin fork - that has a lot of fixes.
Latest version, I know of, is: q2admin 1.17.44

To install it, just change into your game-directory and type:
$ wget http://r-1.ch/q2admin-1.17.44-linux-update.zip
$ unzip q2admin-1.17.44-linux-update.zip
This will extract a gamei386.so that is supposed to be the first game-dll being loaded by the server. The real game-dll then is supposed to be called "gamei386.real.so".

If unsure about q2admin, it's safe to just don't use it. The r1q2 dedicated binary is going to replace q2admin time after time though. Yet, if installing a server for ActionQuake2 q2admin is recommended since it can keep players from setting their cl_maxfps to 10 - which is cheaty there.



Contact

I am QuAd|Haui, found on #quadaver irc.quakenet.org. My email is haudraufwienix@gmx.de.
If you want to contribute here, like helping to keep this document tidy, understandable and up to date, contact me! :)


Credits

R1CH, for still supporting Quake 2 so much and for making R1Q2 with innovative new stuff.
Maniac-, for a nice and featurerich but yet easy to use client called AprQ2.
"AQ2 - The Next Generation" Team, for having released the mod-source and still maintaining the mod by fixing reported bugs.



(c) copyright 2005 Paul Klumpp (QuAd|Haui). Please link here. If you want to quote, you must give credit. Don't copy and declare as your own stuff. All Rights Reserved.