Skip to content
forked from nwn2dev/nwnx4

NWNX4 resurrected ! Continuation of the work on https://github.com/NWNX/nwnx4

Notifications You must be signed in to change notification settings

GamerKing122/nwnx4

 
 

Repository files navigation

NWNX4

NWNX4 is a launcher for NWN2Server that injects code into the server process, in order to provide additional features and bug fixes.

Requirements

You must install:

Usage

First installation

  1. Download and extract the NWNX4 zip file in any directory
  2. Copy all files from the config.example/ folder to your nwnx4 folder (i.e. to their parent directory)
  3. Customize the configuration files you just copied to suit your needs:
    • nwnx.ini:
      • plugin_list: the list of all nwnx4 plugins that will be loaded. You may want to add or remove some of them.
      • nwn2: full or relative path to the NWN2 install folder
      • parameters: nwn2server command line arguments. Examples:
        • -module YourModuleName if your module is a .mod file
        • -moduledir YourModuleName if your module is a directory
    • xp_*.ini: these are the plugins configuration files. Most plugins are shipped with convenient defaults, but you may need to tweak some of them. Note that the presence of a plugin configuration file does not mean the plugin will be loaded (see plugin_list in nwnx.ini).
  4. Copy the .nss files from the nwscript/ folder into your module folder, or import nwscript/nwnx.erf into your module using the NWN2 toolset. Overwrite existing files if necessary.
  5. Start NWNX4:
    • Run NWNX4_GUI.exe for the GUI version
    • Run NWNX4_Controller.exe -interactive in a shell for the command-line version.

Updating NWNX4

  1. Download and extract the NWNX4 zip file into your existing nwnx4 directory, and overwrite everything
  2. Only configuration files inside config.example/ are updated. The existing configuration files in the NWNX4 folder are not overwritten. You may need to manually update the existing configuration files (see the release notes).
  3. Copy the .nss files from the nwscript/ folder into your module folder, or import nwscript/nwnx.erf into your module using the NWN2 toolset. Overwrite existing files if necessary.

About

NWNX4 was originally written by Virusman, Grinning Fool, McKillroy, Skywing, Papillon and many contributors. This repository is based on the original codebase, but with modern build tools and new maintainers.

The original source code can be found here: https://github.com/NWNX/nwnx4

Build

Requirements

Building

Initialize your environment

# Initialize git submodules (if you did not clone this repo with `--recurse`)
git submodule init
git submodule update

# Bootstrap vcpkg
vcpkg\bootstrap-vcpkg.sh

# Install dependencies (can take a while)
vcpkg\vcpkg.exe install --triplet=x86-windows-static-md --clean-after-build

Build NWNX4

From a x86 MSBuild prompt (i.e. x86 Native Tools Command Prompt for VS 2019 if you installed Visual Studio 2019):

# Setup build
meson builddir

# Build project
cd builddir
meson compile

# Install nwnx4 at a given location
meson install --destdir=%cd%\..\nwnx4-install

Developing with Visual Studio 2019

Meson can generate solutions for Visual Studio. The following command will create a NWNX4.sln that you can open with Visual Studio:

meson setup --backend=vs2019 vsbuild

How to: Distribute nwnx4 with your module

This section will guide you through the process of creating a folder / zip file containing everything players will need to quickly run a NWN2 server with your custom content, for single-player or multi-player usage.

Skeleton

Download this repository and copy the package-skel directory to any location. This folder contains some handy scripts, and the base structure for your package, that you will need to configure and fill with your content.

package-skel\
├── ClientExtension\  Contains Skywing's Client Extension
├── home\             Replaces Documents\Neverwinter Nights 2.
├── nwnx4\            Contains NWNX4 files and config
├── start-game.bat    Launcher for the game (with the client extension)
└── start-server.bat  Launcher for the server (with nwnx4)

NWNX4

Download the nwnx4 zip file, and extract it into package-skel\nwnx4\.

You must configure NWNX4 as explained in nwnx4's README.md.

In order to run nwnx4 in a portable manner, you must add -home "$NWNX4_DIR\..\home" to the parameters variable. Other arguments are recommended but not required:

# Configure the parameters to auto-start your module
# -home <DIR>           The provided path will replace the Documents\Neverwinter Nights 2\ folder
# -moduledir <MODNAME>  Your module name (if you're saving in directory mode)
# -module <MODNAME>     Your module name without the .mod extension (if you're not in directory mode)
# -publicserver         Disable server online advertising
# -maxclients           Maximum number of connected players
parameters = -home "$NWNX4_DIR\..\home" -moduledir YourModule -publicserver 0 -maxclients 1

Game launcher

Skywing's Client Extension can automatically detect NWN2 installation directory (and provides a better NWN2 player experience). Download it from the NWVault and extract the zip into the package-skel\ClientExtension\ folder.

By default, start-game.bat will:

  1. Copy nwn2.ini and nwn2player.ini from Documents\Neverwinter Nights 2\ to package-skel\home\ (so player game settings are kept). If these files are already present in the home folder, they will not be overwritten. You can use this behavior to provide your own custom nwn2player.ini.
  2. Launch the game using the Client Extension
  3. Automatically connect to the server at 127.0.0.1:5121

Custom content

You must install your custom content (modules, campaigns, haks, tlks, override, ...) inside the package-skel\home\ folder. This custom content will be used by both the server and the game client.

About

NWNX4 resurrected ! Continuation of the work on https://github.com/NWNX/nwnx4

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 81.5%
  • C++ 16.5%
  • NWScript 1.8%
  • Other 0.2%