Datasheet

You might even ask why you should change the way you loaded textures before. If you just want your
game to run on the Windows platform, you can certainly load textures and shaders dynamically and
without importing them first into your project as XNA content files. This has the advantage that you can
change textures or shaders while the game is running (a feature that is not supported by the XNA con-
tent pipeline). However, for model files this will not work because there are no load methods other than
from the
ContentManager class, which only loads compiled .xnb content files.
On the Xbox 360, you can load content files only; there is no support to load textures or shaders directly.
If you use direct texture or shader loading, make sure you exclude that code from the Xbox 360 platform;
the dlls for the Xbox will not support loading anything but the content files.
For more details about important model files, read the chapters in Part II of this book. Handling 3D
models is not as easy as just using textures for 2D games. For that reason this part of the book sticks with
sprites and 2D textures and keeps things simple. For simple 2D games it is nice and easy, but to write a
serious game you will need 3D models and many cool shader effects. I also suggest that you get an artist
to do the textures and 3D models for you. It is a quite complex topic and you might waste a lot of time
doing all this yourself. Other people might also be more talented doing textures and 3D models; take
advantage of your coding skills and let other people do the painting. If you don’t have any artists avail-
able, try to use some of the models and textures from this book and the XNA starter kits.
Differences with MDX
If you are coming from MDX (Managed DirectX) and want to migrate your game to the XNA
Framework, there is a great guide on the official XNA pages at
http://msdn2.microsoft.com/
en-us/directx/Aa937797.aspx
.
You can find the same help in the XNA documentation. I won’t repeat all that here, but basically you
have to remember that XNA uses right-handed matrices and MDX was left handed by default. Also,
there are some new classes and structures to make sure you don’t need the Windows.Forms namespace
anymore. Because there is no fixed-function pipeline support, the old way of working with Windows
Forms and handles and thinking of supporting older PC configurations is no longer necessary. Graphics
and shaders are discussed in Part II of this book.
Additional Tools and Tips
Additionally you should take a look at the Getting Started help topics in the XNA documentation, which
can be accessed from XNA Studio-Help-Contents-XNA Game Studio Express. You can find more infor-
mation about connecting to your Xbox 360, writing your first project, and using all the starter kits.
As I mentioned before, TestDriven.NET is a nice tool for Visual Studio, and test-driven development is a
very important methodology in this book (see Chapter 3). Another great tool for .NET development is
the Ants Profiler. Unlike all other tools and programs I mentioned so far, it is not free, but there are alter-
natives available on the Internet, which might help you as well. The Ants Profiler can be used to directly
see how much time every single line of your project takes. In my opinion, this is much more useful than
using some high-level application performance tool such as NvPerf from Nvidia, PIX from the DirectX
SDK, or the Performance Counters of Windows. You can quickly figure out why parts of your render code
get slow, and you can detect bugs that call slow methods way too often. By using a profiler tool and by
investigating you and others source code, you not only get a lot of interesting information, but you also
24
Part I: XNA Framework Basics
61286c01.qxd:WroxPro 1/21/08 3:44 PM Page 24