How This Looks on the Xbox 360


Ok, the game is now finished and you tested it quite a bit on the Windows platform. As I already explained in the first chapter there are several steps required to get the Xbox 360 up and running for the XNA Framework. If the XNA Game Launcher is started on the Xbox 360 you can try to compile your XNA Pong game and deploy it to the console.

There are a few important things to remember for the Xbox 360:

  • Do not use any external dlls if not required - Although it is supported to use XNA Game library dlls, most dlls you will have on the Windows platform will call system dlls that are not available on the Xbox 360, or even worse, call unmanaged dlls with P-Invoke, which is absolutely not supported on the Xbox 360 for security reasons. Also don’t use unsafe code or make any attempts to call external code, access devices, or use unsupported features. It will be a waste of time and you are better off just playing by the rules.

  • Don’t wait with the testing - In the middle of the project test if your code compiles if you change the output settings to the Xbox 360. Often methods you might get used to might be missing on the Xbox 360. For example, there are no TryParse methods in the System.dll on the Xbox 360, and some XNA methods and classes like the MouseState classes are even missing and unsupported.

  • Don’t load content directly - On the Windows platform it is possible to load textures or shaders directly with help of the Texture2D or CompiledEffect constructors. These methods are completely missing from the Xbox 360; you can only load content from the content pipeline. If you use code that dynamically loads or reloads textures or shaders, it will only work on your Windows platform, so exclude the code with #if !XBOX360 ... #endif for the Xbox 360 build.

  • Save Games and loading other content - For save games you can use the Content namespace and the many available helper classes. To load content you will always have to make sure you use the correct path with the help of StorageContainer.TitleLocation, which works on the Windows platform too and just uses your output directory there. Loading from other locations on the Xbox 360 results in Access Denied exceptions for IO operations.

  • Test resolutions - The Xbox 360 supports many different resolutions from the PC and you should test at least 2–3 different resolutions to make sure the game runs fine with it.

  • Allow controlling everything with a gamepad - Most XNA games I’ve seen to this point made the mistake of only allowing keyboard input or only gamepad input, which means it runs either only on Windows or only if you have an Xbox 360 controller. Always add support to as many input devices as you can think of and that make sense for your game.

  • Debug and unit test on the Xbox 360 - Debugging and unit testing is no different on your console; the same rules apply. It might be a little harder to trace errors and log messages, but stepping through code and testing unit tests works great with XNA. Take advantage of that. By the way: edit and continue works only on the Windows platform, you can’t do that with Xbox 360 games, which can be annoying, but you will probably do the major part of your development on the Windows platform anyway.

XNA Pong was always coded with the Xbox 360 in mind; all methods and features you used are supported on the Xbox 360. Therefore testing the game on the Xbox 360 is no big deal, you can just deploy it and start it and it will work fine (see Figure 2-11).

image from book
Figure 2-11




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