Making Sure Games Run on the Xbox 360


The first two chapters already talked about the Xbox 360 and how to deploy some simple 2D games to it. This is the section in which I want to make sure that you have the XNA Game Launcher ready to work on your Xbox 360 console and you can test the graphics engine and games in each chapter as you go along. In the creation of my first XNA game I was not able to test it on the Xbox 360 first, and therefore, I only tested it on the Xbox 360 when it was almost done and I encountered many problems. 2D games ran fine and the only thing that I did wrong was to not respect the safe region on the Xbox 360 to support older TV sets. For 3D games and shaders, especially post screen shaders, so many things can go wrong. I just want to make sure that none of you have to go through the same troubles.

If you don’t have an Xbox 360 or if you are not interested in Xbox 360 console development, you can probably skip this section. XNA is still a great platform for Windows only and superior to Managed DirectX because it supports .NET 2.0 and simplifies many processes, but having the ability to create console games is really a great feature.

Before you get started, take a quick look at the completed TestRenderOurNewGraphicEngine unit test, which shows some of the features of your new graphics engine (see Figure 5-16). It looks much cooler in real time, especially if you move around with the mouse or gamepad.

image from book
Figure 5-16

As you can see on the image, I have drawn a white rectangle at the border of the visible render area. This rectangle is not described in the XNA Framework and you will not find much information about that on the Internet because this safe region is not really documented well. It means that if you have a TV set the signal that is sent to it is usually overdrawn, even if it is a new HDTV set; that’s just the way TVs work and accept signals. The older the TV set is the more pixels in the outer regions can be skipped. For this reason you should make sure that all the important game content is in the inner “safe region.” On the PC you can put anything you want in the top-left corner or in the lower right and the user will still see it in the fullscreen mode because all pixels are rendered 1:1 onto the screen, but consoles and TV sets don’t work this way. It is usually best to design your game in a way that the outer regions are not so important and only have some less important UI or 3D data on them, so it looks ok on the PC and still correct on the Xbox 360. Alternatively you could implement two modes: one for the PC, which uses the full resolution, and one mode for the Xbox 360, which cuts of 5%–10% of the borders to make the game fit on all TV sets.

Note: If you connect your Xbox 360 to a VGA monitor with a VGA cable, all this will not matter because then the Xbox 360 will render the full screen the same way the PC does; this applies only to TV sets.

Downloading the XNA Game Launcher

To get the XNA Framework on your Xbox 360 you have to download the XNA Game Launcher first. On the PC you can just install the XNA Framework Redistributables or you can install XNA Game Studio Express, which also installs the XNA Framework. Either way you will need .NET 2.0 to start any XNA application on the PC and in the same way you will need .NET 2.0 on the Xbox 360, which is obviously not installed by default (because none of the Xbox 360 components use .NET or any Managed code at all).

You can’t just put a CD or DVD into your Xbox 360 and install XNA or .NET. The Xbox 360 does not allow any unauthorized data and it protects itself very well against any hacking attempts (just take a look at how long hackers have been trying to get around the Xbox 360 protection system; it is much more secure than the first Xbox). Though this is good for the Xbox 360 game developers because games can’t be copied that easily and the Xbox 360 can’t be used for anything other than the expected use by the manufacturers, it is not a good thing if you want to bring your custom content and game ideas to your Xbox 360.

For that reason and because Microsoft and especially the Xbox 360 team is very afraid of misuse and security risks, you have to join the so-called “XNA Creator’s Club” first before you are allowed to download and install XNA on your console. Other than XNA it is not free to join the XNA Creator’s Club; it will cost you a couple of bucks ($99 per year or just $49 for four months). To do that you can login with any Xbox Live account (create one first if you don’t have one yet; make sure your console is connected to the Internet) and then go to All Games image from book Memberships. There you can select the XNA Creator’s Club memberships and subscribe to them.

After you have done that you can download the XNA Game Launcher, which will be installed to your Games image from book All Demos/Games section of your Xbox 360 Dashboard.

Xbox 360 Setup and Deploying Games

You can now start the XNA Game Launcher, which is the program to start all your XNA games, no matter if written by you or if you have downloaded them. The XNA Game Launcher can be found on your Games image from book All Demos/Games page if you are logged into an Xbox Live account that has the XNA Creator’s Club membership. If you don’t see it, go back to the Memberships page and make sure you are subscribed. After you start the XNA Game Launcher you can see the screen shown in Figure 5-17. Please make sure you are connected to the Internet at all times when the XNA Game Launcher is started, or else you will lose the connection to Xbox Live and the XNA Game Launcher will end itself.

image from book
Figure 5-17

As already discussed in Chapter 1, you have to go into Settings first if this is your first time using the launcher and you want to deploy your games from your PC to the console. In Settings you can then generate a key, which you have to enter in XNA Game Studio Express under Tools image from book Options image from book XNA Game Studio image from book Add Console (see Chapter 1). You may have to repeat that step in case the connection to the PC does not work anymore or if you have reinstalled XNA Game Studio Express on your PC.

After the key is set you can connect the Xbox 360 to your computer and start deploying games from your PC. To deploy games, the PC and the Xbox 360 must be in the same network and because both have to be on the Internet, it makes sense to use a router or modem to connect all the devices together. You can deploy games by just opening an Xbox 360 project in XNA Game Studio Express and pressing F5 to start it. Alternatively you can just deploy the game without starting it in the Build menu. In any case the deployed games (if there were no build errors) are automatically stored on your Xbox 360 and can be accessed later with the “My XNA Games” menu entry of the XNA Game Launcher (see Figure 5-17). This is quite useful if you just want to play a game or show it to a friend without having to connect to the PC first.

Console Debugging and Tools

When you press F5 in XNA Game Studio a project will be debugged, no matter whether you start it on the PC or the Xbox 360. The cool thing is that debugging works great on the console too. This can be especially useful if you just have one PC monitor and then your Xbox 360 connected to a TV set. Then you can use your PC to do all the work and step through the code in the debugging mode while you can see the result on the Xbox 360 screen.

Additionally there are some tools to help you out with the Xbox 360 development. For example, XACT allows you to create and test sound projects for Windows and the Xbox 360. You learn all about that in Chapter 9. Professional Xbox 360 developers also have access to the XDK (Xbox Development Kit), which is not available to home users and it costs quite a lot of money to get such a kit, if your company is even accepted to be a certified Xbox 360 developer. There are many useful tools in the XDK, especially to find out about the performance of the console, get and log errors, and so on. All of this is not available to XNA developers. For this reason Microsoft created a special tool just for XNA to help you analyze the performance of your game project on the Xbox 360. The program is called “XNA Framework Remote Performance Monitor for Xbox 360” and you can find it at Start image from book All Programs image from book XNA Game Studio image from book Tools. Check it out if you are serious about XNA console development.




Professional XNA Game Programming
Professional XNA Programming: Building Games for Xbox 360 and Windows with XNA Game Studio 2.0
ISBN: 0470261285
EAN: 2147483647
Year: 2007
Pages: 138

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net