This is a rough guide for setting up a new online NWN2 server.

There are a lot of sections that would need to be improved / more detailed. Don't hesitate to edit this page and add anything.


System requirements

  • OS: Windows XP or later. Linux or Mac can run nwn2server using Wine, but nwnx4 does not work. In this
  • Processor: Since nwn2server is single threaded (i.e. it will use only one core), you need the highest frequency possible on a single core. The required frequency vary greatly depending on the used scripts, module size, number of players, etc. but 2.5GHz should be enough for a medium sized module.
  • RAM: 4GB should be enough for windows + nwn2server + MySQL. Very large servers use 6GB.
  • Disk: Disk speed will impact both nwn2server boot time and run-time responsiveness when instantiating creatures, placeables, etc. SSD are probably the best since they allow to read small files very quickly compared to hard drive disks. If you have extra RAM, you can setup a ramdisk for even better performances.
  • Network: A fast network will improve player's area loading time.


NWN2 Installation

You can install the NWN2Server using one of these methods:

Method 1: standard install

This is the easiest method, but will use more disk space than using Method 2.

  • Install the game using the disks / gog / steam installer
  • Make sure your game is up to date

Method 2: light server install

Method used here

  • Copy the following files and folders from the a standard NWN2 install to a separate folder, keeping the same folder structure:
    • Campaigns/Neverwinter Nights 2 Campaign*/Campaign.cam
    • Data/2DA*.zip
    • Data/convo*.zip
    • Data/Ini*.zip
    • Data/lod-merged*.zip
    • Data/NWN2_Models*.zip
    • Data/scripts*.zip
    • Data/SpeedTree*.zip
    • Data/Templates*.zip
    • Data/walkmesh*.zip
    • dialog*.tlk
    • granny2.dll
    • mss32.dll
    • NWN2_MemoryMgr.dll
    • NWN2_MemoryMgr_amdxp.dll
    • nwn2.ini
    • nwn2player.ini
    • nwn.ini
    • nwnplayer.ini
    • nwnpatch.ini
    • nwn2server.exe
  • The created folder should now contain only the required files to launch a NWN2Server instance.
  • Install required windows libraries: directx 9, dotnet3.5


Port redirection

NWN2Server uses by default port 5121.

If your server runs behind a NAT (like an internet access provider router), you will need to configure the router to redirect 5121 to your server hosting machine.

Also make sure your firewall allows port 5121.


NWNX4

  1. Download nwnx4 on the official website
  2. Extract the zip file somewhere on the system
  3. Edit nwnx.ini
    • nwn2: Path to the nwn2 installation folder
    • parameters: Command line parameters passed to the nwn2server process, like:
      • -module yourmodule automatically load yourmodule.mod
      • -moduledir yourmodule automatically load yourmodule if saved as directory
      • -cpu 3 Assign the nwn2server process to the CPU core 3

NWNX4 plugins

xp_bugfix (required)

Required for displaying the server in the in-game server list (using the Client Extension). Also comes with a bunch of server bug fixes and optimization (a must have !)

Official xp_bugfix page

  1. Install Visual C++ 2005 SP1 CRT
  2. Download the latest version of the plugin on the forum page
  3. Extract the zip file and copy the dll and ini files inside the nwnx4 folder

xp_mysql (optional)

