Multiplayer is a set of gametypes in SRB2 that allow play for more than one person. Multiplayer games are either played splitscreen on one computer, or over netgames, where one player hosts a game on a network using several computers, such as the Internet.
Splitscreen and netgames
Splitscreen games are games held on one computer, with the two player screens being split horizontally. A combination of keyboard controls for both players or gamepads are used for control. Splitscreen games include all the same game types that network games use.
Network games, often shortened netgames, are games that are played online with other people. They are set up by a host, with up to 31 other members joining the game. The host has full control of what level is being played, whether chatting to others is allowed, whether the game is paused or not, and so forth. He/she can also ban unwanted users. Most of the host's privileges can be lent to someone else in the netgame, either by using the
VERIFY console command or having the member log in with the correct password.
A master server is a website or IP publicized on the Internet and primarily functions as a list of servers for players to join. Currently, the Official SRB2 Master Server hosted by Cue, Alam, and Logan at ms.srb2.org is the community's official master server. 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 Master Server and running servers, in-depth information about all hosted netgames can be obtained from the Master Server website.
You can set your Master Server through the
MASTERSERVER command, or by using the Options menu: Make sure you include the port (Standard is 28900) after the IP Address or Hostname, like so:
The Official SRB2 Master Server is divided into two main separate "rooms" which serve different purposes, although more rooms can be opened there depending on current events in SRB2 community such as "OLDC" or "Feudal Era" (which was for testing 2.1 development build of the game). In the Standard Room, netgames using the official gametypes implemented into SRB2 are hosted. Servers that play the game in a different way than intended through the game, such as Roleplaying or Hangout, are hosted in the Casual Room.
To join a netgame, there are four methods:
- Go to the Multiplayer menu, and click on the "Join Game (Internet)" option. Any games hosted on the Master Server will be shown on a list. Select the one you want to join and hit Enter, and it will attempt to join. By default, only servers in the Standard Room are displayed, but the room can be set on top of the screen.
- Go to the Multiplayer menu, and click on the "Join Game (LAN)" option. Here you can select games hosted over your local network instead of the Internet.
- Go to the Multiplayer menu, and click on the "Join Game (IP Address)" option. Type in the IP address of the person hosting the game you want to join. This is used for private netgames that should not be displayed on the Master Server.
- You can type
CONNECT <ip address>into the console. This method works in the same way the "Join Game (IP Address)" option does.
To host a netgame, there are several necessary procedures you must follow. First and foremost, you must have port 5029 UDP open. This website will explain how this works. Once this is done, hosting your game is simple. Just go to the "Multiplayer" option in SRB2, select "Host Server" option, and choose your settings. If you want to advertise your game on the Master Server, choose the "Yes" option on "Advertise on internet". This will allow people to search for your game and join it. If you want the game private, select "No" on the "Advertise on internet" option, and only people who know your IP address and that you are hosting can join. If you need to inform someone of your IP address and you don't know it, this site can help you.
Lag is a common term for any kind of delay in gameplay. Specific kinds of lag occur for different reasons.
- Latency causes the player's controls to be delayed between pressing the button and having it actually happen 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 written in milliseconds. The lower the ping, the less latency, and the more responsive your controls will be 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 drops frames of animation when playing. This is caused when the player's computer is not fast enough to display the graphics on-screen in time, and never has to do with one's internet connection. The most common cause of this is an overly detailed map, but it will also happen when the player's computer is too slow for the resolution they're trying to play at. 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. Contrary to popular belief, pausing does not directly stop lag spikes.
- Consistency failure protection can generate a weird kind of laggy behavior characterized by the character teleporting back to where they were after moving, creating a stuttering effect of players moving two steps forward, one step back. This happens when
CONSFAILPROTECTis set to enabled and someone gets desynched and has a consistency failure. This can make a game impossible to play, but prevents player from being automatically kicked. Frequently this can be fixed by simply ending the round and reloading the map, but if not, you'll need to find who is breaking the game's consistency and kick them.
- 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
PINGcommand 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.
A consistency failure, also called "c-fail", is an automatic action performed by the server if the other players' connections are sending improper data. The player sending the improper data will have it refreshed by the server, this can cause lag. People still get kicked for consistency failures, however. Usually when the client sends an illegal netvar command. The host can see who is being inconsistent by typing
blamecfail 1. If these jam up your game without stopping, you can turn off consistency protection with
consfailprotect 0. Don't forget to turn it back up afterwards.