Here are some “golden rules” and tips you’ll discover in the book.
You need an Xbox 360 Live Account on your Xbox 360, which must be connected at all times when you develop and test your XNA games.
Make sure your PC and the Xbox 360 are on the same network and they can “see” each other. You can test ping-ing the Xbox 360 IP from your PC or connecting to your PC as a media center from the Xbox 360.
When you create an encryption key in the Settings of the XNA Game Launcher and it is not accepted by your PC because you maybe mistyped it or it contained 0 (the number zero) and O letters, which look almost the same, just try it again. You can always create a new encryption key. See Chapter 1 for details.
If you run into compiler errors from the code in this book, make sure you have all required content in the project and all the classes and used variables are defined correctly for graphics, sounds, and music files.
Read the compiler error message and change the code accordingly. Maybe you are trying to use some obsolete method; either replace it with the new method or just comment it out to see how the rest of the code behaves.
If the compiling works, but the program crashes or throws an exception it is most likely that you have some content file missing or that your graphic hardware does not support at least Shader Model 1.1.
It is important to write down your ideas and to develop a small concept. Just one page of concept can be quite useful.
To solve problems you use a top-down approach and you use unit testing to stay at just the top level without even thinking of the implementation. This way you can quickly adopt ideas from the concept and write them down in unit tests, making it easier to see exactly what methods you have to implement.
Final tips about managing your projects: Think about your problems and divide them into small manageable parts.
Write the tests first and do not think about the implementation. Just write them down like you think the final code should look or like you want to have your game code.
Try to make sure you test as much as possible. For example, the TestIsInList method tests both a successful call to IsInList and a failure from the IsInList call. Spend time with your unit tests, but never more than 50%. You should not have to write 30 checks for a method that has only two lines of code.
Start the test constantly from this point on, even when you think it does not make sense. It will force you to see what has to be done and how far you are in the implementation process. At first the test will not even compile because you haven’t implemented anything. Then after implementing empty methods the test should fail because you are not doing anything yet. Later when everything works you’ll feel much better.
Whereas you will not test your static unit tests very often, dynamic unit tests can be tested every single time you compile your code (if they all run quick enough). Always try to run all unit tests once a day or once a week to always make sure your latest code changes did not add new bugs or errors.
Do not use any external dlls if not required - While using XNA Game library DLLs is supported, 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 the 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. In that case use the XBOX360 define to exclude this code parts to make the project still compile on the Xbox 360 platform.
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 compared to 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 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 for 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.