FreeOS.com logo

FreeOS Most Popular
* Most Read stories
* Commented Stories
* Active Categories
* Non Linux Section
* User Submitters
* Top Polls
* Top Authors
* Top Reviews
* Top Rated
* Top Search Terms

Top Articles
* Writing a Linux device driver
* The Linux filesystem explained
* Samba NT Domain Controller
* Setting up Squid as your caching HTTP/FTP proxy
* Web server tutorial - Part 1

FreeOS Highlights
* Howtos (72)
* Reviews (20)
* Opinions (18)
* Interviews (8)
* News (3)

My FreeOS

Nick:
Pass:
Register

Forgot your password?

Contact Us
Contact Us

       

Project: Linux triangle Howtos triangle

Quaking on Linux

By Mayank Sarup <Mayank@freeos.com>
Posted: ( 2001-04-30 08:17:05 EST by )

Today, let’s look at how you can get started playing three generations of Quake on your machine.

We’ll start off with Quake 1. One prerequisite to getting Quake 1 (and Quake 2) running on your system is `svgalib’. Svgalib is a general graphics library used by non-X applications. It’s also used to process the mouse and keyboard input.

Svgalib is available from http://www.svgalib.org. We’ve used 1.4.2 here. It’s pretty much standard across Linux distributions, so you’re most likely to get it on your installation discs. The only reason for you to re-compile svgalib would be if you’re on kernel 2.4. You might, on running a graphical application like quake, get an error saying “svgalib: mmap error in paged background memor.” To fix it, just download and untar the source somewhere. Open the file Makefile.cfg and look for a line BACKGROUND=Y. Comment this line out, if not already commented out. Save the file and compile the source. This error is documented in the Svgalib FAQ. This was not required on Red Hat 7 but was required on our SuSE 7.1 installation.

After you’ve-compiled and installed, go into the /etc/vga. Edit the file libvga.config. There are several configuration options that you should look at.

First, un-comment the mouse type currently in your system.

mouse PS2

Now, look for the following values and modify to your liking. The config file is very well documented and you should read the comments to figure out the best setting. As an added bonus, most of the settings are tuned for power Quaking.

mouse_accel_type power
mouse_accel_mult 50
mouse_accel_thresh 4
mouse_accel_power 0.8
mouse_accel_offset 30

Then, look for “chipset VESA”. This will enable VESA support and give you access to the higher resolutions in Quake. If your card or chip is listed then, un-comment that. Our Matrox G400 wasn’t listed so we chose VESA. If your card isn’t listed then this is a safe bet.

The above settings are enough to get you started. There’s a lot of interesting stuff you can do with this file. For example, using the keyboard scan codes, you can fake mouse movements. There are some clever examples given in the default configuration files.

The next item on the list is libc 5. This is required for running Quake 1. Quake 2 doesn’t require these libs. Look for libc5 on Red Hat and shlibs5 rpm on SuSE.

Quake 1

We’re finished with the preliminaries, and can now get down to installing Quake. Get the Quake 1 demo zip from ID. Unzip the files in a suitable location. We used /usr/local/games/quake1. If you have a Quake installation on your drive then you can just copy all the files from it.

cp -R /mnt/windows/C/quake1/ /usr/local/games

That takes care of the data files. We still need to get the Linux Quake binaries. Get this file for console mode quake and this file for X11 Quake.

Untar the files in the Quake1 directory. All the files should be owned by root.

chown -R root.root /usr/local/games/quake1

Another thing to watch out for is whether all the files are in lower case. The Linux Quake howto provides a neat script that will convert all your filenames to lowercase. This script is given below.

#!/bin/sh
for x in *; do
y=‘echo $x | tr ‘[A-Z]’ ‘[a-z]’‘
if [ $x != $y ]; then
mv $x $y
fi
done

To run quake1 in console mode, login as root and use the binary squake. You can set the squake binary as setuid so that regular users also have access, but there are some backdoors in Quake 1/2 that can cause problems. Strangely enough, we got the old “svgalib: mmap ...” error here and Quake 1 refused to run, whereas we didn’t face any problems with Quake 2. X11 quake worked perfectly too.

To run X11 quake, use the other binary quake.x11. You do not have to be root to run this. Simply start X, change to the directory and run quake.x11. We really don’t recommend this because it opens up a really tiny window on your desktop. We tried higher resolutions using quake.x11 -width 640 -height 480 but performance degraded. Squake is a better option. Another alternative is GLQuake but that only runs under the Voodoo, which is a card we didn’t have access too.

Quake II

Let’s move on to Quake II. The procedure for installation of Quake 2 is the same. Grab the files from a Windows installation, get the Linux Quake 2 binary.

You need to create a /etc/quake2.conf that points to the directory containing quake2.

# pwd > /etc/quake2.conf

But wait, John Carmack put in a lot of work into Quake II. There’s an awesome OpenGL mode that you just have to see to believe. It takes a little work but the results will blow you. In any case, the heavyweight of the lot--Quake 3--requires OpenGL support.

Here, we will be working with XFree86 4.0.2, kernel 2.4.3 and the Matrox G400 16MB. XFree86 >=4.0 provide the DRI (Direct Rendering Infrastructure), where essentially, the application, bypasses the X server and talks directly to the hardware. In kernels >=2.3 AGP support has been included. This has also been back-ported to some 2.2 kernels. Distributions like SuSE do provide the agpgart module.

Do a “make menuconfig” and go into “Character Devices”. Go down to the bottom and enable AGPGart support. Compiling it into the kernel is the easy way. Below that, under Direct Rendering Manager, select the video card that you have in your machine. This is essential for DRI support in X. Again, this can be compiled in or compiled as a module. Compiling into the kernel is easier. Only the chipsets listed there are supported. Check here for a list of supported cards.

If you have compiled any or both of the above as a module, you need to ensure that the modules are loaded at startup. Add “modprobe agpgart” and “modprobe mga” to your startup scripts. Reboot and check that the modules are loaded correctly. The agpgart module should be loaded first.

Under XFree86 4.0 and above, there is a single X server for everyone, but there are modules (read: drivers) for your specific chipset. Matrox has provided a binary module for XFree86 4.0.2, you can download here. The latest Linux driver is beta 1.2.0. The minimum you require is mga_drv.o. The other file mga_hal_drv.o is required if you need to use some of the more exotic features of the card like Dual-Head, TV out etc.

To use the new module, just copy it over to /usr/X11R6/lib/modules/drivers. To be on the safe side, copy the original mga_drv.o to another location.

mv /usr/X11R6/lib/modules/drivers/mga_drv.o
/usr/X11R6/lib/modules/drivers/mga_drv.original

cp mga_drv.o /usr/X11R6/lib/modules/drivers
chmod 755 /usr/X11R6/lib/modules/drivers/mga_drv.o

Edit the file /etc/X11/XF86config and ensure that your “Device” section lists the driver as “mga”. It doesn’t matter whether you have a G200/400/450 - they all use the same module.

Section “Device”
Identifier “Matrox G400”
Driver “mga”
VideoRam 16384
EndSection

Next search for the line, Load “glx”. Un-comment this and add another line below it, which says Load “dri”. The entries should now look as below.

# This loads the GLX module
Load “glx”
Load “dri”

Start X. In the string of messages that go by, look for `Direct Rendering Enabled’. You see that and you’ll be set to start Quaking.

