Playing Morrowind on GNU/Linux

Posted: | Updated:

UPDATE: I've since published the build-openmw script, which is tool to help compile OpenMW with various options (written in Python). Check that out for an updated way to go!

EDIT: Thanks to an awesome community, Void Linux now has packages for Unshield and MyGUI - so those steps can be omitted from your build process... Now back to dancing close to the fire!

The Elder Scrolls III: Morrowind is my favorite video game of all time. I generally favor games that are a bit older (the SNES-PS1 eras were golden ages for this), but Morrowind sticks with me even 15 years after its release. And while several pre-packaged modded Morrowind experiences exist for Windows, I submit that the best way to enjoy Morrowind today is on GNU/Linux using OpenMW. While not every single feature that is available for modded vanilla Morrowind works in OpenMW (yet), the list of what works is growing with each release - and what does work now is enough to satisfy a newcomer or a seasoned player like myself.

In this entry I'll discuss what is needed to run Morrowind via OpenMW, and how to get it -- but also in a way that's reproducible and mostly independent of your distribution. I'm not going to go into too much detail about mods (maybe in a part 2 perhaps) but I will go over some general recommendations. Let's go, outlander!

The game

There are several options for purchasing Morrowind nowadays, I strongly recommend the copy that's available over at gog.com for obvious reasons. Install the game with wine, no $WINEPREFIX is really needed since we just need to grab a few files from the install:

$ wine setup_tes_morrowind_goty_2.0.0.7.exe /nogui

The /nogui option that I'm passing to the installer makes it fall back to a basic windows installer GUI, versus the fancy GOG installer.

The OpenMW Runtime

I'm dubbing the package I've put together the "OpenMW Runtime" becuase it includes OpenMW as well as five other libraries that it depends on. If you aren't familiar with OpenMW, this might sound pretty crazy -- build five dependecies just to run it?! Surely there are packages available, right? Sort of. In my case, on Void Linux, there were missing packages as well as "wrong" versions of packages:

Furthermore, the OpenMW project provides their own fork of OSG that is optimized specifically for the game -- we definitely want this!

If you aren't using Void, the situation isn't much better:

In the past I've tried to fill in the gaps of missing packages on Void by making my own MyGUI and Unshield packages, or when I used Debian I'd make my own debs, but all of that isn't really necessary just to install and play a game. This is where the "OpenMW Runtime" comes in; why worry about where to get all the right parts to play when you can indeed put them all together yourself!

Recipe for Magick

I've put together a shell script to do all the work (that's here) - the only bit that is distro-specific is the part where packages get installed. Below I'll go through each function one at a time, describing what it does and why it is needed. I use the prefix /opt/morrowind/$library-$version for each component of the runtime; this allows for easy updating of one or more component without mixing everything all together. Annoying issues with library paths that arise from doing it this way will be solved later.

Somewhat of a side note: I usually do builds like this in a virtual machine using a netinstall or similar media; this ensures that I'm working as close to a "clean" and/or minimalist environment as possible.

Build dependencies

This is the only part that varies from setup to setup, and right now I've only covered Debian Jessie and Void Linux (but adding support for more distributions should be as easy as finding out names of packages.) On Debian:

# apt install build-essential cmake git libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libbz2-dev libfreetype6-dev libgl1-mesa-dev libopenal-dev libqt4-dev libsdl2-dev nasm zlib1g-dev

On Void Linux:

# xbps-install boost-devel cmake freetype-devel gcc git libopenal-devel libtxc_dxtn libXt-devel make nasm ois-devel python-devel python3-devel qt-devel SDL2-devel zlib-devel

This will provide everything that is needed to build the entire OpenMW runtime.

FFmpeg

OpenMW depends on the older ffmpeg2 branch, which might be available on Debian and friends but definitely not in Void (which of course has the latest and greatest version.) Thankfully, compiling FFmpeg isn't too big of a deal:

