570 likes | 980 Views
Technical Issues: Networking Technical Issues: Networking More and more gaming environments are supporting networked multiplayer play. Computer based games have supported network games for many years. Consoles are now starting to support network play as well.
E N D
Technical Issues:Networking • More and more gaming environments are supporting networked multiplayer play. • Computer based games have supported network games for many years. • Consoles are now starting to support network play as well. • Most new games released these days make use of networking in some way. • Support and user communities. • Delivery of patches, updates, and upgrades. • Multiplayer gaming experiences.
Networking Requirementsfor Video Games • Consistency and synchronization • All game players should see the game world in the same state at the same time. • Low latency • Delays between players should be low. • This helps promote consistency. • Scalability • The game should be able to support a large number of players without difficulties. • The game should also be able to scale in real time as players enter and leave the game.
Networking Requirementsfor Video Games • Performance • Sufficient network resources (e.g. bandwidth) should be available to ensure the game runs smoothly. • Reliability • If part of the game goes down, the rest should continue to function without major service disruptions. • Security • It should be easy to keep track of players and prevent them from breaking game rules, cheating, or abusing other players.
Networked Game Structure:The Peer-to-Peer Model Peer Peer . . . Peer Peer Peer
Networked Game Structure:The Peer-to-Peer Model • Each player plays the game with the same program as every other player. • Each such program is a “peer”. • Each peer accepts player input, carries out game processing, and provides feedback. • Each peer must communicate directly with all other peers involved in the game to maintain synchronization and game consistency. • All peers are equivalent in functionality and standing in the networked game.
Networked Game Structure:The Peer-to-Peer Model • Advantages: • Conceptually very simple. • All players have equal standing in the game, providing some element of fairness. • Disadvantages: • Each player’s system must have sufficient resources to support the game or everyone can suffer. • Each player must know about all other players in the game, with network resources consumed for each pair of players in the game. (Using multicasting or broadcasting will reduce this problem, but will increase complexity in the game.) • Consistency and synchronization may be difficult to maintain, especially with many players.
Networked Game Structure:The Peer-to-Peer Model Screen shot from Doom. One of the first multiplayer games, Doom used the peer-to-peer model.
Networked Game Structure:The Integrated Server Model Client/Server Client Client Client Client . . .
Networked Game Structure:The Integrated Server Model • The networked game is composed of two different kinds of programs. • Multiple clients. • A single integrated client/server. • Clients are the player interfaces to the game, taking their input and providing audio, visual, and tactile feedback where appropriate. • The integrated client/server acts as a client to one player, but has additional responsibilities. • Coordinates and synchronizes all player activities. • Hosts any non player characters. • Carries out the majority of processing involved in serving the game out to players.
Networked Game Structure:The Integrated Server Model • Advantages: • Players no longer need to know about every other player in the game. • Total communication volume decreases. • Consistency and synchronization is easier, as the server is in sole control over the game. • Disadvantages: • Will the integrated server have the resources to adequately handle all the players? • Will the player playing at the integrated server have an unfair advantage in terms of reduced latency and preferential server access? • How well will this scale? • What if the server goes down?
Networked Game Structure:The Integrated Server Model Screen shot from Starcraft. Starcraft supported many network play options, including an integrated client/server mode, as well as Battle.net.
Networked Game Structure:The Dedicated Server Model Client Client . . . Server Client Client Client
Networked Game Structure:The Dedicated Server Model • In this model, the game is again split into two different kinds of programs: • Multiple clients. • A single dedicated server. • Clients serve the same purpose as in the previous model, interfacing players to the game they are playing. • The server in this case, however, is a separate program without any client functionality. • Its sole purpose is to coordinate and synchronize the game, and to serve it out to the players’ clients.
Networked Game Structure:The Dedicated Server Model • Advantages: • With separated functionality, there is no single client with a clear unfair advantage. • If a dedicated machine is unavailable, the server can be run on the same machine as one of the clients, falling back to essentially an integrated model. • Disadvantages: • Will clients closer to the server still have an advantage over clients farther away? • Will the dedicated server have the resources to support all of the clients? • How well will this scale? • What if the server goes down?
Networked Game Structure:The Dedicated Server Model Screen shot from Quake II. The Quake series of games pushed the dedicated server model, and provided dedicated servers for many different platforms.
Networked Game Structure:The Flat Server Model Client Client Client Client Server Server Server Client Client Client Client Server Client Client Client
Networked Game Structure:The Flat Server Model • In this model, there are multiple dedicated servers for scalability to support a much larger number of players. • Each server must know about every other server in use. • The servers must communicate with one another to ensure consistency and synchronization between all game players. • Each player uses a client to connect with a dedicated server to access the game.
Networked Game Structure:The Flat Server Model • Advantages: • More scalable than single server approaches. • More reliable, as there are multiple servers. • Conceptually easy to manage servers. • Disadvantages: • As number of servers grow, so does communication overhead (unless multicasting or broadcasting is used). • Consistency maintenance and synchronization are more difficult now than before, especially with more clients.
Networked Game Structure:The Hierarchical Server Model Client Client Server Client Client Server Server Server Client Client Client Client Server Client Client Client
Networked Game Structure:The Hierarchical Server Model • In this model, additional servers are added solely for the purpose of managing and coordinating other servers. • This creates a hierarchy of servers, in a tree-like configuration. • The server at the root of the tree has ultimate responsibility over the entire game, but ensures scalability by delegating many of its tasks to lower level servers.
Networked Game Structure:The Hierarchical Server Model • Advantages: • More scalable than flat server model. • Reduced communications overhead. • Disadvantages: • As the number of levels in the hierarchy grows, latency between the various parts of the game grows as well. • Consistency maintenance and synchronization are even more difficult now than in the flat server model, due to this increased latency. • What if the root server goes down?
Networked Game Structure:The Grid Computing Model Client Client Server Server Server Client Client Server Server Server Client Client Client Client Server Server Server Client Client Client
Networked Game Structure:The Grid Computing Model • In this model, all of the servers act as a single powerful parallel computer. • To the clients, the servers seem as if they are a single logical computer. • Software on the servers automatically redistributes player load to make use of free resources and to reduce client latency. • All servers in the grid may be in the same location, or they can be geographically distributed around the world.
Networked Game Structure:The Grid Computing Model • Advantages: • Can scale to support a large number of players – adding servers to the grid is transparent. • Very reliable – if a server is lost, player load is shifted automatically to a new server. • Consistency and synchronization is handled automatically by the grid software. • Disadvantages: • Very complex grid software required, although standard software is emerging. • Very costly to provide.
Networked Game Structure:The Grid Computing Model The Butterfly Grid, shown to the left, isbeing developed byButterfly.net to provide a massively multiplayer environment for videogames. It will use IBM technologies based onLinux to support a variety of games on various platforms, including Sony’s Playstation 2, and others.
Game World Structuring • Once you decide how to structure your game, you must decide how to spread your game world over the servers used to support your game. • Will each server be independent, or will they work together to support a single massive game world? • This is an important decision, and can have a large impact on your game.
Game World Structuring:Multiple Worlds • Each game server supports its own independent game world. • The world, levels, characters, and game rules can differ from server to server. • This is the easiest approach, as there is little consistency management needed. • Players also like this approach, as they can find a server providing a game world more to their needs and style of game play. • Ultimately, however, this approach limits the number of players in a single game at a time.
Game World Structuring:Multiple Worlds Screen shot from Counter Strike. There are many Counter Strike servers around the world, each providing their own independent game.
Game World Structuring:The Divided Single World • A single world is supported across all servers, but each server provides its own independent part of the world. • Geographic region (planet, country, island, part of a dungeon, etc.) • Level of game play. • Chapter of an unfolding story. • Players move between servers as they play. • Each server still supports a limited number of players in its region at a time. • By allowing players to move from server to server, they have the illusion of a much larger game world with many more players.
Game World Structuring:The Divided Single World Screen shot from Everquest. Everquest features many different regions and zones across multiple servers to support a very large world.
Game World Structuring:The Single World • In this approach, a single massive game world in its entirety is supported by many servers at the same time. • There are no independent servers; they all interact to support the same game world. • All players exist in the same world at the same time, allowing for vastly different multiplayer experiences. • Providing scalability to support this and maintain consistency at the same time is quite difficult.
Game World Structuring:The Single World Concept art for VibeForce. VibeForce is a MMORPG for the PC, Playstation 2, and wireless devices that will make use of the Butterfly Grid to support a single massive game world.
Locating Networked Games • The first step to playing a networked game is to locate one to participate in. • There are a variety of different techniques used. • The choice of technique is very important to the success of a game. • If it is too hard, users will find it difficult to play. • Mechanisms that simplify the procedure are more expensive, and can incur continuing costs throughout the life time of a game.
Locating Networked Games:Direct Connections • The oldest and simplest approach of locating a networked game requires a direct physical connection between the two gaming systems. • PC systems required a serial connection. • Consoles use a variety of techniques; the Xbox uses a crossover Ethernet connection. • With a direct connection, location is quite simple; the other game system can be found at the other end of the connection. • While simple, it ultimately limits the number of players possible, and restricts the location of players to within a few metres of each other.
Locating Networked Games:Direct Connections Screen shot from Mech Assault. It supports direct connection play to another Xbox with the system link cable.
Locating Networked Games:Fixed Addresses • In this approach, a game peer or server to contact is listening on a fixed address for new game players. • A specific phone number for a dial-up connection using a modem. • A network address and port number for Internet based games. • It is up to the player to know this address in advance to connect into the game. • No location is actually required, as the game simply contacts the fixed address directly to join.
Locating Networked Games:Fixed Addresses Screen shot of Quake II. The address book in Quake II allowed players to record fixed addresses to contact their favourite servers.
Locating Networked Games:Broadcasting • In this approach, game clients or peers broadcast data onto the network to search for servers or other peers. • When a server or peer receives a broadcast message, it responds to notify the sender of their address to join the game. • This approach is quite simple to implement (using UDP, for example), but is typically restricted to finding networked games on the same network. • Broadcast messages are usually not propagated across routers and other network gear.
Locating Networked Games:Broadcasting Screen shot from Unreal Tournament 2003. It allows you to browse through servers on the local network using a broadcast mechanism.
Locating Networked Games:Location Services • Location services run at fixed network addresses known to the game itself. • When a new game server is started, it registers its address and game information with the location service. • When the player wishes to join a multiplayer game, the game contacts the location service to help track down a game meeting the player’s needs and requirements. • When the player has selected a game to join, the appropriate server is contacted according to its registration information and play can begin as usual.
Locating Networked Games:Location Services • Location services can be hosted by the game producer or by a third party. • Location services can provide many features to game players: • They can choose games based on server location, game rules, levels, characters, and a variety of other criteria. • They do not necessarily need to know any of the other players to join a game. • Other features include the ability to run private games, as well as other community services. • Because of their ease of use, these services are becoming more common, despite their costs.
Locating Networked Games:Location Services Screen shot from Xbox Live. Many features allow easy multiplayer experiences on this console. You can play with friends or complete strangers. You can even have the system perform an “optimatch” to link you up with players of similar skill and ability automatically.
Networked Communication • Once a networked game is located and joined, the game can proceed. • There are still, however, many communications issues that must be resolved. • What to communicate. • When to communicate. • Where to communicate. • How to communicate. • These issues can have a great impact on the success of a networked game.
Networked Communication:Rules to Follow • The following general guidelines should apply to almost any networked game: • Only send what is needed. • Only send when it is needed. • Only send to where it is needed. • Following these rules is a good step towards meeting the requirements of networked games discussed earlier.
Networked Communication:What is Needed? • The “state” of a game is essentially the complete set of attributes describing all elements of a game at a given point in time. • Remember that we want all players to see the game world in the same state at the same time. • To do this, all changes in state must be sent to all parts of the networked game. • Keep in mind that we want to minimize the amount of communication, so we need to determine what to send and what not to send.
Networked Communication:What is Needed? • All changes in state that affect game play and the outcome of the game must be sent. • Character movement and actions, object placement, level condition, and so on. • Changes in backgrounds, ambience, atmosphere, and so on should not be sent. • This can be a large amount of information! • These can be handled in the individual peers and clients independently if they do not affect game play. • If desired, periodically synchronize random number keys controlling these events for some consistency.
Networked Communication:When is it Needed? • Only communicate to indicate changes in the state of the game. • When there is essentially nothing happening in a game, there should be no network traffic being generated! • Instead of communicating every change as it happens individually, it might be more efficient to collect them for a short period of time and send several state changes at once. • Do not wait too long, however, or the game’s state will become inconsistent across players. • You will need to experiment and tune this.
Networked Communication:Where is it Needed? • Not every change in game state needs to be sent to every player in the game. • Only send changes in state to players that will be affected by them! • For example, a player does not need to be notified of character movement across the level if the player cannot see or hear it; once they are in range, it becomes important. • Making these decisions can increase game complexity, but it can provide large benefits to network efficiency.
Networked Communication:How to Communicate? • Assuming that network play involves communication over the Internet, the choice of transports to use is limited. • There are two main choices: • TCP: Transmission Control Protocol, a connection-oriented Internet protocol. • UDP: User Datagram Protocol, a connectionless Internet protocol. • There are other protocols, but they can be more complex and lack widespread support. • RTP, RSVP, and so on.