Open a terminal window and navigate to the Quake2 directory. Now enter the following command.

$ LD_PRELOAD=/usr/lib/libGL.so.1 ./quake2 +set vid_ref glx +set gl_driver
/usr/lib/libGL.so.1 +set _windowed_mouse 1

A little complex, but this is the best way to make Quake 2 start up in OpenGL mode at 640x480 resolution. Changing resolutions would crash the computer so we stuck with 640x480.

It all looks real good, but you’ll soon see that mouse control is horrible, the desktop cursor still sticks in the center. And you’re still stuck inside a window with title bars etc. Luckily, Zinx Verituse, has written a hack that gets rid of the window borders and gives you a DGA-ized mouse. DGA is another XFree86 4 extension that allows direct access to the device, making for much better movement. You can get this great hack from his site at http://staff.xmms.org/zinx/q2hack/.

Compiling the program is simple.

# tar zxvf q2hack-0.0.4-BETA3.tar.gz
# make
# make install

Open another xterm window, get back to the quake 2 directory. Instead of typing the painful command above, just type ./q2 and let your jaw drop. When we did so, mouse control was smooth but very slow. One thing is for sure—we’ll be watching this hack closely as it develops further.

Quake III

Once Quake 2 is up and running, Quake 3 is a cinch. Get the file, install it and you’re set to go. You can download the demo from www.quake3arena.com. Trouble is that activision requires you to put in your credit card number, for age verification, before you download the file. If anyone has a direct download URL then please key it in the comments section below or send us a mail.

We were able to find a Quake 3 Arena test demo rpm. Install the rpm with a --nodeps if you don’t have a voodoo.

rpm -ivh q3demoTEST-1.10-5.i386.rpm --nodeps

Start it. You don’t need to be root, but you need to be in X.

cd /usr/local/games/q3demoTEST/
./linuxquake3

And that’s it. Quake I, II, III are up and running. Hope this short intro helps you lose some productivity and maybe get a life along the way!

Quake Howto
LinuxQuake
Svgalib
Mesa3D
DRI
ID Software

Other articles by Mayank Sarup

Current Rating: [ 7.05 / 10 ] Number of Times Rated: [ 62 ]

More Howtos
* Kernel Compilation & Avoiding ‘Unresolved Symbol’
* Configuring CVS and CVSUP on Linux
* Knoppix installation tips
* Maximum Mount
* A WebServer Guide -- Help Using Apache

Contents
Articles
  Howtos
  Interviews
  News
  Opinions
  Reviews
Comparison
Links
  Articles
  Howtos
  Interviews
  Opinions
  Reviews
  Websites
News

Linux
About Linux

Print It!
Printer Friendly Version