Skip to content

Instantly share code, notes, and snippets.

@Uradamus
Last active April 12, 2022 01:55
Show Gist options
  • Save Uradamus/4bd96eb82596ae438a28 to your computer and use it in GitHub Desktop.
Save Uradamus/4bd96eb82596ae438a28 to your computer and use it in GitHub Desktop.
Some notes on getting the native version of NWN installed on Linux.

This uses the version available through GOG.com. Thanks go to TheCycoONE from the Arch Linux and GOG communities who's AUR package and forums posts were instrumental in my discovering how to finally install the GOG version of Neverwinter Nights on Linux.

First step is to ensure you have the necessary dependencies and utilities installed:

  • elfutils
  • glu
  • ia-32-libs (only if you are on a 64bit distro)
  • innoextract
  • libgl
  • libstdc++5
  • libxcursor
  • openal (for bink, see below)
  • perl
  • sdl_mixer

You will also need binkplayer from RAD Game Tools: http://www.radgametools.com/down/Bink/BinkLinuxPlayer.7z

Second, you need to gather the necessary game files.

From GOG download the Windows Installer (parts 1-3) as well as the premium modules re-installer. They will show up as the following files:

  • setup_nwn_diamond_2.0.0.15.exe
  • setup_nwn_diamond_2.0.0.15-1.bin
  • setup_nwn_diamond_2.0.0.15-2.bin
  • nvn_KingmakerSetup.zip

The setup files are not normal installers and we don't want to have to do a Windows install first anyhow so we will use innoextract in a bit to rip everything from the setup files.

Before we do that, first download the rest of the necessary files for updating and fixing the game as well as converting it for use on Linux: http://files.bioware.com/neverwinternights/updates/linux/169/English_linuxclient169_xp2.tar.gz https://github.com/nwnlinux/nwlogger https://github.com/nwnlinux/nwmouse https://github.com/nwnlinux/nwmovies https://github.com/nwnlinux/nwuser http://nwdownloads.bioware.com/neverwinternights/linux/161/nwclienthotu.tar.gz http://nwdownloads.bioware.com/neverwinternights/linux/gold/nwclientgold.tar.gz

If you were unable to find a package of Innoextract for your distro, grab a copy from: http://constexpr.org/innoextract/

Go to the directory where you saved the GOG installer files and use the following command:

innoextract -e setup_nwn_diamond_2.0.0.15.exe

This will dump the installer contents to a new subdirectory called ./app, we will be moving the essential bits from here to wherever we want the game to be installed, for now I will just use ~/nwn, but you can use where ever you like.

Move into the app subdirectory and run the following command:

mv -t ~/nwn ambient data dmvault hak localvault modules music nwm texturepacks chitin.key dialog.tlk xp1.key xp2.key

You'll also want to mv your gog key to your home dir for easy access with the following:

mv nwncdkey.ini ~/gognwnkey.ini

You will need the key from this file when you first run the game and you will need to write them down as it seems it won't allow you to alt-tab out or copy-paste the keys. You also need all 3 keys from that file and to enter them in order.

Once you've copied all the above files to the install folder, you can now delete whatever is remaining of the app directory and the temp directory that was also created during the extraction prcess to clean things up.

Next you unpack the Linux patch files into your install directory in the following order (allow any overwrites needed):

  • nwclientgold.tar.gz
  • nwclienthotu.tar.gz
  • English_linuxclient169_xp2.tar.gz

You can now move/unpack the unofficial community patches into your install directory and run the following scripts:

./nwmouse_install.pl
./nwlogger.pl
./nwmovie_install.pl

If you run into any errors with these installers involving user.h, you will need to go into the specified script and change the line #include <linux/user.h> to #include <sys/user.h>

Finally you want to copy the following into a new shell script named nwn.sh, or whatever you prefer, this will be your launcher script:

#!/bin/sh 

# Create user directory if it doesn't exist 
if [ ! -d "$HOME/.nwn/" ]; then 
mkdir $HOME/.nwn/ 
fi 

# Change the cd path here if you installed to somewhere else
cd "~/nwn" 

# Uncomment to make SDL Sound work on Software Mixers 
#export SDL_AUDIODRIVER=esd 
export SDL_MOUSE_RELATIVE=0 
export SDL_VIDEO_X11_DGAMOUSE=0 

# Hardware Mouse Cursor 
export XCURSOR_PATH=/opt/nwn 
export XCURSOR_THEME=nwmouse 

# Enable AA on NVidia cards (/usr/share/doc/NVIDIA_GLX-1.0/README.txt) 
# 3 = 1.5 x 1.5 super sampling 
# 4 = 2x2 super sampling 
export __GL_FSAA_MODE=4 

# Add Miles Sound Codec to Library Path 
export LD_LIBRARY_PATH=./miles:$LD_LIBRARY_PATH 

# Per-User Settings Support, Hardware Mouse Cursor Support, Linux Movies Support, Client Side Chat Logging Support 
export LD_PRELOAD=./nwuser.so:./nwuser64.so:./nwmouse.so:./nwmovies.so:./nwlogger.so 

# Run Neverwinter Nights 
./nwmain $* 

exit $? 

Now you should be ready to run the game; just launch it using your nwn.sh script and hopefully everything works as expected. I hope this has been some use to some of you out there. Have fun with your fresh install of Neverwinter Nights on Linux!

Note - I didn't get around to messing with the Kingmaker module installer, so you might have to do a bit extra to get that going. I would imagine it needs you to run the installer with Wine to get the files dumped somewhere and then move them into your install directory, but I will leave that to you to figure out if you are interested in it.

@EternalDeiwos
Copy link

Hey,
So I've been following your guide, got up to the point where the game is running but it isn't creating a window to be displayed in.
The only error in my debugging output is that the preloading of nwuser64.so is failing with wrong ELF class: ELFCLASS64, the rest is all normal looking output. AFAIK the nwuser library built without errors.

Ever seen something like this before?
and would you have an idea on how to go about fixing it. My experience with XWindows is neglible.

@arenaq
Copy link

arenaq commented Aug 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment