The server of Neverwinter Nights is the part of the game that tracks what actually happens in the game, handling most of what is not direct interaction with a player. The other part of the game is the client. In general terms, the server handles the module being played, while the client handles input from the mouse and keyboard and output to the monitor.
There is some overlap, though, as the client is capable of displaying a player's own character's movement without receiving instructions from the server (which is useful at those times when communication is temporarily disrupted). However, if the client and server get out of sync, the server has final say on where that character actually is. (This is the cause of some "jumping back" in multiplayer games, as the client sometimes moves the player's character further than it should have.) It is this division of labor that allows the multiplayer aspect of Neverwinter Nights. For a multiplayer game, one player (the host) runs the server, while each player connects to that server with a game client. (Technically, the same setup occurs in a single-player game, but the details are completely hidden from the player in that case.) Only the host needs to have the module being played.
When a multiplayer game has a Dungeon Master (DM), it is often the DM who runs the server. However any player can choose to host a game and become a server. The only requirement beyond what is required to run Neverwinter Nights is to have a connection to another computer, and the bandwidth of this connection is the major limitation on the number of players the server will be able to support. A basic 56k modem will support approximately two players, while LANs and servers with faster connections will likely be able to support up to the 64 client limit.
Multiple servers can be linked through the use of portals.
There are two methods for starting a Neverwinter Nights server. The first is to launch it from within the game client. This happens when (playing in single-player mode or) either "New Internet/LAN Game" or "Load Internet/LAN Game" is selected from the "Multiplayer" section. The main advantage of this method is the simplicity in getting started. The main drawback is that the server is tied to the client that started it, so if the client stops running (either the player exits or the client crashes), then the server also terminates. This method has the same system requirements as the single-player game.
The second method is to run the dedicated server application (
nwserver.exe). This is a separate program, so is not affected by client crashes. It is also available as a free download, so can be run on a computer that does not have Neverwinter Nights installed, and in fact on some computers that are not capable of running the Neverwinter Nights client. (However, a full game installation is required to get the official campaigns; other modules can be obtained from the usual sources.) The one limitation on the dedicated server is its separation from the game — since it is designed to function without CD keys, it cannot host premium modules (as those modules depend on CD keys to verify that they have not been stolen).
With either method, the server requires certain UDP ports to be open (in firewalls and routers) in order to function. In order for clients to connect to a server, the required ports are 5120-5300, and these must be open on both the server and client ends. In order for a server to be listed in GameSpy, the following additional ports must be open: 80, 6500, 6667, 13139, 27900, 28900, 29900, and 29901. (Port 80 is usually already open since that is the port commonly used to browse the World Wide Web.) These ports are also listed in the game's "readme" file.
Allowing connections Edit
The easiest way for players to find servers was via the list of servers presented by Neverwinter Nights when a player chooses to "Join Internet Game" from the game's multiplayer menu. (This service ended on December 6, 2012, when GameSpy chose to end it.) In order for a server to be listed there, the "Post Game To Internet" option needs to be selected. When launching a server from the game client, this option is one of the advanced options. For the dedicated client, this needs to be specified before starting the program, either via the command line or
nwnplayer.ini (with the line GameSpy Enabled=1).
(This setting does not affect local servers; the "Join LAN Game" option lists all available servers on the LAN.)
The other option for players to connect to an internet server is via direct connect. This method requires the players to know the server's IP address (the external IP address, not a local one). It is up to the server's operator to make the IP address known to prospective players, and to inform players should the IP address change (which does happen occasionally with some internet service providers).