Friday, December 20, 2013

Retrolab Quake II Server

The first Linux Quake II server I ran was around 13 years ago, on a Pentium 166 with 100MB of RAM and a 4GB hard disk running Mandrake Linux 6.5. The server could support roughly 4 people, as well play the Quake 2 client itself in software-render mode with the server churning away in a terminal window. It felt really solid for such a fun first-person shooter at the time. I recall a segmentation fault error once or twice, but for the most part the server ran flawlessly. A couple of friends and I had a lot of fun with it for a while; forming a "clan" and creating a few maps and mods for Quake II, Doom II, and Quake 1.

Recently, I've been working with Amazon Web Services and thought it would be fun to launch a dedicated Quake II server in Amazon Linux. I've written a general guide below on the experience.

Everyone is welcome to come play at retrolab.servebeer.com:27910 and try to get a high score. The only thing required to play is a copy of Quake 2. The server is currently running a insta-gib railz mode using the Lithium mod. I'm also working on getting configuration files ready for deathmatch and possibly mods other than Lithium to toggle between every few days.




It wasn't exactly as easy as I assumed it would be going into it. While the more modern r1q2ded binaries make things a bit simpler, and the now near-ancient Linux libraries on ftp.idsoftware.com still function, the problem is getting the server to run as a "service" or "daemon". I've yet to get around to finishing a proper init.d script to be used for this (UPDATE: I have now. See newer post for script), but through some trial and error I did manage to figure out a command to run the server and keep it running after closing the terminal window.

 cd /home/ec2-user/quake2/ && ./r1q2ded +set rcon_password 'password' +set game lithium +exec server.cfg > /dev/null >&1&
I can then use the following to ensure the server is running and check the process id so I can kill and restart the server when needed.

 sudo netstat -tulpn | grep :27910

A couple of other pointers for anyone else wanting to run a Quake 2 server in Amazon Linux are:

1. You should make sure the Quake 2 port (27910 by default) is open in your security group for both TCP and UDP protocols

2. Grab the original unix game binaries from ftp://ftp.idsoftware.com/idstuff/quake2/unix/quake2-3.20-glibc-i386-unknown-linux2.0.tar.gz and extract into your Quake2 folder.

3. sudo yum install glibc.i686. Also, run sudo yum whatprovides libz.so.1 and sudo yum whatprovides libgcc_s.so.1 to learn of what packages you need to install to get those in, and sudo yum install those.

4. Use the newest r1q2ded binary from http://old.r1ch.net/stuff/r1q2/

5. (Ignore if you are not planning on running mods) Also grab any available newest binary for any mod you may plan to run. In my case, I wanted to run the Lithium mod to customize my game, and the old binary I used to use no longer worked properly. When connecting, I would see a kaleidoscope effect in my client window or spawn outside the map until I found the newest Lithium II version and added it to the server.

If anyone reading this is trying to set up a Quake 2 server in Amazon Linux and having a problem, please leave a comment.

Note: This my first non-Interactive Fiction related post here. If you are following the Planet-If feeds, you should not be seeing this via that feed. All IF-related posts are labelled as such.

See my more recent post that contains the init.d script for this here!