Multiplayer

From SRB2 Wiki
Jump to navigation Jump to search

Multiplayer is a category of game modes in SRB2 where multiple players are allowed to play the game at the same time individually, in contrast to Single Player. Depending on the gametype being played, players either play together as a team or against each other. Multiplayer games can be played either through two-player mode, which is played on a single computer, or through netgames, where one player hosts a game on a local network or the Internet and other players connect to it from their individual computers.

Two-player mode

A screenshot of two-player mode gameplay.

Two-player mode, also called splitscreen mode, is played by two people on the same computer. The screen is split horizontally to provide a separate display for each player – the top display is for Player 1, and the bottom display for Player 2.

Both players have their own set of controls in this game mode, with the exception of the talk keys, opening the console and pausing the game. A single keyboard can be used for controlling both players; alternatively, a second joystick or mouse can be plugged in exclusively for Player 2 to use.

Many of the player-related console commands and variables in SRB2 have variants for Player 2, allowing some settings to be toggled on/off or modified separately for each player. Examples of commands/variables with Player 2 variants include the following:

Netgames

A screenshot of a multiplayer CTF netgame.

Networked games, often shortened to netgames, are games that are played over a local network or the Internet. One player hosts a server on their computer and other people join the game by connecting to the server from their own computers. The server can either be advertised publicly on the SRB2 Master Server (see the section below) or, if the netgame is intended to be private, the other players can join by specifying the IP address of the host. Up to 32 players maximum can be in a netgame, though it is very rare for a netgame to have this many players present.

Joining

There are several different methods of joining a netgame in SRB2:

Go to the Multiplayer menu, and click on the "Server Browser" option to go to a separate screen displaying the full list of rooms on the Master Server (as well as their descriptions). Select one of these rooms to display the available servers hosted through the selected room, or "All" to display all servers for all rooms on the Master Server. Servers hosted on the local network will always be listed.[confirm? – discuss] Select the server you want to join and press Enter, and the game will attempt to join.
  • Method 2) Joining via IP address:
Option a) Go to the Multiplayer menu, and hover over the "Specify server address" option. Type in the IP address of the person hosting the game you want to join and then press Enter. This is commonly used for joining private netgames that are not advertised on the Master Server, though it can be used to join servers that are listed on the Master Server as well.
Option b) The console command connect can be used in a similar way to the "Join Game (IP Address)" option above – to join a netgame, type connect <IP address> into the console. However, this command also allows you to apply other options such as the port to connect to (if the server is hosted on a non-standard port) – see Console/Commands > connect for more information.
Option c) Launch the game with the -connect command line parameter. If an IP address is specified after this, SRB2 will automatically connect to a netgame with the given IP address on startup. If no IP address is given, SRB2 will search for a server on the local network and connect to the first server found.

If you are hosting a netgame of your own, it is possible to join your own server on the same computer via another instance of SRB2. To do this, follow the instructions at Dedicated server > Joining your own dedicated server. Note that this also works for non-dedicated servers.

Hosting

The Host Game menu.

To host a netgame, there are several necessary procedures you must follow:

First and foremost, you must have UDP port 5029 open. This webpage explains how this works. If you cannot host using this port, you can use a different UDP port; in this case, you must use the command line parameter -port to specify which port you are using, so that the Master Server can send joiners to the proper port. Note that port numbers above 9999 cannot be used.

Once this is done, hosting your game is simple: go to the Multiplayer menu in SRB2, select the "Host Game" option, and choose your settings. If you want to advertise your game on the Master Server, choose the "Room" option and then select the room you want your server to be listed in. This will allow people to search for your game and join it. If you want the game to be private, leave the "Room" option set to "<Unlisted>" – this will only allow people who know your IP address to join your server if they know you are hosting. If you need to tell someone your public IP address and you don't know it, this site can help you. Your IPv4 address is what you want, IPv6 does not currently work.

Dedicated servers

Main article: Dedicated server

This is a special type of netgame server in which the host doesn't need to join their own game, allowing them to leave the server running for other players. See the main article for more details on setting up a dedicated server.

Administrative privileges

By default, only the host player (or "server") for a netgame has administrative powers: these include kicking or banning unwanted players from the netgame, toggling permissions or multiplayer "cheats" on/off, or configuring other general netgame settings. However, the server can use the promote console command to promote other players in a netgame to server admins, who have almost all of the same powers as the server – exceptions include allowing other players to become admins, or toggling on/off the ability for players to join the netgame. Alternatively, a password can be set and passed around to trusted players, who can then log in as admins for the netgame. This allows other players to manage the netgame when the server is absent.

