@chapter{ Multiplayer }

Doomsday features client/server based multiplayer for up to 15 players.

Multiplayer games can be joined using the in-game GUI (under the @dquote{New
Game} main menu option) or using the console.



@section{ Modes }

The following multiplayer modes are available in @plugin{libdoom},
@plugin{libheretic} and @plugin{libhexen}:

@list/thin{
@item Cooperative
@item Deathmatch
@item Team Deathmatch
}

Deathmatch and Cooperative can be set directly in the GUI or console. For Team
Deathmatch set "No Team Damage" to yes and in Player Setup make sure everybody
on your team is the same color.

Doom offers two variants of Deathmatch:

@deflist{

@item{Deathmatch 1} Ammo and powerups do not respawn. Non-dropped (i.e those
from bad guys) weapons remain, but can only be picked up once per life.

@item{Deathmatch 2} All non-dropped pickups, including weapons randomly
respawn a short while after being picked up. Respawned weapons can be picked
up more than once per life.
}

Deathmatch in Heretic and Hexen is limited to the "Deathmatch 1" mode.



@section{ Online games }

When joining games on the internet, please note the following:

@list{
@item The network code in this release has some @link{limitations}{http://dengine.net/multiplayer_issues} that we will work on in future versions.
@item The connection should be able to sustain 100KB/s transfer rate (1 Mbps or better).
}



@section{ Hosting a game }

Use @ifdef{UNIX}{ @strong{doomsday-shell} or @strong{doomsday-shell-text} }
@else{ @strong{Doomsday Shell}} to host a multiplayer game of your own. The
@wikiterm{Shell}{Shell} allows you to start, stop, and control Doomsday
multiplayer servers. Using the Shell, you can connect both to local servers and
remote servers over the internet.

@strong{doomsday-server} runs in a background process and has no UI of its own.
You must use the Shell to view or manipulate it. Presently you must use the
Shell's Console (text-mode command line interface) to configure the server.

For instance, the following would set up a deathmatch without monsters in
E1M5:

@samp{@pre{server-game-deathmatch 1
server-game-nomonsters 1
setmap 1 5}}

Note that you can set up a @file{.cfg} file where you can define the server
configuration and @wikilink{automatically open the server}{Multiplayer_server}.

If your server is not public (@opt{server-public}), a client can connect to it
using a custom address search:

@list{
    
@item Server on the same computer or LAN: servers on the local network should
be discovered automatically and are visible immediately in the Custom Search
results list.

@item Server somewhere on the internet: enter the server's IP address or domain
name into the search address field.

}



@section{ Networking details }

Doomsday uses TCP network connections for multiplayer games. If you host a
game and are behind a firewall or using NAT, you must make sure that other
computers are able to open TCP connections to your computer. This entails
opening the appropriate incoming TCP ports on your firewall and/or configuring
the NAT so that the correct ports are routed to your computer.

Additionally, UDP ports 13209-13224 are used for detecting servers running on
the local network; if you are experiencing problems with autodetecting local
servers, check that your firewall isn't blocking these UDP ports on either end.

You can see information about the network subsystem status with the command:

@code{net info}

@subsec{Server}

A server opens one TCP port for listening to incoming connections. The port
number is configured with the console variable @var{net-ip-port}.

By default a server uses TCP port 13209 (setting the port to zero will mean
13209 will be used). The configured port must be open for incoming TCP traffic
in the firewall.

@subsec{Client}

Clients do not require any firewall configuration for incoming connections. A
client only needs to be able to reach the server via the server's TCP port.

A server running on the same computer can be connected to with the following
command:

@code{connect localhost}

