# Setting up and running a dopewars server

Multiplayer games of dopewars require a running dopewars server; this mediates the interactions between each player (each player runs a client which connects to this server). The server runs the game, generating drug prices and the like, and instructs the clients accordingly. The server can be run on any machine that can be reached over the network by clients (so you don't have to run it on the same machine that you run your client on, for example, unless your firewall blocks the dopewars port).

Single player games do not require a server (although you can still connect to one if you like) as a "virtual server" is run by the dopewars client.

The dopewars server can be heavily customised by means of the configuration files. For example, you can change the names of all the game locations so that the game is set in your home city rather than New York. Any players that then connect to your customised server will play this customised game.

- Running a server
- Interacting with the text-mode server
- Running as an NT service
- Private and public: the dopewars metaserver

## Running a server

All the code for the dopewars server is included in the same binary as the standard client. To run the binary in server mode, specify the -s or -S command line option. The type of server that runs depends on how you configured the binary; by default, on Windows systems a simple graphical window containing the server output and a line for entering server commands is used (an "interactive" server) while on Unix systems a text-mode server that accepts no input ("noninteractive") is used.

## Interacting with the text-mode server

Once started, the text-mode server does not accept commands directly. This is problematic if you want to adjust settings, eject players, etc. To send commands to a running server, run dopewars with the -A command line option. (This should only work from the machine running the dopewars server, not over the network, and only for the user that started the server, as it uses a Unix-domain socket for the communication.) Also, by default the text-mode server sends its log output to standard output; you may wish to instead log to a file with the -l option.

## Running as a Windows service

On Windows systems, the graphical server has one major drawback; it can only run while you are logged on. As soon as you log out, the server is killed. To get around this limitation, dopewars supports being run as a "Windows Service". The disadvantage of the server in this configuration is that server commands cannot be issued once the server is running. This limitation should be fixed in a future release of dopewars.

## Private and public: the dopewars metaserver

By default, a server reports its status to the dopewars metaserver. It does this on startup and shutdown, and whenever players join or leave the game. In addition, you can force a report (under Unix systems) by sending the dopewars server process a SIGUSR1 signal. The server will "remind" the metaserver that it exists by ensuring that a report is sent at least once every 3 hours or so, regardless. A "status report" comprises contact details for the server, a count of the number of active players, and current high scores.

The metaserver also has a web interface, which is used by dopewars clients to obtain the list of servers, and can also be viewed with a web browser here.

Whether your server connects to the metaserver can be configured with the MetaServer.Active configuration file setting, or the -s and -S command line options.

N.B. Your machine may have trouble connecting with the metaserver in some circumstances, most notably if you are using an enforced proxy server or your DNS does not correctly resolve your IP address to your domain name. In such cases, you may be unable to connect to the metaserver, or it may register your server with an incorrect name. For information on getting round these difficulties, see the metaserver page.

- Main index

Last update: 05-12-2020
Valid XHTML 1.1