As part of a broader organisational restructure, data networking research at Swinburne University of Technology has moved from the Centre for Advanced Internet Architecture (CAIA) to the Internet For Things (I4T) Research Lab.

Although CAIA no longer exists, this website reflects CAIA's activities and outputs between March 2002 and February 2017, and is being maintained as a service to the broader data networking research community.


Playing Quake 3 under FreeBSD 4.8 with an nVidia Graphics Card

CAIA Technical Report 030722A


Grenville Armitage
July 22nd 2003
(editted January 5th 2004)

Introduction

This report summarizes how we configured FreeBSD 4.8 with nVidia drivers to run the Quake 3 client.

As part of our GENIUS project we have been experimenting with different sorts of networked, multiplayer games. Most games are released for Windows platforms, but a small collection of First Person Shooters (including Quake 3) have also been released for Linux platforms. FreeBSD runs most Linux applications in their binary form, and we have been running Quake 3 dedicated servers for some time under FreeBSD. When nVidia released their latest video card drivers for FreeBSD (4.8 and later) we decided to document just how easy (or hard) it is to run the Quake 3 client on a FreeBSD desktop.

In a nutshell here's the problem we're solving. We have:
  1. A desktop PC running FreeBSD 4.8
  2. An nVidia 3D accelerated graphics card
  3. A commercial copy of Quake 3 for Microsoft Windows
  4. A desire to play Quake 3 without rebooting the desktop into Microsoft Windows
The short answer is that this problem is not hard to solve. This report is for the benefit of anyone curious enough to try and replicate our scheme.

The minimal configuration

For this report we successfully installed and ran the Quake 3 client on a 1.3GHz P4 Dell Dimension 8100 and a 1.6GHz P4 Compaq Evo500.

Our software configuration was:
Our hardware configuration was:

Installation

We'll assume you're already starting with a clean, working FreeBSD 4.8 system with X11 (
at least the XFree86-4.3.0,1 package) and your favourite window manager. The following steps are now required:
It all sounds so simple, doesn't it?  (If you don't yet have XFree86-4.3.0,1 and/or linux_base-7.1_2 installed, see Appendix A and then come back. You can check what packages you have already installed with 'pkg_info' command.)

Installing the nVidia drivers

Log in as root.

Grab NVIDIA-FreeBSD-x86-1.0-4365.tar.gz
for the latest drivers (as of July 1st 2003,  nVidia host their FreeBSD driver archive here). Their README file contains the list of appropriate steps, and we found their instructions worked just fine. In our case, simply:

 tar xfz
NVIDIA-FreeBSD-x86-1.0-4365.tar.gz

creates a sub-directory called
NVIDIA-FreeBSD-x86-1.0-4365. While logged in as root, go into this directory and run 'make setup'. Magic will happen, and the nvidia driver will be automatically loaded into the running kernel if all goes well.

At this point your system should now have a collection of nVidia-specific FreeBSD (under /usr/X11R6/lib) and Linux compatible (under /compat/linux/usr/lib) dynamic libraries for OpenGL support.

In principle you should not need to reboot the machine at this stage. Run "XFree86 -configure" as root to force the X server to poll the available hardware with the new nvidia driver. (Don't try this from inside a running X11 session, the system may get quite unhappy. Quit back to console first.) If all goes well, an updated XF86Config file will now exist under /root/XF86Config.new.

The only part of interest in
/root/XF86Config.new is the new 'Section "device"' section, which should look something like this:

Section "Device"
        ## <...bunch of commented out lines...>
        Identifier  "Card0"
        Driver      "nvidia"
        VendorName  "nVidia Corporation"
        BoardName   "NV11 [GeForce2 MX/MX 400]"
        BusID       "PCI:1:0:0"
EndSection


This section should be copied over into your existing /etc/X11/XF86Config file and replace the pre-existing 'Section "device"' section. (The pre-existing device section would have referred to the XFree86 package's generic "nv" driver, which provided non-accelerated support for nVidia cards.)

Rebuilding the kernel

If you're running FreeBSD 4.8-RELEASE from the CDROM you'll need to rebuild the kernel and reboot the machine once. Primarily this is to ensure the USER_LDT functionality is compiled into the kernel. While you're doing this, remember to enable sound support (if you haven't done this already) and optionally apply the kernel patch that nVidia supply to fix some problems with KDE apps crashing on exit.

Optionally skipping this step: If you already have USER_LDT and sound support compiled in (e.g. you've been playing CDs and using the 'wine' Windows compatibility package) and you don't care about KDE programs crashing you could simply skip this step entirely. (According to the nVidia README, all -CURRENT kernels already have USER_LDT enabled and recent -CURRENT kernels do not need the KDE-crash patch. Skip this step if you have such kernel with sound support enabled.)

Assuming you're rebuilding the kernel we might as well do everything all at the same time.

First apply the nVidia patch:

    cd /usr/src/sys/i386/i386/
    patch -p0 -i /usr/X11R6/share/doc/NVIDIA/machdep.c.diff

Now modify the kernel configuration file:

    cd /sys/i386/conf
    cp GENERIC NEWGENERIC    (or pick another name of your liking)

Add the following two lines to the end of NEWGENERIC:

    options USER_LDT    (mandatory)
    device pcm          (for sound support if you don't already have it)


Rebuild the kernel:

    config NEWGENERIC
    cd .
./../compile/NEWGENERIC
    make depend && make && make install

Reboot.

Startup X11 and make sure everything's good.

Having updated your /etc/X11/XF86Config file appropriately you should now be able to just start X11 as you used to do. You may see the screen flicker a little as the nvidia driver initializes and you should also see an "nVidia" splash screen briefly appear before your window manager takes over.

Run "glxinfo" after X11 has started. Look for the line "direct rendering: Yes" up near the top. If this line says "No" then there's something wrong and you haven't got hardware assisted OpenGL support. Recheck the previous steps, and look into /var/log/XFree86.0.log to see whether the nvidia driver even started up properly.


Before attempting to play Quake 3 you should make sure that 640x480 graphics mode is one of the options listed in the 'Section "Screen"' section of your /etc/X11/XF86Config file. We successfully used the following sub-entry:

        SubSection "Display"
                Depth     16
                Modes   "1280x1024"
                Modes   "1024x768"
                Modes   "800x600"
                Modes   "640x480"
        EndSubSection


This entry causes X11 to start in 1280x1024 mode (for regular work), but allows Quake 3 to auto-resize the screen to anyone of the listed resolutions if you choose to select them in-game.

Installing Quake 3

First up, you do not need to be logged in as root to run Quake 3. There is only one point at which being root is necessary during installation, and that is to temporarily mount the CDROM while copying off a single file.

In our case we had the commercial Windows version of Quake 3 on CDROM, so the first step was to install the latest Linux patch release before extracting anything from the CDROM.

The latest patch release is version 1.32b, available as linuxq3apoint-1.32b.x86.run from idSoftware's ftp site (and no doubt all the usual games file sites). This
includes the actual Linux client binary and most of the necessary support files. [Do not try version 1.32 (it has a bug that conflicts with the nVidia drivers and flat out won't work), and earlier versions 1.31, 1.30, etc have their own quirks - see Appendix B - and probably wont be compatible with many online servers anyway.]

Log in as a non-root user, start your X11 session, and execute the following to launch the graphical installer.

    chmod 555 ./linuxq3apoint-1.32b.x86.run
    ./linuxq3apoint-1.32b.x86.run

The installer will pick two default directories - the "Install Path" and "Link Path". The install path is where the Quake 3 executable, config files and pak files will be stored. The link path is where a shell script called 'quake3' will be created that will start the Quake 3 client appropriately when called. The link path should be a directory in your current PATH. (If the installer picks directories you cannot write to, just choose another directory - e.g. when logged in as user 'user' we might specify /home/user/quake3 for the executables and data files, and /home/user/bin for the link path.)


Assuming you installed the 1.32b patch release into /home/user/quake3, you should now have some executables under /home/user/quake3 and a set of .pk3 ("pak") files under
/home/user/quake3/baseq3.

Now insert the Quake 3 CDROM into your primary drive and temporarily switch to the 'root' account. Mount the CD on /cdrom, copy over the missing pak0.pk3 file, change its ownership, unmount the CD and quit back to your regular user account. With a default FreeBSD 4.8 installation you would execute:

    mount /cdrom

    cp /cdrom/Quake3/baseq3/pak0.pk3  /home/user/quake3/baseq3/
    chown user:user
/home/user/quake3/baseq3/pak0.pk3
    umount /cdrom

(e.g. Use <ctrl><alt><F2> to select another console, run the commands above, logout, then
<ctrl><alt><F9> to return to X11.)

The pak0.pk3 file is 457MB so copying might take a minute or two.

Voila! You should now have a functioning Quake 3 client. Try executing:

    /home/user/quake3/quake3

or just

    quake3  (if /home/user/bin is in your shell's PATH)

Quake 3 will auto-select fullscreen 640x480 graphics mode and begin with the usual intro graphics. For some strange reason, when it prompts you for the CD Key you can simply hit "accept" without entering anything and the client will happily continue to play. Go figure. Enjoy!

Testing & Sound

The preceding configuration has successfully been used in Single Player and Multiplayer(Internet) game modes. The 2.6Beta version of the Urban Terror mod has also been tested (briefly) and seems to work okay.

Sound worked fine straight out of the box on both machines tested (<AudioPCI ES1371-B> on the Dell Dimension 8100 and <Intel 82801BA (ICH2)> on the Compaq Evo500, both supported by the pcm driver in the kernel).

[However, note that KDE has a sound manager that grabs the sound card for configurable periods of time. If you happen to start Quake 3 before the KDE sound manager has released the sound card, you'll get Quake 3 with no sound. Configure KDE to release the sound card fairly quickly after each use, and you should be fine. This probably applies to other window managers and scenarios where multiple apps may try to grab the sound card.]

The frame rates are, subjectively, excellent in 640x480 and 800x600 mode. Even looked good in 1280x1024 mode, but might not have been competitive. There's no reason to re-boot into Microsoft Windows to play Quake 3 anymore.


Appendix A. Installing XFree86-4.3.0,1 and/or linux_base-7.1_2

Most desktop FreeBSD 4.8 installations will have XFree86-4.3.0,1 and linux_base-7.1_2 installed already. If not then you will need to install them before proceeding with the rest of this configuration. Fortunately installation is relatively easy with FreeBSD's package management system.

Log in as root.

If you have a really good connection to the Internet, and no local copy of the FreeBSD 4.8 CDROM, try the following:

    pkg_add -r
linux_base-7.1_2
    pkg_add -r
XFree86-4.3.0,1

This will pull the binary packages down over your network link and install them (and dependent packages). It can take quite some time.

A better solution is to
add the packages directly from a local copy of the FreeBSD 4.8 CDROM (Disk1). If you have only just installed XFree86 you probably don't have a window manager either. We used KDE with success here. The following commands will install the Linux compatibility support files, XFree86 and KDE.

    mount /cdrom
    cd /cdrom/packages/All
    pkg_add linux_base-7.1_2
    pkg_add
XFree86-4.3.0,1
    pkg_add kde-3.1
    cd /root    (you will not be able to unmount the cdrom without this step)
    umount /cdrom

This approach will generally be much faster than installing over the net.

Appendix B. Library quirks

The nVidia driver package installs libraries for regular FreeBSD applications and Linux binaries running under FreeBSD's compatibility mode.

FreeBSD will cause the Linux Quake 3 binary to look for linux-compatible dynamic libraries under /compat/linux/usr/lib. One thing to keep in mind if you chose to run an earlier (1.31 or 1.30) patch release of Quake 3 is that their binaries insisted on looking for
/compat/linux/usr/lib/libGL.so while the nVidia installer only installs /compat/linux/usr/lib/libGL.so.1. These older clients will barf, and confusingly complain about not being able to find libGL.so in /etc/ld.so.conf. If you insist on running an earlier patch release of Quake 3 there are two solutions:
Patch release 1.32b (recommended above) avoids this by actually looking for /compat/linux/usr/lib/libGL.so.1


Last Updated: Monday 5-Jan-2004 17:17:11 EST | Maintained by: Grenville Armitage (garmitage@swin.edu.au) | Authorised by: Grenville Armitage (garmitage@swin.edu.au)