|Components of a multiplayer game|
Major systems that go into the making of a multiplayer game
|Discovering other systems|
Direct IP entry
The oldest and simplest method, this involves typing in the IP address of the user you want to connect to. The remote user can go to a page such as http://www.whatismyip.com/ to get their IP. They can then communicate this IP to you through other communication channels such as email or instant messenger. If the remote user is behind a router, they will have to open the appropriate ports on the firewall to accept incoming connections. If they are behind a firewall, they will have to configure the firewall as well.
Applicable to client/server games where you control the servers, you can have a DNS entry point to the server. Connecting clients can then connect to the DNS entry rather than typing in a fixed IP address. This is useful if the IP address of the server may change. This service is available for free through http://www.dyndns.com/. RakNet provides a class to update DynDNS as well, found in Source/DynDNS.h and Source/DynDNS.cpp. This is usually used for client/server games where you host your own server.
If the remote computer is on the same LAN, you can discover this computer by sending a datagram to the IP address 255.255.255.255 provided that the remote computer is listening on the port you send on, and will send a datagram in response. RakNet provides this through the Ping() and AdvertiseSystem() functions.
Consoles such as the XBOX 360 and the PS3, and services such as Steam on the PC offer a lobby system. The lobby system also typically provides services such as DLC, achievements, friends, and rooms. RakNet provides the SteamLobby plugin, and rough equivalents on the XBOX and PS3 with their respective lobby classes. This is usually used for peer-to-peer games, where players have some significant interaction between each other before the game starts.
Similar to the rooms server, a server maintains a list of running games. Typically, when an end-user starts a game, they upload statistics about the game to a master server, which allows queries on uploaded games. We offer this service for free at with our hosted master server.
Client/Server where you host the servers
Client/Server where users host the servers
Peer to peer
RakNet provides plugins to make peer to peer programming easier: NATPunchthrough, ReadyEvent, ConnectionGraph2, FullyConnectedMesh2, and TeamBalancer. See the project ComprehensivePCGame in the RakNet solution for an example where all these plugins are combined together.
|Game and game design changes for networking|
Spectating / Replay
Post-Game statistics and UI
Per-file difference based patching
RakNet provides the AutopatcherServer and AutopatcherClient plugins as a diff based patching system.
RakNet provides two logging solutions. The first is called SQLite3LoggerPlugin, and is based on SQLite3 on a hosted server. All logs go to the same server, and are automatically correlated. The logs can be viewed in viewer that supports SQLite although RakNet also provides a free and open source custom viewer called EchoChamber. Individual game and connectivity messages can be logged per system using the PacketLogger plugin.
RakNet provides the CrashReporter system to make this easier. It provides additional functionality such as sending emails to the developer in the case of unattended servers.
Persistent user data
RakNet provides a system called LobbyServer and LobbyClient to provide this kind of functionality for the PC. Steam, the PS3, and the XBOX already store this on their own backend. For those cases, RakNet uses the same LobbyClient interface so as to provide a unified interface to all systems.
The game should verify all inputs for sanity when possible. This will need to be done even if cheating is not a concern, since latency will also cause unusual inputs.
RakNet can automatically protect against attacks #3 and #4 with secure connection support. Solutions already exist for protecting the EXE from modification on the PC. Protecting against latency based cheating just takes smart design decisions, such as not trusting client/peer inputs.
Master Server 2