$ git clone https://github.com/FFmpeg/FFmpeg.git
$ cd FFmpeg
$ git checkout n2.8.11  # The latest 2.x branch as of this writing
$ ./configure --prefix=/opt/morrowind/ffmpeg-2.8.11
$ make  # Use -j$cpu_count at your option
$ sudo make install

To elaborate:

  1. Clone down the source code.
  2. Check out the specific release that is needed.
  3. And the last three steps build and install the code to our specified prefix.

This will take a minute or two to compile, but it should be relatively quick on a modern system. One down, five to go!

OpenSceneGraph

On Void Linux, the issue with the OSG package is that it is linked against Qt5 and OpenMW wants Qt4. I would't expect this to be an issue on Debian and friends, but then that leaves the question about the OpenMW-specific OSG fork I mentioned earlier... so I decided to include it in the OpenMW Runtime. Problem solved! Not much different from what we did for FFmpeg, except it is built with cmake:

$ git clone https://github.com/OpenMW/osg.git osg-openmw
$ mkdir osg-openmw/build
$ cd osg-openmw/build
$ cmake -D CMAKE_INSTALL_PREFIX=/opt/morrowind/osg-openmw ..
$ make  # Again: use -j$cpu_count at your option
$ sudo make install

Again, an explanation:

  1. Clone down the source code.
  2. Create and cd into a build directory (this is a cmake-ism.)
  3. This time a specific release is not used; instead the latest and greatest is what we want.
  4. The last three steps again build and install the code to our specified prefix, but this time using the cmake-specific ways of doing them..

This one will take a bit to compile, even on a more powerful machine. Two down - four more!

Bullet

Oddly, as mentioned above, the Bullet package in Void Linux is a tad behind - too much so for OpenMW. I haven't used Debian in a while but last time I did they too had too old of a package. In it goes, to the OpenMW Runtime:

$ git clone https://github.com/bulletphysics/bullet3.git
$ mkdir bullet3/build
$ cd bullet3/build
$ git checkout 2.86.1  # The latest tagged release as of this writing
$ cmake -D CMAKE_INSTALL_PREFIX=/opt/morrowind/bullet3-2.86.1
        -D BUILD_CPU_DEMOS=false \
        -D BUILD_OPENGL3_DEMOS=false \
        -D BUILD_BULLET2_DEMOS=false \
        -D BUILD_UNIT_TESTS=false \
        ..
$ make  # Again: use -j$cpu_count at your option
$ sudo make install

A rundown:

  1. Clone down the source code.
  2. Create and cd into a build directory.
  3. Check out the latest tagged release.
  4. Again the build steps, again done in cmake-style, but this time several extra options are passed in to prevent building extra stuff like tests and demos that we do not need or want.

Bullet compiles pretty quickly, once it's complete that's three down and three to go!

Unshield

Most distributions probably have a package for Unshield, Void Linux does not. At any rate, it is a very small program and a quick breeze to build:

$ git clone https://github.com/twogood/unshield.git
$ mkdir unshield/build
$ cd unshield/build
$ git checkout 1.4.2  # The latest tagged release as of this writing
$ cmake -D CMAKE_INSTALL_PREFIX=/opt/morrowind/unshield-1.4.2 ..
$ make  # Use -j$cpu_count at your option
$ sudo make install

This should finish very quickly, four down -- two to go!

MyGUI

The last dependency to build for the OpenMW Runtime is MyGUI:

$ git clone https://github.com/MyGUI/mygui.git
$ mkdir mygui/build
$ cd mygui/build
$ git checkout 3.2.2  # The latest tagged release as of this writing
$ cmake -D CMAKE_INSTALL_PREFIX=${install_prefix}/mygui-${mygui_version} \
        -D MYGUI_RENDERSYSTEM=1 \
        -D MYGUI_BUILD_DEMOS=OFF \
        -D MYGUI_BUILD_TOOLS=OFF \
        -D MYGUI_BUILD_PLUGINS=OFF \
        ..
$ make  # Use -j$cpu_count at your option
$ sudo make install

This pattern should be familiar by now. Like Bullet, extra arguments are passed to cmake to ensure extraneous things are not built or included (such as Ogre support.) Once this is done, all that's left is OpenMW itself!

OpenMW

And now, the moment you've been waiting for - it is time to build OpenMW against our runtime:

$ git clone https://github.com/OpenMW/openmw.git
$ mkdir openmw/build
$ cd openmw/build
$ export openmw_short_sha=$(git rev-parse --short HEAD)
$ export CMAKE_PREFIX_PATH=/opt/morrowind/ffmpeg-${ffmpeg_version}:/opt/morrowind/osg-openmw:/opt/morrowind/unshield-${unshield_version}:/opt/morrowind/mygui-${mygui_version}:/opt/morrowind/bullet3-${bullet3_version}
$ export LDFLAGS="-lz -lbz2"
$ cmake -D CMAKE_INSTALL_PREFIX=/opt/morrowind/openmw-${openmw_short_sha} ..
$ make  # Use -j$cpu_count at your option
$ sudo make install

Again the familiar cmake pattern, but this time we have to tell it where to find the rest of our OpenMW Runtime libraries (the stuff we just built.) That's where setting and exporting CMAKE_PREFIX_PATH comes in, as well as the LDFLAGS.

How to play it

The last step before actually playing the game is to create a small shell script that serves as a wrapper, since LD_LIBRARY_PATH will need to be set in order to use any of it. Here's what I put at /opt/morrowind/run.sh:

#!/bin/sh

export LD_LIBRARY_PATH=$(realpath $(dirname ${0}))/unshield-1.4.2/lib64:$(realpath $(dirname ${0})/osg-openmw/lib64):$(realpath $(dirname ${0})/mygui-3.2.2/lib):$(realpath $(dirname ${0}))/bullet3-3.2.2/lib:$(realpath $(dirname ${0})/ffmpeg-2.8.11/lib)

if [ "${1}" = "--launcher" ]; then
    $(realpath $(dirname ${0}))/openmw-$openmw_short_sha/bin/openmw-launcher
else
    $(realpath $(dirname ${0}))/openmw-$openmw_short_sha/bin/openmw
fi

First set the LD_LIBRARY_PATH such that it can find the OpenMW Runtime, then check for a --launcher argument and run the launcher if it's there, otherwise just run the openmw binary.

For your first run, you should run the launcher and go through the installation wizard. There will be an option to find an existing install; all it really wants are the Morrowind.esa, Morrowind.bsa, and the related files for the two expansions. Point the wizard to the Morrowind.esa from your earlier wine install, then you should be ready to play!

Using mods

A big part of why I prefer to use OpenMW over "vanilla" Morrowind is how OpenMW allows you to specify multiple data sources. What that means is that you never have to overwrite any of the "vanilla" game files; your modded files can live alongside them in separate directpries and are read into the game as you would expect. Of course things like load order and whatnot still apply, but in general this system of multipe data directories makes using mods so much easier.

One caveat of this is that you must edit your local $HOME/.config/openmw/openmw.cfg file in order to configure it; it is already a decent-sized file, and it can grow quite large once you add a bunch of mods. That isn't really a caveat, and this actually makes it easy to include your OpenMW configuration in your dotfiles repo. Snap!

Conclusion

Compiling six programs to play a video game sounds extreme, but it isn't when you consider the impact of what has been described above. Using open systems and software, one can enjoy video games - even fancy ones. For an industry that is as typically closed as games this is pretty rad. Not only that, but you now have a way to enjoy a supremely awesome classic RPG on (hopefully) any GNU/Linux distribution.

All of the above comes out of a script I use for doing all of this automatically - you can find that here if you're so inclined to check it out. Perhaps in a future entry I will go into further detail about mods and all that jazz. Until then: wealth beyond measure, Outlander!

This page was last modified on: 2019-11-09