This release incorporates a workaround for the broken query protocol in NWN v1.32. Qstat querying is disabled in this release (if you want it back, set $nwman_noqstat=0 at the top of nwman.pl). This means NWman can't detect "hung" or empty servers, only crashed ones. All other functionality is intact.
What is NWman?
NWman is a script written in Perl which is designed to make an attempt at maximising uptime of Windows-based Neverwinter Nights (NWN) game servers. Neverwinter Nights is a new multiplayer role-playing game from Bioware.
The current version of the NWN dedicated server (NWSERVER) software suffers from several major problems:
NWman is designed to workaround these and other issues, primarily by regularly restarting the server. NWman's target audience is anybody trying to run a full-time public Neverwinter Nights dedicated server under Windows. (Although designed to run under Windows, NWman could fairly easily be adapted to run under Linux. If anybody wants to port it, .)
NWman does the following:
The last two points are important but may be difficult to understand at first. Here is an example to illustrate how it works.
Example
You have the server set to restart every hour (nwman_restart_interval 60), with a change to a new module on every other restart (nwman_restart_cycle 2). You have the server set to autosave every 5 minutes (sv_autosaveinterval 5). You have two modules listed in your modcycle.txt, "Chapter1" and "Chapter2". If you start the server up at 4:00pm, it might run like this:
- 4:00pm - Server starts up and loads module Chapter1
- 5:00pm - Server exits, restarts and loads the last autosave game
- 6:00pm - Server exits, restarts and loads module Chapter2
- 7:00pm - Server exits, restarts and loads the last autosave game
- 8:00pm - Server exits, restarts and loads module Chapter1
- ... rinse and repeat.
Effectively this gives you two hours of game time on each module, with a restart every hour (to avoid the "empty servervault" problem).
This assumes the server has people playing throughout that time. If the server empties out then a restart may be triggered earlier by nwman_restart_maxempty, reducing the time each module runs for.
If you only want to run one module then you need simply list only that one module in your modcycle.txt file. If you want the server to restart from scratch every hour (or change to a new module if you have more than one module listed), with no loading of savegames, simply set nwman_restart_cycle 1.
NWman is free software distributed under the GNU General Public License.
First, to use NWman you'll need to download NWman itself:
Note that the EXE version includes everything from the Perl version as well. If in doubt, grab the EXE version.
To use the Perl version, you will also need: (these are not required for the EXE version)
The latest version of ActivePerl (the Perl scripting language for Windows) installed and running.
Make sure you select the "Add Perl to my environment PATH" option during installation of ActivePerl.
The Win32::GUI Perl module installed. Once you have ActivePerl installed, open up a Command Prompt window (Start/Programs/Accessories/Command Prompt) and type:
ppm
You should get a prompt that looks like ppm>. Now type:
install Win32-GUI
and it should go away and download the module for you then install it all automagically. When it's done type quit to exit and you should be sussed.
You'll also need copies of QStat (tested with v2.4e) and Process Viewer. For your convenience these are both included inside the NWman zip file but you can download them separately from their sites if you want:
To get started with NWman the first thing to do is extract the zip file somewhere. I suggest creating a NWman directory under your Neverwinter Nights directory.
Next you need to edit your nwman.cfg file. Open it up in NotePad and have a look. These settings affect how your server will run. Some of these settings are NWman-specific options while others are simply options that are passed to NWSERVER. You should set most of your options here instead of in nwplayer.ini (it's just easier that way, particularly if you want to run multiple servers since you can only have one nwplayer.ini).
The settings are all documented inside nwman.cfg so I won't go into any more detail here. The important ones to get right are nwman_qstat (the path to qstat.exe), nwman_pview (the path to pv.exe) and sv_exec (the path to nwserver.exe).
If you prefer, you can override almost all of the settings in nwman.cfg by passing command line arguments to NWman instead. Run nwman.pl --help (nwman --help for the EXE version) for a list of accepted command line arguments.
Next you probably want to make a shortcut to nwman.pl (nwman.exe for the EXE version) on your desktop, or wherever. Right click the file and select Create Shortcut would be one way to do this. Then right click on your shortcut and select Properties from the menu.
This shortcut should work as-is, but if you're using the Perl version, for best results I recommend you edit the Target box and add perl at the start. For example, if it reads C:\Games\NWN\NWman\nwman.pl change it to perl C:\Games\NWN\NWman\nwman.pl then click Apply. As long as Perl is in your PATH, Windows should change perl into the full path to perl.exe. You now actually have a shortcut to Perl, which calls the NWman script, instead of a shortcut directly to the script. The advantage of this is, if you now click OK to close the Properties dialog, then open it again, you'll see a whole bunch more tabs along the top, which you can use to change the console window options (font, etc.).
In particular I suggest (for both the Perl and EXE versions) you ensure you disable the QuickEdit mode checkbox on the Options tab. If this is left enabled then accidentally clicking in the NWman console window will pause the program, which is probably not desirable.
Now if you double click that shortcut, it should start up NWman and load up your NWN server. You should be all go!
If you get a console window that appears for half a second then closes, then NWman is probably trying to give you an error message. You'll want to open up a Command Prompt window (Start/Programs/Accessories/Command Prompt) and run nwman.pl or nwman.exe manually from the command line so that you can see the error.
Important Note if you run Multiple Servers
If you're running multiple NWN servers on your machine, then for the module cycle/autosave functionality to work correctly you need to ensure that each server is autosaving to a different place. As each server will always try to autosave to save slot 1, the only solution is to use a different saves directory for each server. To achieve that, you need to run each server from a separate copy of the Neverwinter Nights directory. (You can share the servervault directory between servers by editing the path in the nwplayer.ini file.)
We could probably do with some more documentation here. For now here is a copy of the usage output from nwman.pl --help:
Usage: nwman.pl [OPTION]... [path_to_NWSERVER.EXE] Neverwinter Nights Server Manager. Program Options -h, --help Display this help and exit -v, --version Output version information and exit NWman Settings path_to_NWSERVER.EXE The full path and filename of the NWSERVER.EXE executable to run [C:/Program Files/Neverwinter Nights/nwserver.exe] -c, --config="PATH" Path and filename of configuration file to load [./nwman.cfg] -m, --modcycle="PATH" Path and filename of module-cycle file to load [modcycle.txt] --qstat="PATH" The path and filename of QSTAT.EXE [qstat.exe] --pview="PATH" The path and filename of PV.EXE [pv.exe] -a, --address=ADDRESS IP address or hostname of game server [127.0.0.1] -p, --port=PORT Port of game server [5121] --check-interval=SECONDS How often to check the server status [5] --restart-interval=MINUTES How often to restart the server [120] --restart-maxempty=MINUTES How long the server can sit empty [10] --restart-cycle=NUM How many times to restart each module before changing to next module in modcycle [2] --down-retries=NUM How many times to retry if server DOWN [4] --okay-retries=NUM How many times to retry if server UP [8] NWSERVER Options -n, --servername="NAME" Set the name of the server as it will appear in the MP game listing [Another NWman Server] -l, --load=SLOT Slot number of a save game to load [0] -t, --maxclients=MAXCLIENTS Maximum number of players on server [16] -b, --publicserver Whether to list the server [1] -g, --gametype=GAMETYPE GameSpy game room number [0] --cpu=AFFINITY Bind server to a particular CPU when in an SMP environment. -1=ALL, 0=CPU0, 1=CPU1... [-1] -r, --reloadwhenempty Whether to reload the module when all players leave the server [0] -u, --pauseandplay Allow players to pause game [0] -e, --minlevel=MINLEVEL Minimum character level [1] -x, --maxlevel=MAXLEVEL Maximum character level [20] --pvp=0|1|2 Player-vs.-Player setting [1] -s, --servervault Only allow server characters [1] --elc Enforce legal characters [1] --ilr Enforce item level restrictions [1] -o, --oneparty Allow only one party [0] -f, --difficulty=1|2|3|4 Game difficulty level [2] -i, --autosaveinterval=MINUTES How frequently the server will autosave [10] -w, --playerpassword="PASSWORD" Password required to join server [] -d, --dmpassword="PASSWORD" Password required for DM Client [] --adminpassword="PASSWORD" This is not used for anything [] Long options can be abbreviated, where such abbreviation is not ambiguous. Default values for options are indicated in square brackets [...]. Boolean options (options with no '=...' part) will give a 'true' ('1') value if specified on the command line. You can give a 'false' ('0') value by prepending the word 'no' to the long option name; e.g. --noservervault would disable the server vault, overriding any default setting in nwman.pl. Example Usage: nwman.pl nwman.pl --config="D:\Games\NWN\nwman2.cfg" --modcycle="modcycle2.txt" nwman.pl --port=5121 --servername="My NWN Server" --servervault --elc --ilr nwman.pl -p 5122 -n "Another NWN Server" --noelc D:\Games\NWN\nwserver.exe NWman: https://hlstats.org/nwman/
Enjoy. If you have problems with NWman, drop me a mail or try asking in the official Bioware NWN Server Admins forum.