Back to the site

D2GS Installation Guide

Understanding Connectivity Between Services

PvPGN — Battle.net server emulator (it was called "bnetd" before)
D2CS — Diablo 2 Game Control Server, used as a controller between PvPGN and D2GS
D2DBS — Diablo 2 DataBase Server, it manage of game character files (var/charsave, var/charinfo)
D2GS — Diablo 2 Game Server, emulator of Diablo 2 gameplay

Each of 4 services can be run on different machines or on a single server machine.

By looking on a diagram below you can see that PvPGN and D2GS must be available from the internet.
When D2CS and D2DBS can be run within internal network, and no need to expose their ports to the internet.
Players are contacted only with PvPGN and D2GS.

D2GS Connections

Download PvPGN, D2CS, D2DBS

Use preferred method to obtain PvPGN.

Download D2GS

Download Magic Builder and run d2gs_build.bat

In the selection window choose a preffered D2GS version. In most cases 1.13c is a default choice for the latest working stable version.
If you like older versions then select one of others available.
Installation of D2GS 1.13c multithreaded is not covered in this article.

On finish a new directory "d2gs" should be created. Copy this directory to a permanent location where D2GS server will be running.
It must contain the following files (D2GS will not start without at least one file from the list):

   d2data.mpq
   d2exp.mpq
   d2sfx.mpq
   d2speech.mpq
   Patch_D2.mpq
   D2Client.dll
   D2CMP.dll
   D2Common.dll
   D2Game.dll
   D2gfx.dll
   D2Lang.dll
   D2MCPClient.dll
   D2Net.dll
   D2sound.dll
   D2Win.dll
   Fog.dll
   ijl11.dll
   Storm.dll

Setup

For the moment you should have two directories: one with d2gs and another with pvpgn server.

Edit the following config files in accordance with the picture at the beginning.

  1. var/d2cs.conf
    realmname = "MyRealm" (the same as in realm.conf)
    gameservlist = d.d.d.d
    bnetdaddr = a.a.a.a:6112
    d2gs_password = "pvpgnrocks"
    	
  2. var/d2dbs.conf
    gameservlist = d.d.d.d
    	
  3. var/realm.conf
    "MyRealm"	"PvPGN Closed Realm"	b.b.b.b:6113
    	
  4. d2gs.reg
    "D2CSIP"="b.b.b.b"
    "D2DBSIP"="c.c.c.c"
    "D2CSSecrect"="pvpgnrocks"
    	
  5. d2server.ini
    ;actually warden is deprecated cause it does not properly, and it will kill you for no reason. So, disable it.
    EnableWarden=0
    	

a.a.a.a, b.b.b.b, c.c.c.c, d.d.d.d - are IP addresses of your servers.
If all services are running on a single machine then use a single IP address instead of many.

Optionally, you can specify "servaddrs" option in bnetd.conf, d2cs.conf, d2dbs.conf, but it's not necessary in most cases. Just leave it default to listen all network interfaces.

"AdminPassword" in d2gs.reg was updated by Magic Builder during the installation. Use harpywar.pvpgn.pl to generate a hash from a new password.
This password can be used to control D2GS from telnet connection on port 8888.

For the security reason you should change d2gs_password and D2CSSecrect, this password is used for handshake between D2CS and D2GS.

Let's consider two most common installation examples.

Start Service

To complete the D2GS installation you have to run d2gs_install.bat inside d2gs directory. It's important to run the script "as Administrator"!
(instead you can manually execute d2gs.reg and run "D2GSSVC.exe -i" to install a Windows Service.)

D2GS was designed for old Windows platforms and the service will infinitely crash/restart on newest Windows with growing D2SVC.LOG size.
It can be fixed by setup a compatibility mode in properties of file D2GS.exe.

By default Windows service is running under "LOCAL SERVICE" or "SYSTEM" accounts. But a compatibility mode that
you set for D2GS.exe is only for a current user that logged in. Setting up a compatibility mode for all users solves the problem.

D2GS Windows XP Compatibility

