1. Get WeiDU, and make it easily available on the PATH variable

This step is done only once, and is useful "forever" (as long you don’t need to reinstall the OS or upgrade to a new WeiDU version).

Almost all mods available are implemented using a tool called WeiDU. This is a program specifically made for the Infinity Engine, and mods are created using a programming language implemented by WeiDU. So you need to download it as it’s not normally available packaged by distributions.

You need to download WeiDU, extract the contents of the compressed archive, and use the different programs that come with it (e.g. weinstall). Since those are run on the terminal and are not standard programs, either you type very long lines, or make something to call them with less typing. We’ll do the latter by setting the PATH environment variable. This is optional, but recommended, and this guide assumes you did it.

Personally, I like to have all the custom programs that I download or compile myself in a directory named $HOME/local (which replicates the purpose of /usr/local or /opt, but without requiring root permissions, and only accessible to my user). You do you. That directory doesn’t exist by default, so you’ll have to create it if you want to follow the guide by copying and pasting without changing anything.

$HOME is a variable that expands to the directory where you have your personal data when you copy it on a console. That will be /home/your-user-name, but $HOME works better for copying and pasting, as it will work on your computer and mine. So $HOME/local is just /home/alex/local on my computer. I’ll mostly use ~ from now on instead of $HOME, which exactly the same, just shorter.

Now download WeiDU from the releases page on Github and extract the compressed file somewhere. At the time of writing this guide, the download is a ZIP package which will extract a directory named WeiDU-Linux with several files in it. You can move and rename the directory with a graphical file manager to wherever you please, or use the console. For simplicity, I will assume that you move the directory to $HOME/local, like I normally do. Every other directory works, but if you use another, you will need to adjust after copying and pasting the instructions.

After you have extracted and moved, check that the programs work by running:

~/local/WeiDU-Linux/weidu --help

If it prints the help, it’s working.

To avoid having to type the long path each time, you can do the following:

export PATH=~/local/WeiDU-Linux:$PATH

Now try:

weidu --help

It should produce the same output as before. If you want to make the setting permanent (setting the path), you can add that export line to your settings. Typically this will be adding that very line to somewhere in your ~/.bashrc file.

Now you are ready to install ciopfs. It’s available packaged in many linux distributions, so it’s way easier than getting WeiDU.

2. Prepare the game

First, locate the directory where you installed the game that you want to mod. GOG installers will suggest you to install to somewhere like "GOG Games". If you are not sure, use your file manager to search for a file named "chitin.key" (all Infinity Engine games have one). Save well the location for later, and note that this guide uses ~/local/GOG/Baldurs Gate Enhanced Edition/ as an example.

Now we need to move the game to a case insensitive directory, because WeiDU and/or some of the mods just don’t work well on anything which isn’t Windows (where the file system is already case insensitive).

This is done in this steps:

  1. Rename away the game directory, untouched.

  2. Create two empty directories.

  3. Run ciopfs.

  4. Copy the contents of the untouched game to the case insensitive directory.

Start by moving away the regular game directory. We are not going to modify the original contents of the game, but we are going to rename the directory. If you are paranoid, make a backup of it before doing anything.

Note well the first cd command! All the instructions afterwards won’t work if you don’t do it as the first step.
cd "~/local/GOG/Baldurs Gate Enhanced Edition/"
mv game game.original

Create a directory that will contain the data that we don’t need to look at (if we don’t want to). It will contain roughly the same data as the case insensitive directory, but everything will be in lowercase. The real case information is saved in extended attributes named "user.filename", but we really don’t have to bother looking.

mkdir ci-data-game

Make another empty directory, that this time will contain the case insensitive fake file system.

mkdir game

Run ciopfs, which will do the magic of the case insensitive file system:

ciopfs ci-data-game game

Now copy the files from the original unmodified game:

cp -r game.original/* game

Test that it worked by starting the game in the ciopfs mounted directory.

cd game

Now we have not modded yet anything, but the game should be running fine on the case insensitive file system, which the next steps require.

If you want to mod BG1EE with Siege of Dragonspear installed from GOG or Steam, you’ll need to use a tool called modmerge, or alternatively, make sure that the first mod that you install is DLC Merger. Both will do the same so it’s your choice (but the latter is a maintained project, so I recommend it). They will unpack the contents of Siege of Dragonspear and merge them with the rest of Baldur’s Gate EE so modding tools will apply changes to both. That’s it.

3. Install one mod

Copy mod directory (extracted from a downloaded ZIP file), and install mod.

cp -r /tmp/cdtweaks/ .
# Remember to set the PATH to weinstall, or use a full path to it
export PATH=~/local/WeiDU-Linux:$PATH
weinstall cdtweaks/

Repeat for all the mods that you want to install.

That’s it!

4. To recap

# Move away the standard game directory
cd ~/local/GOG/Baldurs Gate Enhanced Edition/
mv game game.original
# Create the dir that will contain the actual data, which will contain additional
# case information in extended attributes ("user.filename")
mkdir ci-data-game/
# Recreate the game directory, and mount the empty data directory to it.
mkdir game
ciopfs ci-data-game/ game
# Copy the original game files. The case will be stored in the extended
# attributes.
cp -r game.original/* game
# Test that it worked by starting the game in the ciopfs mounted directory
cd game
# Use modmerge or dlcmerger to prepare for modding (if SoD)
# Copy mod directory (extracted from a downloaded ZIP file), and install mod.
cp -r /tmp/cdtweaks/ .
export PATH=$HOME/local/WeiDU-Linux:$PATH
weinstall cdtweaks/

5. Bonus tip: auto mount the file system when starting the game

The installer from GOG creates a script named start.sh, which gets invoked from the .desktop entry installed in $HOME/.local/share/applications. I just modify the script adding this:

if [ ! -f $CURRENT_DIR/game/chitin.key ] ; then
    ciopfs $CURRENT_DIR/ci-data-game $CURRENT_DIR/game
execute_game "${bin32_name}" "${bin64_name}" "${bin_path32}" "${bin_path64}" "${lib_path32}" "${lib_path64}"

I just add those 3 lines before the execute_game one, and those will just mount the ciopfs file system when I start the game.