Return to Castle Wolfenstein on GNU/Linux

Homer's picture

Like most iD titles, RTCW was ultimately released under the GPL, and is thus available as a GNU/Linux native game. Installing it under Gentoo is as simple as "emerge games-fps/rtcw", but unfortunately the game itself no longer works in modern GNU/Linux systems. This is only to be expected with proprietary software that becomes abandoned, and would affect the operation of that software on any OS, but naturally it doesn't have to be that way with Free Software, which can be revived at any time, even years later.

Currently there are several issues with iD Software's (now old) binary release, including a "ui/menddef.h not found" error, an inability to launch without a pre-existing "default.cfg" (and an inability to create an initial copy), a problem setting the correct video mode, an inability to accept keyboard input, broken support for SDL audio (which falls back to the now typically non-existant /dev/dsp device), a stack overflow condition triggered by large OpenGL extension strings (fixed by setting the variable "__GL_ExtensionStringVersion" to a lower number, typically 17700), and finally the source is not yet 64-bit ready.

The latest development of RTCW is bzzwolfsp [ed: the project is now called rtcwcoop], a "modification of the RTCW single player source code that brings you Cooperative gameplay", however I've had no luck getting it to work (the same "ui/menddef.h not found" error, and a "black screen of death" on the menu). It also seems to be only a coop game that offers no single player mode [ed: confirmed], and simply ignores the original pak3 files. Needless to say it's still a WIP.

Edit: 18th May 2013. You can safely ignore everything below (except the config information), and just fetch the fully patched and 64-bit-ready sources from here instead. This also fixes the cinematic cut-scene problem.

But then I discovered this thread on the Arch Linux forum.

Following the simple instructions on that forum, I was able to build a fully-functional version of RTCW, and play the original single-player mode.

Get the sources here (see post #7 in the above thread for a list of build dependencies):

hg clone http://hg.ioquake.org/rtcw-sp # hg = Mercurial
cd rtcw-sp
wget http://slated.org/files/rtcw-1.41.patch
cd src
mkdir sdl && cd sdl
wget https://raw.github.com/cbxbiker61/wolfsp/master/src/sdl/sdl_snd.c
wget http://slated.org/files/sdl_snd.c.patch
patch -p0 <sdl_snd.c.patch
cd ../..
patch -p1 <rtcw-1.41.patch

git clone https://github.com/hexameron/RTCW-SP-linux
cd RTCW-SP-linux/src
CFLAGS="-march=i686 -O2 -pipe -fomit-frame-pointer" # edit to taste, supports 64bit too
sed -i "s/\$BASE_CFLAGS = \$COMMON_CFLAGS . '-D.*$/\$BASE_CFLAGS = \$COMMON_CFLAGS . '-DNDEBUG $CFLAGS ';/" unix/Construct
make
mkdir -p ~/RTCW/main/
cp unix/release-x86-Linux/out/wolfsp.exe ~/RTCW/wolfsp
cp unix/release-x86-Linux/out/main/* ~/RTCW/main/
cd ~/RTCW
strip --strip-unneeded wolfsp

You'll need to copy all your *.pak3 files over to the ./main directory (e.g. from the demo files or Wine install from CD) then run:

./wolfsp

This will create and populate the ~/.wolf directory with configuration files, then start the game in the default (low, 4:3) resolution. For those with an HD display, you'll need to exit the game then do the following:

echo "seta r_mode \"-1\"" >>~/.wolf/main/wolfconfig.cfg
sed -i 's/seta r_customwidth.*$/seta r_customwidth "1920"/' ~/.wolf/main/wolfconfig.cfg
sed -i 's/seta r_customheight.*$/seta r_customheight "1080"/' ~/.wolf/main/wolfconfig.cfg

Getting cheats to work is a bit convoluted, but it works if you do the following:

echo "set sv_cheats 1" >> ~/.wolf/main/user.cfg
./wolfsp.x86 +set sv_cheats 1

Start a new game, open the in-game console with the "`" (backtick) key, and type:

/sv_cheats 1

You'll get an error about sv_cheat being read-only. Ignore that, save the game, then quit. Launch RTCW again using the same flags as before, load the saved game, open the in-game console then type:

/god
/give all

Enjoy.

Comments

Anony Mouse's picture

error in compilation

After lot of apt-get installing libs, I get this error and now I don't know how to proceed:

[...]
/usr/bin/ld: /usr/lib64/libSDL.a(SDL_syssem.o): undefined reference to symbol 'sem_getvalue@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
cons: *** [release-x86-Linux/full/unix/wolfsp.exe] Error 1
cons: errors constructing release-x86-Linux/full/unix/wolfsp.exe
-----------------

Any idea? Thanks :-)

Anony Mouse's picture

Awesome.

Thank you for this -- I was ready to resort to WINE.

Worked perfectly on Fedora 18 (x86_64). Needed to install several libraries during the "./cons -- release" step, but elsewise went without a hitch -- and with the side effect (thanks to the SDL patch) of SOUND working (which is awesome).

Good article.

Anony Mouse's picture

Worked perfectly?

$ ./cons -- release
Wolfenstein version 1.41
cpu : x86
OS : Linux
configured for release build
CFLAGS: -pipe -fsigned-char -DNDEBUG -O3 -ffast-math -fno-strict-aliasing -fstrength-reduce
gcc -pipe -fsigned-char -DNDEBUG -O3 -ffast-math -fno-strict-aliasing -fstrength-reduce -c release-x86-Linux/full/jpeg-6/jerror.c -o release-x86-Linux/full/jpeg-6/jerror.o
In file included from release-x86-Linux/full/jpeg-6/../renderer/tr_local.h:37:0,
from release-x86-Linux/full/jpeg-6/jerror.c:22:
release-x86-Linux/full/jpeg-6/../renderer/qgl.h:57:19: fatal error: GL/gl.h: No such file or directory
compilation terminated.
cons: *** [release-x86-Linux/full/jpeg-6/jerror.o] Error 1
cons: errors constructing release-x86-Linux/full/jpeg-6/jerror.o
$

Homer's picture

Missing build dependencies

Sorry for my late reply. You've probably already figured this out for yourself, but just in case you haven't:

The error "fatal error: GL/gl.h: No such file or directory" tells you the development header file "gl.h" is missing. This is a component of the OpenGL project called MESA, typically called "mesa-dev" or "mesa-devel", depending on your distro.

On Debian and all its derivatives (such as Ubuntu and Mint) I believe the package containing "gl.h" is called "mesa-common-dev". On Gentoo it's simply part of the main "media-libs/mesa" package. On Fedora and other Red Hat derivatives it's called "mesa-libGL-devel".

Hope that helps.

Anony Mouse's picture

thanks for this

After a fk.... lot of lib upgrades working great on Mint 15 Cinnamon

Thanks

am a nubie on Linux and everyday like it more.

Thx again