# 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 an interactive server
- Non-interactive servers
- Private and public: the dopewars metaserver

## Running an interactive 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. By default, this runs the server in "interactive" mode; that is to say that the server functions as normal, but in addition responds to typed commands from you. Click here for a list of the valid commands in interactive mode.

## Non-interactive servers

Usually, however, you will not need to use server commands (most can be specified in the configuration files anyway) and so will want a non-interactive server. This will sit in the background and quietly deal with dopewars games without disturbing you, the user. To "persuade" the server to be non-interactive, you must redirect standard input and output, and use your shell's job control to put it in the background, with a command similar to the following:-
dopewars -s < /dev/null >> /var/log/dopewars.log &
(this writes server output to the logfile /var/log/dopewars.log. Alternatively you can redirect this output to /dev/null.)

## 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 20 minutes 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: 09-07-2000