PRC Server Pack Install

The server pack contains many useful utilities for running a server with the PRC. It is available as a Windows installer or a rar archive for manual installation. This covers manually installing the server pack and what to do with the components. While it is designed for a server running on Windows, the server pack is still useful for Linux servers because it contains the precacher.

The current version of the server pack is 1.7.

Why Do a Manual Install?

  • The Windows installer only works on a PC running Windows and that has NWN installed, so is no use for:
    • Other operating systems
    • PCs without NWN installed
    • The standalone server (it looks for registry entries the server doesn’t create)
  • It includes utilities you either don’t need or use already
  • It makes its own registry entries

Installing the Server Pack – File List

If you have a previous version of the server pack, uninstall that first. Download and unpack the rar file. It should contain the following:

  • NWNX 2.6.1
  • NWNX-ODBC 0.9.2.4
  • NWNX-Letoscript build 23 beta 4
  • NWNX-Profiler 1.60
  • SQLite 3.3.6
  • Precacher (prc.jar, erf.exe, batch files to run it)
  • NWNX for Linux 2.5.3rc1 (source plus precompiled binary)
  • NWNX-InvFixpl 1.0
  • documentation

Installing the Server Pack – NWNx

The server pack contains NWNx, various NWNx plugins and the NWNx documentation. Further information and the Linux binaries can be found on their site. To install NWNx, put the following files in your NWN directory:

  • nwnx2.exe
  • nwnx.ini
  • madCHook.dll
  • nwnx-module.dll

That’s it – installed. Look at nwnx.ini to configure it. The default .ini is usually fine, all you need to do is add the name of the module to load in the right place leaving out the .mod extension eg.
Module = "MyModule"

The most common NWNx plugins are included in the server pack. While they are optional, the NWNx based 2DA cache requires the ODBC (database) plugin to work.

ODBC Plugin (nwnx_odbc.dll)

This provides the database connectivity. The online documentation for the plugin covers pretty much everything. There’s a copy of it in the server pack (nwnx_odbc2.html). The PRC scripts include the APS functions in inc_2dacache.nss and the initialisation function is already in the PRC’s module load event script. Therefore there’s no need to import the APS erf.

LetoScript Plugin (LetoScript.dll, nwnx_leto.dll)

The server pack comes with LetoScript version 3+24, which uses the Unicorn syntax. For the LetoScript functions to work, the server needs to be using servervault characters – strangely enough Letoscript can’t edit files on a remote computer. Also be aware that LetoScript works out the bic filename by using the first 16 characters of the PC’s first name + last name.

Profiler Plugin (nwnx_profiler.dll)

The plugin profiles running scripts, logging how often a script has been called and how much time it took to complete. The online documentation explains how it can be used. There’s also a copy of it in the server pack (nwnx_profiler.html). It’s not required for any PRC functions, but it’s very useful.

Inventory Fix Plugin (nwnx_invfixpl.dll)

Surprisingly enough, this plugin fixes inventory lag. However, it also alters the value of some items, so it may not be suitable for all persistent worlds. See the invfixpl_readme.txt in the server pack for more information.

Installing the Server Pack – The Precacher

Why Bother?

In a single player game, the PRC scripts read 2da data from the Bioware database (that’s what the PRC_DATA.xxx files are for). For multiplayer, especially a persistent world, the Bioware one isn’t really fast enough, so instead the PRC lets you store the 2da cache in the database used by NWNx. The precacher reads the PRC and some Bioware 2das into the database as doing this while playing causes the game to become unresponsive while it reads the 2das.

Note: using the NWNx database as the 2da cache is required for the Conversation Character Creator to work.

Running the precacher on Windows

First, install the PRC, then put the following files in the main NWN install directory:

  • 7za.exe
  • erf.exe
  • bioware2das.7z
  • prc.jar (the precacher)
  • Either precacher sqlite prc.bat or precacher mysql.bat, depending on which database you are using with NWNx
  • sqlite.exe if using sqlite

Double click on the appropriate batch file (precacher sqlite prc.bat for sqlite, precacher mysql.bat for mySQL).

Running the precacher on Linux

First, in the directory where you extracted prc.jar, create a directory called precacher2das. Add the following files to the precacher2das directory:

  • extract Bioware 2da files from bioware2das.7z
  • extract the 2da files from prc_2das.hak, prc_craft2das.hak and prc_race.hak, overwriting any duplicates

Using the command line, go to the directory prc.jar is in and enter: java -Xmx100m -jar prc.jar 2datosql precacher2das MySQL

Note: this method will also work for Windows if you don’t want to use the batch file.

Installing the Server Pack – Making the 2DA Cache Database

Using sqlite

After the precacher has finished, a file called sqlite.db will have been created. This is the database and it just needs moving to the NWN install directory on the server.

Using mySQL

This assumes mySQL is in the PATH for Windows. The precacher creates a file called out.sql, which needs moving to the server where the mySQL database is going to be created.

  1. open a command prompt
  2. go to the directory you put out.sql in
  3. type: mysql -u user -p databasename < out.sql > out.log (replace the user and databasename with whatever it should be)
  4. enter the password when prompted

For Linux, the command line is:
cat out.sql| mysql -u user -p databasename

There are several arguements that mysql takes, eg -u username and –user=username are equivalent, see the MySQL manual.

The log file will be empty, but it stops mySQL echoing a confirmation after every line of the sql file (it has a lot of lines) and it stops if it encounters an error.

Note: the Linux version of NWNx only has mySQL support, also there is no Linux version of sqlite.

That’s It

Suggestions please, particularly if something’s missing or incorrect.

Credits

The ODBC and profiler plugins are from nwnx.org, the LetoScript plugin from Project Leto’s sourceforge site and the inventory fix plugin from nwnrcc’s sourceforge site. SQLite is avaliable from www.sqlite.org. The Precacher is based on a version made for the PRC by Yuritch, but rewritten into java by the PRC.