You can also install PvPGN/D2CS/D2DBS as a Windows Service by starting each of them with a parameter "-s install" (or uninstall with "-s uninstall"):

   PvPGNConsole.exe -s install
   D2CSConsole.exe -s install
   D2DBSConsole.exe -s install

It's possible to run D2GS on Wine, but you may run into a problem with Wine sockets. So it's recommended to use Windows for D2GS.

Running Multiple D2GS Realms

D2GS Multiple Realms

It's possible to add as many D2GS realms as you need, even with different D2GS versions.
Unfortunatelly, we can not run many D2GS instances on a single machine, because port 4000 is used by Diablo II game client and it can not be changed neither on a client nor a server side.
(but it's possible to run both 1.11b + 1.13c at the same time on multithreaded version of D2GS

D2GS listen all interfaces and there is no way to bind a specific IP address (if your machine has sevaral IPs).
You can use Virtual Machine or Docker to run multiple instances with different IPs.

It's better to run PvPGN and D2CS/D2DBS on a single machine, and D2GS on many others machines.
In this case all characters will be stored in one place, and this solution is simpler to setup and backup.

To achieve this goal you can copy/paste as many d2cs/d2dbs directories as you need, and set different
port numbers for "servaddrs" option in d2cs.conf and d2dbs.conf.

For example (0.0.0.0, 1.1.1.1, 2.2.2.2, 3.3.3.3 indicate different server machines):

   0.0.0.0
   PvPGN - 6112
   D2CS1 - 6113, D2DBS1 - 6114
   D2CS2 - 6115, D2DBS2 - 6116
   D2CS3 - 6117, D2DBS3 - 6118
   
   1.1.1.1
   D2GS1 4000
   
   2.2.2.2
   D2GS2 4000
   
   3.3.3.3
   D2GS3 4000

Setup is very similar to a single realm. In additional you have to add all your D2GS servers in realm.conf.

Modify Diablo II Server Drop Rates

All available D2GS settings are in d2server.ini and ItemConfig.dat (it should be researched).
All others settings, like drop rates, includiong images, are in a game client MPQ files. It called game modding.
You can create your own mod in Patch_D2.mpq, but remember that this file must match on a client and a server side. You should distribute it between your players manually.

Read more on forums...

Diagnosis of problems

First of all you have to examine logs for errors content:
   d2gs/*.log
   d2gs/log/*
   pvpgn/var/bnetd.log
   pvpgn/var/d2cs.log
   pvpgn/var/d2dbs.log

One of the most common problems when a game can not be created with a message "Your position in line is : 1".
Usually this means that there is no a connection between PvPGN/D2CS/D2GS (look at the first picture above). Or D2GS is not running (look at the compatibility issue above).
Also it may occurs when value of "MaxGames" is too small in HKEY_LOCAL_MACHINE\SOFTWARE\D2Server\D2GS (you can change it in d2gs.reg and then execute the file to update the registry).

Another comon error is "Failed to join game".
a) This may mean block of UDP traffic on a client side or on a server side.
b) By different reasons sometimes character files can be corrupted. You can restore them from var/bak/ directory. But from time to time this directory overwrites by actual files,
and you may find that there is also a corrupted character.
So, it's highly recommended to backup directories var/charsave/ and var/charinfo/ with an external tool by a schedule.

If your server periodically crashes without a reason, it may be caused by a vulnerability that can be exploited by bad guys.
In this case D2GS logs should contain the following error: D2GSErrorHandle: Unhandled exception occurred.
Couple of tips and a solution how to protect your D2GS from this attack:


Could not resolve an issue by yourself? Welcome to forums.pvpgn.pro.
Attach all configs, logs, screenshot with the error to a new post. Describe the issue in details and what did you try to solve it.


Connect with Diablo II

Use Battle.net Gateway Installer to add a new server into Windows registry.

Connection to PvPGN from Diablo II client does not require any special loaders — you can use an original game client.
Only requirement is a client version must match on a server version.

There are two game types are available to choose in main game menu: