Subscribe to Six's Game Programming Adventures        RSS Feed
-----

XNA Networking Brief Introduction

Icon Leave Comment
So, for my entry for the latest game programming challenge at Game Institute I decided to try something networked. I had planned on trying some sort of strategy game at first, then a platformer, but in the end I've decided to go with a 2D side scrolling, top down, space shooter. The reason is I wanted to simplify game play a little.

To be honest, XNA makes getting started with a networked game a little easier. Since XNA was designed to originally work with Windows and the Xbox 360 you use Windows LIVE and Xbox LIVE for networking natively. For Windows I'm sure you could create your own networking classes is the System.Net name spaces but I'm not sure they would be available on the Xbox 360. Getting started is as easy as adding an instance of the GamerServicesComponent to the list of components for your game in the constructor for your game.

public Game1()
{
    graphics = new GraphicsDeviceManager(this);

    Content.RootDirectory = "Content";

    Components.Add(new GamerServicesComponent(this));
}



This gives you access to the Guide and all of the functionality of the Xbox 360 Guide, like signing in our out, bring up your friends, sending invites for games, etc. You can bring up the guide to sign in gamers with just a single method call.

Guide.ShowSignIn(1, false);



The first parameter, 1, is the maximum number of local players. Windows only allows 1 pane so when you are developing for Windows it doesn't matter what you pass in. For the Xbox 360 it has to be the number of panes you want to show. Valid values are 1, 2, and 4. The second parameter is if you only want to show online profiles of both online and offline profiles. Passing in false says that you want both online and offline profiles.

If you are trying to create a network game there are a few limitations that you should be aware of. You can create what is called System Link games, games that run over a LAN, with Windows with no restrictions. If you want to create a System Link game that works with the Xbox 360, you need a LIVE Silver membership and a Premium XNA Creator's Club membership. To sign into either the Xbox 360 LIVE or Windows LIVE you need a LIVE Silver membership and a Premium XNA Creator's Club membership as well. To use LIVE to connect to other machines over the Internet while the game is development for the Xbox 360 you need a LIVE Gold membership and a Premium XNA Creator's Club membership, for Windows a LIVE Silver membership and a Premium XNA Creator's Club membership. You will also of course require a network connection and/or Internet connection for the type of game you want to create.

Well, that is it for this post. I will go over the basics of creating a session in another post. Good luck with your game programming adventures.

0 Comments On This Entry

 

August 2014

S M T W T F S
     12
3456789
10111213141516
17181920212223
242526272829 30
31      

Recent Entries

Recent Comments

Search My Blog

0 user(s) viewing

0 Guests
0 member(s)
0 anonymous member(s)