Getting Started With Networked Games
Games for Windows - LIVE is not available to finished games. This functionality is not included in the redistributable version of the XNA Framework. A game that attempts to use these components without XNA Game Studio installed will result in a GamerServicesNotAvailableException.
Dependency on Gamer Services
XNA Framework games must explicitly initialize the gamer services system before networking methods are called. Gamer services allows your game to receive notifications such as sign-in status changes, game invitations and other messages from Xbox LIVE, and it gives your game access to the Guide. The Guide provides a user interface allowing players to sign in to Xbox LIVE, view messages or game invitations, and use Xbox LIVE user interface elements such as the on-screen keyboard during a game.
Most games use GamerServicesComponent, a game component that wraps the GamerServicesDispatcher object and takes care of sending and receiving messages from Xbox LIVE. This component also passes in the graphics device and window handle to allow rendering of the Guide, and it calls GamerServicesDispatcher.Update at regular intervals. To use this component, most games only need to add one line to the Game constructor:
For more information on Gamer Services, see Gamer Services Overview .
XNA Creators Club and Xbox LIVE Membership Requirements
There are two types of online multiplayer games available when you create a networked game with XNA Game Studio: system link game sessions and LIVE sessions. These two forms of online multiplayer gaming describe whether the multiplayer gaming session is on the local area network (system link games), or if the gaming session is advertised and found through the LIVE service. With system link games, you can search the local area network to find the gaming sessions. With LIVE sessions, you can use the LIVE service to find available game sessions. Use the searchProperties argument of NetworkSession.Find to specify the parameters used to search for an available game session—a game session that uses either system or the LIVE service.
Developing and testing a networked game requires at least two machines, but you only need one Xbox 360 console and one Creators Club membership to test network code for the Xbox 360. This is because XNA Framework supports cross-platform system links so developers can run one instance of a game on an Xbox 360, and a second on a Windows-based computer. This functionality helps creators debug their titles without having to purchase a second console. It is also possible for more than one Windows-based development computer to connect several machines in a system link session without any memberships required.
Memberships are required for a player on a Windows-based computer and an Xbox 360 console in a network session, depending on the session type that has been created.
|Xbox 360 console||Windows-based development computer||Zune|
|Run an XNA Framework Game||LIVE Silver membership + Premium XNA Creators Club membership||No memberships required||No memberships required|
|Use System Link for Local Area Network gameplay||LIVE Silver membership + Premium XNA Creators Club membership||No memberships required||No memberships required|
|Sign in to Xbox LIVE and Games for Windows - LIVE Servers||LIVE Silver membership + Premium XNA Creators Club membership||LIVE Silver membership + Premium XNA Creators Club membership||Not available on Zune|
|Use LIVE to connect to other machines over the Internet while the game is in development||LIVE Gold membership + Premium XNA Creators Club membership||LIVE Silver membership + Premium XNA Creators Club membership||Not available on Zune|
|XNA Framework components that interact with Games for Windows - LIVE require an XNA Creators Club membership. If for any reason a LIVE profile without a Creators Club membership is set to auto sign in to a Windows-based computer, the game will be unable to connect to the LIVE service. Furthermore, the XNA Framework gamer services components, including the Guide, will be unavailable. To disable auto sign in for a LIVE profile on a Windows-based computer, disconnect from the network, launch an XNA Framework game, and then open the Guide.|
It is not possible to run multiple simultaneous instances of a networked game on a single development computer.
When you launch to multiple machines for network testing, we recommend that you load multiple copies of your solution into separate Visual Studio instances, one per machine.
For a system link game, you can use any one of the following hardware configurations to test a networked game:
- One development computer and one Xbox 360 console (running one instance of the game on a Windows-based computer and one on Xbox 360). The creator needs one LIVE Silver and one Creators Club membership to run code on the Xbox 360.
- One development computer and one client computer (running one instance of the game on each Windows-based computer). Creators cannot run two networked XNA Framework games at the same time on the same computer. Creators need a second machine to run a second game instance for testing purposes. No LIVE memberships or Creators Club memberships are required for this scenario.
- One development computer and two Xbox 360 consoles (running one instance of the game on each Xbox 360). Here a creator deploys and debugs the game on two Xbox 360s. The creator needs at least two LIVE Silver memberships and two Creators Club memberships (one pair for each Xbox 360) for this scenario.
- One development computer and two Zune devices (running one instance of the game on each Zune). Here a creator deploys and debugs the game on two Zune devices. The creator needs no additional memberships for this scenario. Note that Zune only supports system link networking and does not support cross-platform networking or internet connectivity.
If a creator wants to use LIVE to connect to gaming machines over the Internet as opposed to using system link to connect gaming machines over a local subnet, you may use any one of the following hardware configurations:
- One development computer and one Xbox 360 console (running one instance of the game on the development computer and one on the Xbox 360). The creator needs two LIVE Gold memberships and two Creators Club memberships (one pair for each machine) for this scenario.
- One development computer and one client computer (running one instance of the game on each computer). The creator needs two LIVE Gold memberships and two Creators Club memberships (one pair for each machine).
- One development computer and two Xbox 360 consoles (running one instance of the game on each Xbox 360 console). The creator needs two LIVE Gold memberships and two Creators Club memberships (one set for each machine).