Saturday, April 9, 2016

Video Game Design: Multiplayer

Perhaps the biggest challenge when making a multiplayer video game is figuring out where to start.  With turn-based games, it is not too difficult, especially if all of your players will be in the same room.  If you want to support players over the internet though, things get complicated.  The players' computers will need to communicate, but what data should they send, and by what route?  There are several ways to keep game clients synchronized, and they all have their challenges.

Client/Server

The client/server model is a popular networking model for many applications.  In this model, one computer acts as the server.  The server maintains all of the data, it does most of the math, and it acts as the central communication point for all of the clients.  In the context of video games, the server is where the game is actually running.  The clients are just communicating input to the server and receiving output from the server.  The clients may do a bit of math, and the input packets sent to the server are probably commands, not specific information about where the user clicked what button or what key was pressed.  This is a popular model because it controls communication and each client only needs one connection.

In video games, there are two common ways to use the client/server model.  The game company may be running one or more public servers that the game client connects to.  The public servers run game instances for groups of players, and they act as game servers.  This can be useful in providing cheat prevention, but if the company eventually shuts down the servers, the game can no longer be played on them.

The peer-as-server model is also fairly popular.  In this model, one of the players' computers acts as the server, and the rest act as clients.  The game runs on the player's computer, and the clients all connect to it (but not to each other).  The computer running the game is usually called the "host," and if the host is disconnected, everyone loses their connection to the game.  In general, this is a problem with the client/server model, but large game companies typically have more reliable internet connections than players, so public servers run by the game company are generally more reliable.  In addition, the host in a peer-as-server game will determine game performance.  If the host computer is slow, the game may lag for everyone.

Input data can be sent to the server as mouse click and key press data, but this tends to be rather inefficient.  It is more common for input to be sent as commands.  If the player clicks a button that issues a command to the selected unit, the client will send a packet with the command and the unit performing it.  Alternatively, state data can be sent.  If a unit attacks another unit, the client might send the amount of damage dealt or even the new hit points of the damaged unit.  This is dangerous though, as it makes cheating much easier, because the client can lie to the server and the server will accept it.

Peer to Peer

In peer to peer networking, each computer has a connection to every other computer that needs to be communicated with.  Because data does not have to be bounced off of a central computer, communication can be much faster and more efficient.  Players that don't need to know about something do not need to have that data sent to them.  The processing load can be distributed among all of the computers, eliminating the need for a host computer that is powerful enough to run the entire game.  If one peer in a peer to peer network loses access to the network, that player can be dropped without disconnecting everyone else from the game.  In some cases, loss of only part of the connection can still allow a peer to communicate with other peers using one that it is still connected to as a relay.  Peer to peer networks can be very robust and efficient.

Peer to peer networking for games can be complicated and difficult.  There must be a clear division of what part of the game each peer is in charge of.  If one peer needs to send information to all of the other peers, that data must be sent individually to every peer.  The code and processing for handling who to send what information must be running on every peer.  When a peer loses connection, the slack has to be picked up by the remaining peers.  In addition, because each peer is responsible for part of the game in peer to peer connections, it is fairly easy for one of the peers to cheat, within its own domain.

Peer to peer connections work very well for two player games.  For more than two players, it can get more difficult.  In cases where robustness is important and using a central server would be problematic though, a peer to peer networking model may be superior to a client/server model.

Game Balance

Game balance is another concern when making multiplayer games, but its importance is often overestimated.  Game balance is measured by comparing the power of two players with different powers, abilities, resources, units, or other in-game resources that are approximately equivalent.  In an RPG, two characters of the same level and same value of equipment should be close to equally powerful, regardless of character class.  In an RTS game, two players with the same skill and equivalent starting conditions should have about equal chances of winning, regardless of the race or faction chosen.  If a game is well balanced, two players starting with different races, classes, or other starting choices should have equal chances of winning given equal skills.

The fact, however, is that balance does not matter much in most games.  Characters with different classes may fill different roles.  If they fill their given roles equally well, it does not matter so much how they would fare in a competition with each other.  In addition, balance can be adjusted with handicaps, for example, giving a weaker race in an RPG slightly more hit points and damage to make up for the difference.

Game balance is only important in competitive games were individuals compete against each other.  Even in competitive games though, game balance is only really valuable when game play is not primarily casual.  In games played as e-sports balance is very important.  In games played casually against friends, imperfect game balance won't make much difference.  In general, the value of game balance is overestimated, but it is still something to keep in mind, and in some settings, it is essential.


Multiplayer games are significantly harder to make than single players games.  They require more work to make sure the user interface will work for multiple players.  They may require network communication, which involves a lot of extra design work.  They also require some extra attention to fairness.  One the other hand though, multiplayer games generally have higher replay value and are easier to market, because people like to play games with other people.

No comments:

Post a Comment