Fallout 3 On Linux With Mods

Posted:

A while back, I did a post on playing Fallout New Vegas on Linux with DXVK. The goal with that was to play the game, but also mod it and do the entire process on Linux. Unfortunately, at the time it wasn't doable but I had hopes that with a little effort it would be. So has anything changed? Yes! But it is quite a long journey. Read on for the details.

Why Fallout 3?

You might be wondering "why is this guy writing about games", or "why is he writing about that game". Indeed if I'm going to choose favorites New Vegas wins by a huge margin. But there's something about the world of Fallout 3 that is irresistable. Not to mention seeing Washington D.C. in ruins is... an experience that's hard to describe. I can show it to you, but even then it's not quite the same as being "there", "in" that world.

Aside from all that: it's a really fun RPG by Bethesda Softworks and the modding community is still quite active. I should also note that playing Fallout 3 on its own, without mods, is a relatively trivial affair. The game works exceptionally well via Wine, so it's a good base to do something like modding on top of.

Why Linux?

Once again, I feel the need to clarify why I'd care to try and game on Linux. The long and short of it is: I don't want to use MS Windows. If I don't want to, and it's possible to not use it, why would I?

It comes down to personal preference; some folks might like using Linux, but they don't like the idea of doing extra work to play games. That's fair, because often times extra work will indeed be required to get things just right (more on that in a bit).

Why Mods?

Playing Fallout 3 on Linux without mods is a pretty simple process, and no special tricks are needed to get the game working. Install it, and run it. Even on Windows, using mods adds extra time and effort required to game, as well as complexity into the overall setup. So why bother with mods if it creates extra work?

Most mainstream games are released with bugs, and are possibly unfinished. Large amounts of content is cut from some games, and in others it is unseeable due to bugs. Normally, I'd provide a source for a claim like this, but it's less work for me and better for you the reader to do a quick search for "unfinished games" or "rushed games" and go from there. Fallout 3 is no exception. Same here as with the last footnote. I'd give proof but, well it is as they say in the pudding. Play enough of the stock game and you'll see what I mean. Additionally, this game had to run on a PS3, and unfortunately even the PC version shows the effects of this with restrained visuals.

Mods allow for not only fixing leftover bugs and performance issues, but also for upping the visual quality in ways that isn't just "add HD textures". It's possible to use only a few mods and vastly improve the game, and this is what I aim to do.

No Mods, No Managers

Of course I'm using mods as stated in the post title, but I will not be using any kind of mod manager software. I'm personally not a fan of any in existence (except Portmod), because they tend to cause more problems than they help with. I couldn't resist making the heading title sound like Choking Victim's "No Gods, No Managers", which itself is a spin on the old slogan "No Gods, No Masters". Please don't hate me for trying to be clever.

For instance: in my last adventure with trying to mod Fallout New Vegas, I struggled to get LODGen to work properly because it has no notion of the Mod Organizer 2 VFS. It's possible to make it work, but it requires more effort than just running the thing as designed.

That's just one anecdotal problem. Suffice it to say that although in my view skipping mod managers will cause you some extra work, in the end you'll have greater control over your setup, more stability, and an easier time working with external tools.

But if I'm not using a mod manager, how do I do it all correctly and keep my sanity?

My Machine

I'll just say a little bit about my general setup:

The Setup

I'm taking a cue from OpenMW's data paths system; this allows one to tell the engine to use multiple data paths, which is a godsend for mods. The idea (with OpenMW) is, I can configure (in a plain text cfg file) all the data paths I need, one for each mod, and the engine resolves them all and merges them into a VFS.

I won't be working with a VFS, but I'll be creating something like a VFS by hand. The high-level process will be like this:

  1. Install Fallout 3 GOTY from gog.com with Wine.
  2. Select the mods I want to use.
  3. Give them a rough, logical order and put each one into its own directory.
  4. Extract each mod into their own directory (the one you assigned in the previous step).
  5. Ensure all files are lowercase (more on this later).
  6. Create another directory for the merged content.
  7. One by one, and in order, copy the data files from each mod into your merged directory.
  8. Copy the complete merged directory over the base game data files.
  9. Run the Fallout 3 Launcher, enable all plugins.
  10. Run LOOT, sort plugins.
  11. Run LODGen, generate better/more LOD (distant stuff that is lower quality than the up close version).
  12. Work around problems with the game's MP3 files (used by the radio stations).
  13. Play the game!

