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.
Download PvPGN, D2CS, D2DBS
Use preferred method to obtain PvPGN.
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
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.
realmname = "MyRealm" (the same as in realm.conf) gameservlist = d.d.d.d bnetdaddr = a.a.a.a:6112
gameservlist = d.d.d.d
"MyRealm" "PvPGN Closed Realm" b.b.b.b:6113
;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.
Let's consider two most common installation examples.
D2GS + PvPGN both on Windows + Home Router (NAT)
A computer with internal IP x.x.x.x on Windows and a router with external IP y.y.y.y.
All you need in this case is to replace all a.a.a.a, b.b.b.b, c.c.c.c, d.d.d.d → x.x.x.x, and forward ports 6112 and 4000 on a router to this local IP.
You can play with friends from the same computer where the server is running.
They have to connect to y.y.y.y while you can connect to x.x.x.x.
D2GS on Windows + PvPGN on Linux
Two different servers: one with D2GS x.x.x.x and another PvPGN/D2CS/D2DBS y.y.y.y. Both IPs are external and without NAT.
No problem. Replace d.d.d.d → x.x.x.x, and a.a.a.a, b.b.b.b, c.c.c.c → y.y.y.y
Start ServiceTo 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.
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
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, 126.96.36.199, 188.8.131.52, 184.108.40.206 indicate different server machines):
0.0.0.0 PvPGN - 6112 D2CS1 - 6113, D2DBS1 - 6114 D2CS2 - 6115, D2DBS2 - 6116 D2CS3 - 6117, D2DBS3 - 6118 220.127.116.11 D2GS1 4000 18.104.22.168 D2GS2 4000 22.214.171.124 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 problemsFirst 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:
Closed Game Server which described above. All game characters are stored on a remote server. All game traffic goes through D2GS server.
- OTHER MULTIPLAYER > OPEN BATTLE.NET
Open Game Server needs only PvPGN without D2CS/D2DBS/D2GS. All game characters are stored on local players computers with a high possibility of cheating. All game traffic goes through a player-host. Read more...