xpmysql is used by a lot of nwn2 servers as an efficient persistent database. You may not require it. You cannot use both xpmysql and xp_sqlite at the same time.

  • If you don't need a MySQL server, remove xp_mysql.dll and xp_mysql.ini
  • Otherwise install a MySQL-compatible server (https://mariadb.org/ is probably the best) on the server, and edit the xp_mysql.ini file:
    • server: MySQL server IP address
    • user: MySQL user for executing queries
    • password: user's password
    • schema: Default used MySQL schema

xp_sqlite (optional)

xpsqlite is used by some nwn2 servers as an easy to setup persistent database. You may not require it. You cannot use both xpmysql and xp_sqlite at the same time.

  • If you don't need SQLite, remove xp_sqlite.dll and xp_sqlite.ini
  • Otherwise edit xp_mysql.ini:
    • file Path to the file for storing the database file


Server rules configuration

You can change the server game rules by editing Documents/Neverwinter Nights 2/nwn2player.ini

Here is an example of server options:

[Server Options]

# Server setup
Server Name=nwn.wiki server config example
ModuleUrl=https://your-module-website.com
Game Port=5121
Max Players=42
Game Type=9
#   0: Action
#   1: Scenario
#   2: Combats
#   3: Role play
#   4: In team
#   5: Duels
#   6: Arena
#   7: Social
#   8: Alternative
#   9: Persistent Action
#   10: Persistent RP
#   11: Solo
#   12: Tech support
PVP Setting=2
#   0: None
#   1: Party
#   2: Full
Game Region=0
GameSpy Enabled=1
Disable AutoSave=0
Auto Save Interval=0
CD Banned Behavior=0
Validate Character Ownership=1
BackupSavedChars=0
Reload Module When Empty=0
ServerDownTimer=180
MPEnabled=1
PlayerPassword=
DMPassword=5up3r53cr37

# Performance tuning / debugging
2DA Cache Size=100
2DA Engine Cache Size=100
Scripts Print To Log=1
Scripts Print To Screen=0
EnableClientModuleCleanup=1
EnableClientCampaignCleanup=1

# Server behaviour
Pause Loading During Cutscenes=0
HideChallengeRatingInExamine=0
HideEffectListInExamine=0
ShowSearchSpam=0
ShowDMJoinedMessage=0

# Player settings
AllowLocalChars=0
Suppress Base Servervault=1
Enforce Legal Characters=0
ItemLevelRestrictions=1
MinCharLevel=1
MaxCharLevel=30
Disable log in heal=1
Restore Spell Uses On Login=0
One Party Only=0
Disallow Shouting=0
PauseAndPlay=0

# Auto DownLoader
ClientSyncRequired=1
DisableClientCustomUI=1
DisableClientOverride=1
ClientCachePassphrase=ReplaceMeWithSomethingVeryRandom
ClientCacheStrategy=2
InfoURL=http://your-module-website.com/info/info.html
NewsURL=http://your-module-website.com/info/news.html
RulesURL=http://your-module-website.com/info/rules.html
AdminEmail=YourEmail@doge.com


Autodownloader

Let players automatically download / update their custom content files when they connect to a server:

https://neverwintervault.org/project/nwn2/other/nwn2-patch-123-content-autodownloader-guides


Launch server

Simply launch NWNX4_GUI.exe from the nwnx4 folder, and you should see a NWN2Server window appearing.



Misc

NWN2Server command-line arguments

The NWN2Server process can receive multiple command-line arguments:

  • -home <home_path>: Path to a folder that replaces the default Documents\Neverwinter Nights 2
  • -du <1|0>: Disable Client UI
  • -do <1|0>: Disable Client Override
  • -cs <1|0>: Require client to use the AutoDownloader
  • -difficulty <diff>: Game rules difficulty. 1=Easy, 2=Normal, 3=Hardcore D&D, 4=Very difficult
  • -oneparty <1|0>: Group all players in one single party
  • -ilr <1|0>: Item level restriction
  • -elc <1|0>: Enforce legal characters
  • -adminpassword <pass>: Admin console access password
  • -dmpassword <pass>: DM password
  • -playerpassword <pass>: Player password
  • -autosaveinterval <minutes>: Auto-save served game every X minutes
  • -gametype <type>:
  • -servername <name>:
  • -pauseandplay <1|0>: Allow players to pause/unpause
  • -cpu <id>: Assign server process to a specific core ID
  • -reloadwhenempty <1|0>:
  • -maxlevel <level>: Server max level
  • -minlevel <level>: Server required minimum level
  • -pvp <1|0>: PVP settings. 0=None, 1=Party, 2=Full
  • -load <save_name>: Load saved game
  • -moduledir <module_name>: Load module in directory mode
  • -module <module_name>: Load module .mod file
  • -publicserver: ?
  • -servervault <1|0>: Set to 1 to disable localvault characters and use the servervault instead
  • -port <port>: NWN2Server port (defaults to 5121)
  • -maxclients <number>: Max number of players connected
  • -crashinfo: ?

You can set these arguments by editing the parameters line in nwnx.ini.

  • No labels