I've glossed over a lot, so let's go into each point in detail!

Install Fallout 3

I've written WEM as a way to simplify interacting with Wine for complex game setups, and I'll be using WEM commands and configurations in this post.

With WEM, getting started looks something like this:

$ wem init fallout3 \
    --dxvk-version 1.8.1 \
    --fsync \
    --install-exe \$HOME/games/setup_fallout_3_1.7.0.3_(12034).exe \
    --install-expected "{{.WinePrefix}}/drive_c/game/Fallout3.exe" \
    --install-workdir \$HOME/games \
    --quiet-run \
    --run-exe 'C:\\game\\fose_loader.exe' \
    --run-workdir "{{.WinePrefix}}/drive_c/game" \
    --wine-exe \$HOME/.local/share/wem/proton/Proton-6.10-GE-1/files/bin/wine

Breaking this down: I'm defining a Wine "env" with specific options for DXVK, fsync/futex2, Proton, and various paths. The result is that future interactions with the env will involve little more than a wem run fallout3. Note that I've got the installer files in the $HOME/games directory.

With the env initialized, the install can now happen but we don't want to run the game just yet:

$ wem install fallout3

This will kick off the install process. Make sure the install directory is set to C:\game (this is a pattern I do for every Wine game install).

Selecting Mods

This is always subjective, but I prefer to go with a smaller mod list for these games (Fallout 3/New Vegas). When you consider they are notoriously buggy and crash-prone even on Windows, mods begin to sound risky when you're looking for a game that runs and doesn't crash. If/when these games are implemented for OpenMW, I wouldn't worry at all because that engine is free software and highly stable. In that case, feel free to run 300 mods and enjoy yourself!

As such, I prefer to keep my mod list relatively short and only add things that I think will really enhance the experience. As I said, this is subjective, but here's a rundown of what I'm using for this project (note that they are presented in the install order that I used):

One could take it a bit further, but for me personally this is a good amount of mods for various reasons:

As a reminder: I've installed these in the order that they are listed. I've done that in a scrappy, manual way; by creating numbered directories (e.g. 01-ModName and so on) and putting each mod into their own.

This is definitely an area for automation, but there's no capable software to properly do the job at this time.

4GB Patch

If you're familiar with the normal rituals of modding a Bethesda game, you may be wondering "why isn't he mentioning the 4GB patch?" - well, the GOG.com version of Fallout 3 ships with this applied so there's no need for me to use it. Thanks GOG.com!

Merged Patch

When you have a large number of plugins from mods, there's a good chance that two or more will modify the same object or record in the base game. In this case you'll want to use something like Wrye Bash (there's even a Fallout 3-specific variant) to created a merged patch that safely blends things.

It could be argued that even my relatively small loadout needs a merged patch, and while Wrye Bash works quite well on Linux via Wine (or with the "plain" python build), for now I'm skipping it.

If I wasn't skipping this, the installation and usage patterns would closely resemble the LODGen process (more on that in a bit); the Wrye Bash.exe executable lives next to the game executables and I run it with WEM. At present, there's a limitation with WEM's --exec option that causes executables with spaces in their names to not be ran correctly. The "fix" is to rename them to not have a space in the name, but the long-term approach will be to give WEM an --exec-args option.

Extracting Mods

Now that I've got mods downloaded and organized in numbered directories, it's time to extract them. I treat each mod directory as if it was the Fallout 3 game dir; that means most things go into a directory called Data in the root of the mod's specific directory. Only FOSE goes in the parent directory of Data, next to the game executables.

Lowercase Filenames

On Windows, of course, the filesystem is not case-sensitive. "Thing.esp" and "thing.esp" are the same file for all intents and purposes, whereas on most Linux systems they would be different files. Unless you've gone out of your way to have a case-insensitive filesystem, I think this will probably be an issue.

The approach I've taken is to create a small shell script that finds directories and files in a given path, and renames them to be fully lowercase. This could be pointed at the base directory contaning all your other mod directories and just have everything lowercased, plugins and all. Additionally, you'll want to lowercase the contents of the Fallout 3/Data directory.

There are a few important exceptions: you don't want to lowercase plugins such as bsa, esp, or esm files because of referencing issues. I imagine this wouldn't be an issue on Windows (or if your filesystem is not case-sensitive), but if plugin Foo.esp lists Bar.esm as its master, and you've got bar.esm, there will be a "missing masters" problem. So however you go about lowercasing, take care to not touch your plugins.

Merge Data Files

With everything extracted and lowercased, it's time to copy the data files into the merged directory. This is done in a specific order, so you'll always want to overwrite and replace existing files when prompted.

Install Mods

Finally, with all mods extracted and lowercased, and the stock game data lowercased, you're ready to paste the merged mod data on top of the the stock game data. There shouldn't be anything that's overwritten, most of the stock game files are packed into bsa archives.

Enable Plugins

Next up: run the FalloutLauncher.exe executable and click the "DATA FILES" option. You can do that with WEM like this:

$ wem run fallout3 --exec "{{.RunWorkDir}}/FalloutLauncher.exe"

This will bring up a menu that may render oddly, but all that's needed to be done is check the box next to each plugin. With that done, apply the changes and exit the launcher.

Sort Plugins With LOOT

As far as I know, LOOT is probably the best tool for sorting your plugin order for almost all Bethesda games. I recently became aware that LOOT now builds and runs on Linux, albeit with somewhat strict requirements.

The LOOT Linux build is somewhat huge, clocking in at around 1.2 GB with a 1.1 GB libcef.so file being the main offender. Anyways, it's for this reason that the LOOT team has decided not to ship Linux binaries, but it is possible to build one's self.

Building LOOT

Building LOOT for Linux is possible, but it's not trivial. It has more specific requirements than most things I'm used to dealing with, so to me it made sense to try and use a Docker container for building it. This repository is the result of that effort, the readme describes how working binaries can be produced as well as how to configure the thing (though, I'll go into detail about configuring below).

In the end, after some effort, I was able to fill a major gap in the Linux workflow for these games. I consider this a big victory, and look forward to poking around in the LOOT source.

Running LOOT

More than likely, you won't be able to just run ./LOOT and have it work. On my laptop with an Intel GPU, I had to add the --disable-gpu argument for LOOT to launch correctly. I myself have to run it as follows:

$ cd ~/games/loot-linux
$ LD_LIBRARY_PATH=. ./LOOT

Configuring LOOT

On Windows, when you run LOOT, it magically sees all your games and just works. You click some buttons, you're done. It's usually pretty easy and convenient.

On Linux, it's not nearly as straightforward but it's also not hard to figure out what's needed. When you first run LOOT, you'll be hit with the settings menu. On the lefthand side at the bottom, click "ADD NEW GAME" and fill in the values as follows:

Most of those should be self-explanatory, but one to note is the "Local Data Path", which is where the plugins.txt file which defines the game load order lives.

When you save your configuration, nothing will happen and you'll get an error when you try and select it from the profile menu at top-center. Close LOOT, re-run it, and you should be greeted with a recognized load order.

Sorting With LOOT

Click the download icon at the top right to update master lists, then the button just to the left of that to sort your plugins. You'll be asked to Apply with a button, so do that. The result should look something like this (the below image is just the base game files, and no mods):

Be sure to pay close attention to the notes LOOT gives for your plugins, it's possible there are errors you need to address. LOOT did tell me I was missing several NVSE mods that were dependencies of the unofficial patch, but I definitely have them.

Better LOD With LODGen

The default LOD of Fallout 3 is actually pretty sparce. It's easy to not notice it, but once you do it's hard to unsee. Thankfully LODGen makes it easy to fix that situation, even on Linux.

Install LODGen

LODGen should have been "installed" with the rest of the mod list above, the exe for it living alongside Fallout3.exe and friends.

Running LODGen

When LOOT sorted the load order, it probably disabled the LODGen plugin (FO3LODGen.esp). Manually add that to the plugins.txt file with a text editor before you run LODGen (for me, that lives at $WINEPREFIX/drive_c/users/steamuser/AppData/Local/Fallout3).

WEM makes it easy to run an arbitrary executable with the context of a specific Wine prefix, you can use it to run LODGen like this:

$ wem run fallout3 --exec "{{.RunWorkDir}}/FO3LODGen.exe"

This will launch a GUI that will crunch for a bit while it scans the plugins in your load order. When it's done you'll be prompted with options for generating the LOD.

I select all worldspaces, and I set atlas sizes to 4096x4096 since I'm using a lot of high resolution textures. Click OK to generate and let it work; it takes around ten minutes to finish for me.

Note that the first time I tried to generate LOD, LODGen.exe actually crashed. Against my better judgement I re-ran it with the same options and it worked. Indeed, sometimes LODGen will crash, but re-running it will usually be OK if that happens.

Once that completes, open up plugins.txt one more time and remove FO3LODGen.esp from the list.

Fixing Audio

Unfortunately, out of the box there seems to be an issue with the game's MP3 files for the radio tunes. The result is that tracks won't play at all, or they will play for a few seconds then cut off.

There is a way to make them work, but it involves converting the tracks with ffmpeg. I stumbled on this /r/wine_gaming post where someone kindly left a clue about how they resolved this. Here's how I did it (fish shell):

$ cd $WINEPREFIX/drive_c/game/Data/Sounds
$ for file in (find . -type f -iname "*.mp3");
    mv $file $file.orig.mp3; and ffmpeg -i $file.orig.mp3 -codec:a libmp3lame -b:a 64k $file;
end

This takes a bit to crunch, and if you aren't using the radio mod I linked above, you'll need to extract the MP3s from the game's related .bsa archive. OpenMW comes with the bsatool executable, which would make this an easy task. But when it's done, the radio tunes should play as expected.

Playing The Game

Now, we can finally play the game! The intro sequence is a bit of a bore, but once you embark out into the world all of this work will have been worth it. Run it with WEM like this:

$ wem run fallout3

Stability

You will experience crashes. In about ten hours, I had two or three crashes. As mentioned before, these games are known for instability on Windows, so you can't very well hope for more stability when playing on a totally different OS via a compatibility API. That being said, I'd say the stability is pretty good. I'm able to play the game for long sessions, and I don't need to be paranoid about crashes (even if they do happen from time to time).

A Theoretical Mod Manager

I'll take a moment to muse about a theoretical piece of software that'd automate the boring and tedious stuff as much as possible. A short list of features:

There're probably many other features you could tack in here. However feature bloat is part of why, in my opinion, other softwares in this category lack. They tend to do a lot, but none of it is done really all that well. Obligatory reference to The Law of Leaky Abstractions. A good mod manager should be useful, but not try to do everything. Portmod does quite a bit, aside from downloading mods in all cases it damn near does everything. So it is possible to have a lot of features, it's just not easy. Props to Ben Winger for his awesome software.

Conclusion

It seems that it is in fact possible to play Bethesda RPGs on Linux, even if there's no native release and I'm just using Wine. LOOT sorting plugins for me is what really makes this possible; I live without a mod manager by doing things by hand, but the load order sorting isn't something you want to be doing by hand. That, as well as Wine and DXVK of course.

If I wanted to play just the base game with no mods, the entire process would have looked like: install, run. The game is very buggy but not unenjoyable that way. Still, mods are needed to really smooth it over and make it an awesome experience. And in the end, the amount of time spent isn't a whole lot more than one would spend with Windows.

When you consider that future modifications should be easy since I've already got an organized directory scheme, as well as the fact that I can use WEM to simplify interacting with Wine, this was a worthy endeavor. I have a working game environment that should continue to work and is easily adjustable should the need arise. Additionally, the patterns I described should work for any Bethesda RPG from Oblivion to Skyrim.

Footnotes And References