Using Tribes 2 with updated support libraries and native ALSA support on Linux

Back to home page...

The kind people at Loki shipped Tribes 2 with a dynamically linked binary as well as the standard statically linked binary. What this gives us is the ability to use the same old Tribes 2 client with updated libraries and new capabilities, such as stereo sound in the Linux version (hear sounds from your left speaker that are happening to the left of you, and vice versa).

The libraries you need

If you don't have libsmpeg on your system, install it first. On Debian this is currently the package libsmpeg0. Other packages you will need are libfreetype (Debian package libfreetype6) and libSDL (Debian package libsdl1.2debian-alsa). Other libraries are also required but they are standard on most systems.

Installing the old C++ library for compatibility

First, we need to set up an older version of the standard GNU C++ library, the one Tribes 2 was compiled against. Find the package for your distribution that contains libstdc++-3-libc6.2-2-2.10.0.so (on Debian this is the package libstdc++2.10-glibc2.2). If your distribution doesn't have this file packaged, you'll need to find a copy yourself and install it somewhere it can be found by the Tribes 2 dynamically linked executable, such as in the Tribes 2 directory (usually /usr/local/games/tribes2). Now, write the script that you'll use to launch Tribes 2 with from now on:
#!/bin/sh
export LD_PRELOAD="$LD_PRELOAD:/usr/lib/libstdc++-3-libc6.2-2-2.10.0.so"
cd /usr/local/games/tribes2
./tribes2.dynamic $* -online -login yourusername yourpassword
Replace the paths to the new C++ library and to your Tribes 2 installation with the correct paths for your system, and the yourusername and yourpassword with your Tribes 2 login info for easy access. The $* in the command line will allow you to pass command line options to tribes2.dynamic while still launching with the shell script.

Now that we are running the tribes2.dynamic binary, it will automatically load the latest version of all libraries it depends on, like libfreetype, libSDL and libsmpeg.

Installing an updated version of libopenal

Now, the standard Tribes 2 client ships with a prebuilt libopenal sound library, libopenal.so.0 in the Tribes 2 directory. We need to upgrade this to a later version that has certain extra functionality... like ALSA support. In order to build this, you need the libasound2 development files (in Debian you can use the package libasound2-dev. You can get the latest libopenal CVS with these commands:
cvs -d:pserver:guest@opensource.creative.com:/usr/local/cvs-repository login
cvs -d:pserver:guest@opensource.creative.com:/usr/local/cvs-repository co openal
When prompted for a password, type "guest". This will download the source into ./openal. Enter the openal/linux directory and run ./autogen.sh and ./configure --enable-alsa (ALSA support is disabled by default). Type make to build the new library. In the src directory you will find your new libopenal (libopenal.so.0.0.8 as of this writing). Copy this to /usr/local/games/tribes2 (or the appropriate path on your system), move the Tribes 2 libopenal.so.0 to libopenal.so.0.old, and run ln -s libopenal.so.0.0.8 libopenal.so.0 to create a dynamic link from the old filename to the new library.

Now that the new libopenal is installed, you need to configure it. Fortunately this is very easy: create a file named .openalrc in your home directory. In it, put the line:
( define devices '(alsa) )
There is a known bug with Tribes 2, OpenAL and ALSA that causes reverse stereo - the sound for the left speaker being played out the right speaker and vice versa. This bug is also present in UT2003. If this happens to you, you can work around it by adding the following line to your .openalrc (in addition to the line specified above):
( define alsa-device "pcm.swapped" )
and creating the matching device definition anywhere in your .asoundrc:
pcm.swapped {
  type route
  slave.pcm "hw:0"
  ttable.0.1 1
  ttable.1.0 1
}

All done

Now run the Tribes 2 client and enjoy your new built-in ALSA support. Any preexisting configuration in your ~/.asoundrc will be automatically loaded by libasound (the ALSA userspace library) each time you run Tribes 2.

Props to Terracon for pointing me in the right direction for all this info, and for lots of other Tribes 2 technical help over the years.

If the information in this page helped you, let me know by emailing me!

Back to home page...