Windows Phone

Developing for Windows Phone and Xbox Live : Multiplayer Games (part 1) - Getting Ready for Networking Development

7/18/2011 5:42:27 PM
Multiplayer games enable the game player to enjoy the cooperation or competition from other players. Before computer networks were popular, this was normally done by enabling multiple players to play on a single television screen. Games can enable both players to be displayed on the screen at the same time and place or can offer multiple points of view by splitting the screen into multiple areas called split screen.

Many gamers today enjoy the availability of high speed Internet access. Personal computers and gaming consoles can connect over the Internet to enable multiple players to be connected together while playing their games.

XNA Game Studio 4.0 provides the capability to create, find, and connect to network sessions between Windows PCs using Games for Windows LIVE and Xbox 360s using Xbox LIVE. The networking APIs that you will use are part of the Microsoft.Xna.Framework.Net assembly and use the namespace of the same name. If your Windows or Xbox 360 project does not currently reference the Microsoft.Xna.Framework.Net assembly, then add the reference now. You need the reference of the samples for the remainder of this article. You can also add the using statement for the Microsoft.Xna.Framework.Net namespace to your Game class. Add the following line of code to your C# file that contains your Game class:

using Microsoft.Xna.Framework.Net;

Getting Ready for Networking Development

Building a multiplayer networked game requires that you have more than one machine that is running your game. One common development scenario is to build your game to run on both Xbox 360 and Windows. Because XNA Game Studio supports building your project for both of these platforms, you can create your game, deploy the game to your Xbox, and run the Windows version at the same time.

Running an XNA game that uses networking during development has some requirements for the gamer profile that is playing the game. On Xbox 360, the gamer profile must have an XNA Creators Club membership. Because the same membership is required to do XNA development on Xbox 360, you should already have that requirement out of the way. The other requirement on Xbox 360 is an Xbox LIVE Gold membership to connect a Player or Ranked session over the Internet. Only a Silver membership is required if you use SystemLink, which enables multiple machines to connect over a local area network—that is what you normally do when developing your game.

On Windows, only a local Games for Windows LIVE is required for building a game using SystemLink. If you use a profile that has a Silver or Gold account, you also need an XNA Creators Club membership. Because you will develop over SystemLink, you should not need a second XNA Creators Club membership. Use a local account or you will get an exception.

To use the networking APIs in XNA, initialize GamerServices.

Add the following code to your Game class constructor:

graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;
Content.RootDirectory = "Content";
// Initialize GamerServices
Components.Add(new GamerServicesComponent(this));

If you run the game on Windows, the game runs Game for Windows LIVE (see Figure 1).

Figure 1. Game starting Games for Windows LIVE

Press the Home key to bring up the guide in Game for Windows LIVE (see Figure 2).

Figure 2. Games for Windows LIVE guide

If you already have a profile signed, sign the profile out so that your screen looks like Figure 2.

Now, create a local profile. To do this, select Create New Profile located in the middle button area of the guide.


You can use the keyboard, mouse, and Xbox 360 controller to interact with the Game for Windows LIVE guide. In this article, the samples assume you are using a wired Xbox 360 controller plugged into your PC.

After you click the Create New Profile button, scroll down to Create a Local Profile link and click the link (see Figure 3).

Figure 3. Creating a local profile in Games for Windows LIVE

Complete the process to create the new local profile. You can select to have that profile auto login when you start, which saves you time while you are develop the game and saves you the step of having to sign in the local profile every time you start the game.

Other -----------------
- User Interface : Using the ApplicationBar Control
- User Interface : Creating an Animated Splash Screen
- Windows Phone 7 Game Development : The World of 3D Graphics - Vertex and Index Buffers
- Windows Phone 7 Game Development : The World of 3D Graphics - Hidden Surface Culling
- Windows Phone 7 Game Development : The World of 3D Graphics - The Depth Buffer
- Windows Phone 7 Game Development : The World of 3D Graphics - Rendering 3D Objects
- Windows Phone 7 Game Development : The World of 3D Graphics - Perspective Projection
- Developing for Windows Phone and Xbox Live : Let the 3D Rendering Start
- Developing for Windows Phone and Xbox Live : Reach and HiDef Graphics Profiles
- Developing for Windows Phone and Xbox Live : Graphics Pipeline
- Developing for Windows Phone and Xbox Live : Graphics Pipeline
- Programming Windows Phone 7 : Elements and Properties - More on Images
- Programming Windows Phone 7 : TextBlock Properties and Inlines
- Programming Windows Phone 7 : The Phone’s Photo Library
- Programming Windows Phone 7 : Capturing from the Camera
- Windows Phone 7 : Loading Local Bitmaps from Code
- Windows Phone 7 : Image and ImageSource
- Windows Phone 7 : Images Via the Web
- Windows Phone 7 : Customizing Your E-Mail Signature
- Windows Phone 7 : Managing Mail Folders
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- Sigma 24mm f/1.4 DG HSM Art

- Canon EF11-24mm f/4L USM

- Creative Sound Blaster Roar 2

- Alienware 17 - Dell's Alienware laptops

- Smartwatch : Wellograph

- Xiaomi Redmi 2
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8