Sat 29 Dec 2007
5:00PM
compton

Compiling and Installing Freespace 2 on Ubuntu Linux

The first thing to do is install Freespace 2 under WINE (you will need WINE already installed and configured for this step). If you have the retail CDs, insert the first disk, browse to it in nautilus and double click the setup.exe file. As a Windows executable, it should start up using WINE. If you don't own the retail disks, read up on the open freespace wiki and forums for other methods of getting hold of the necessary data files for the game.

Proceed through the setup as if on Windows, but without the nagging feeling of nausea. I installed to the default location, although you may be able to install to another location. The only thing you may get stuck on is when it asks for the next disk - here you just need to put in the required disk, and change the path in the dialog accordingly (eg when you put in the 2nd disk, change the path from /media/cdrom/FREESPACE2_1/ to /media/cdrom/FREESPACE2_2/).

Once installed, you can try to run the retail .exe using WINE if you like, although I found the graphics to be a bit glitchy and there was no sound. In fact, it was while I was googling for info on these problems that I discovered that Freespace 2 had been made open source by its developers before they went bust, and that the community had gone and made a native Linux version of the game. The Open Source version even has a few improvements, as well as a handful of cool-looking mods and total conversions available. I thought I'd give it a try, and after a couple of teething troubles it now works perfectly.

The project wiki has a guide for the compilation and install process which I followed.

You need subversion:
sudo apt-get install version
and a bunch of development libraries (the following should be typed on a single line):
sudo apt-get install libopenal-dev libvorbis-dev build-essential automake1.9 autoconf libsdl-dev libtheora-dev liblua5.1-0-dev
Now create a folder in your home directory called src for source code. In that folder, checkout freespace 2 by issuing the following command:
svn checkout svn://svn.icculus.org/fs2open/trunk/fs2_open
This will create a folder off ~/src called fs2_open. Go into that directory, and run the autogen.sh file to set up your environment for compiling the game:
cd ~/src/fs2_open ./autogen.sh
It may take a minute or two to run. As long as you have all the required tools and libraries, the last line of its output should read Now type `make' to compile fs2_open. (Note that you only need to run this script the first time you checkout the project or if you want to change compiler flags, CFLAGS)

So go ahead and run the make command to begin compiling the source. As it does so, it will splurge out a lot of compilation info, including various C++ compile warnings. Once it's finished, you should have a directory in the fs2_open folder called code, within which lurks the newly-compiled Linux executable, fs2_open_r. We're nearly good to go.

Copy this executable to the Freespace 2 directory created by WINE when you installed the game off the CDs. If you've used the default locations for everything, run the following command:
cp ~/src/fs2_open/code/fs2_open_r ~/.wine/drive_c/Games/FreeSpace2
You should now be able to play the game by running this executable. There are a host of command line options you can specify for it, which enable certain effects and enhancements, so it's worth making a script in your home directory to start the game:
cd ~/.wine/drive_c/Games/FreeSpace2/ ./fs2_open_r -spec -env -glow -cell -mipmap -missile_lighting -dualscanlines -orbradar -ship_choice_3d -targetinfo -3dwarp -warp_flash -snd_preload -safeloading -mod mediavps_3612
Note that although we're running the FreeSpace executable from the WINE directory, it's running natively under Linux. You can of course move the whole folder to somewhere more sensible if you wish. The last argument specified, -mod mediavps_3612, tells FreeSpace to load all the mods it finds inside the mediavps_3612 subfolder. There's a whole range of mods from the Open FreeSpace Project that enhance graphics, sound, and more: see this forum thread for the full list – simply download the ones you're interested in and unzip them into the specified folder.

The game looks for a file called .openalrc in your home directory in order to set up audio. Having this file present fixes a lot of sound problems, such as stuttering sound or no sound at all. If you have any audio problems, first try creating it with the following contents:
(define devices '( alsa native )) (define speaker-num '( 2 ))
It's also necessary to change a config file to specify the screen resolution and colour depth you want freespace to use. First though, you need to run the game once (in the default 16-bit 640x480 resolution). You can exit straightaway, and there should now be a hidden folder off your home directory called .fs2_open, containing a file called fs2_open.ini, amongst other things. Open this file and change the line which reads VideocardFs2open=OGL -(640x480)x16 bit to the resolution you wish to use, eg VideocardFs2open=OGL -(1920x1080)x32 bit. Now start the game, and enjoy!

/xkcd/ Tick Marks