Many console commands and variables are available to the server and admins in SRB2, such as the following:

  • kick – used to kick a player from the netgame. A reason can be typed in after the command.
  • ban – used to kick and ban a player from the netgame, adding them to the server's ban.txt log file. A reason can be typed in after the command.
  • motd – sets a "message of the day" that is displayed in a player's chat text when they join the netgame.
  • allowjoin – toggles on/off whether other players are allowed to join the netgame. (Server only)
  • downloading – toggles on/off file downloading in the netgame.
  • pausepermission – toggles on/off whether other players besides the server are allowed to pause the game. (Server only)

Many more commands and variables exclusive to servers/admins can be found in the following article sections (this is not a complete list):

Master Server

A master server is a website or web server publicized on the Internet that lists netgames for players to join. The SRB2 community's Official SRB2 Master Server (commonly known as the SRB2MS or simply MS) is hosted at ms.srb2.org. It serves as the main gateway for netplay, as it is the only public method of obtaining a list of running netgames. Through several information packages sent between the SRB2MS and running servers, in-depth information about all hosted netgames can be obtained from the SRB2MS's website. In the past, unofficial master servers were hosted as well, though these have since been discontinued.

The IP address/host name of the master server the game connects to can be configured through the Game Options menu (Options → Game Options), or through the console variable masterserver. To use the SRB2MS, this should be set to https://mb.srb2.org/MS/0.

The SRB2MS is divided into separate rooms, which serve different purposes and have different rules. The three main rooms featured on the SRB2MS are Standard, Casual and Custom Gametypes, although more rooms can be opened depending on current events in the SRB2 community such as the OLDC. These rooms, along with their room ID numbers, are listed below:

Room name Room ID Description
Standard 33 Servers playing the official gametypes included with SRB2 should be hosted in this room.
Casual 28 Servers playing the game in a different way than originally intended, such as role-playing or hangout, should be hosted in this room.
OLDC 31 This room is only opened during the judging phase of the OLDC, a seasonal level design contest hosted on SRB2MB. Servers playing the OLDC levels should be hosted in this room.
Custom Gametypes 38 A room for custom game modes designed for SRB2. Rules from the Standard room apply, with an extension applied to whatever custom mode you're running instead of being limited to just the default SRB2 game modes.

A common misconception about the SRB2MS is that it is required to play SRB2 netgames. In reality, the SRB2MS is simply a list of advertised netgames – if the SRB2MS is currently offline, players can still join a netgame by connecting to the host's IP address (see the section above).

Lag

Lag is a term for any kind of delay in gameplay. Specific kinds of lag occur for different reasons:

  • Latency is a delay between the player pressing a control and the control taking effect in-game. Latency is caused by the time it takes for your internet connection to send your input to the host server and then for the server to send the information back to you about what happened because of your input. This wait time is called ping, and is generally measured in milliseconds. The lower the ping is, the less latency you will experience, and the more quickly your controls will respond in-game. Because the host is running the server on their own computer, they will not experience any latency, but all other players will experience at least some latency, depending on how good both the host's internet connection and their own internet connections are.
  • Framerate drop is when the game skips frames of animation when playing. This happens when the your computer is not fast enough to display the graphics on-screen in time, and never has to do with your internet connection. The most common cause of this is an overly detailed map, but it will also happen when your computer is too slow for the screen resolution you're using. If you're experiencing framerate drop, try lowering your resolution in the video options or selecting a less detailed map.
  • Lag spikes are when gameplay freezes up for a moment. Normally, this is caused by a bad connection on one user's end. Lag spikes will also occur momentarily when a user joins the netgame, while the server is sending the current game state to the user. Contrary to popular belief, pausing does not directly stop lag spikes.

Prevention techniques

  • Getting a better internet connection speed (mostly the upload speed) can allow your server to keep more players connected with less latency for the other players. This can also help prevent you from causing lag spikes when you join other servers, and reduce your latency when you're playing on other servers.
  • Use the ping command to determine which players have an excessively high latency, and either ask them to leave or kick them.
  • Reload the map. This can occasionally solve problems caused by people with high latency joining mid-round.

Resynchronisation

If the data transmitted between the server and a player becomes out of sync, the server will automatically pause the game and try to resynchronize the data. If this fails, the player in question will be kicked from the netgame; this is called a synch failure. The console variable resynchattempts controls how many times the server will try to resynchronize a player before kicking them. If the console variable blamecfail is enabled, the server's console will print additional information whenever a player becomes desynchronized.

External links

  Game modes [view]
Game modes CampaignUltimate modeMarathon RunRecord Attack/NiGHTS ModeMultiplayer
Gametypes Single Player/Co-opCompetitionRaceMatch/Team MatchTag/Hide & SeekCapture the Flag
Level types Supplementary: 2D modeMario modeNiGHTS
Other: Special StageEmerald Hunt