Get the Free XNA Game Studio Express


To start coding right away you have to make sure that you have the correct tools installed, the IDE is an especially important tool to get started quickly. If you already have XNA Game Studio Express installed and configured you can skip this chapter. This part was written just in case anyone needs additional tips and tricks. For example, how to get XNA running in Visual Studio 2005 Professional is covered here, which is not supported out of the box, but quite useful if you use Visual Studio plugins or tools like SourceSafe (to work better in a team, for example).

Requirements

XNA Game Studio Express targets just Windows XP SP2 (SP means Service Pack) at the time of this writing. SP2 is important because of the requirements of the .NET 2.0 Framework. Other platforms like Windows 2003 or Windows Vista run .NET 2.0 too, but are not supported. XNA is also only tested on 32-bit platforms, but I tested it on Windows XP x64 and Windows Vista too and it runs fine, even as a development platform.

Because XNA Game Studio Express is based on Visual C# Express it has the same basic requirements. You basically need a computer, nothing fancy. But for game development you have much higher basic requirements anyway, which I talk about in a second. Visual C# Express runs on Windows 2000 SP4, Windows XP SP2, Windows 2003 SP1, Windows XP x64, and Windows Vista. As you can see the older the operating system is, the more service packs you need.

And finally you also need the most current DirectX runtimes, and if you are serious about game development, better get the full DirectX SDK. The DirectX SDK is not required by XNA Game Studio Express because the dlls just call the underlying DirectX dlls, but it is always useful to have some more documentation on your system and DirectX contains many samples and tutorials, which are useful if you run into trouble. For example, the DirectX SDK contains tools to help you generate DDS texture files, which are optimized for the best graphic card texture formats that are available today.

Because XNA does not support the fixed function pipeline anymore like DirectX or Managed DirectX do, it is important that you have a graphic card that supports at least Shader Model 1.1 or even better, Shader Model 2.0. The first graphic cards with shader support were shipped back in 2001 (GeForce 3 and ATI 7000); the next generation with Shader Model 2.0 (GeForce 5x, ATI 9x00 Series) was introduced in 2003 and made popular by the many games in 2004 that made good use of shaders (Far Cry, Doom 3, Half-Life 2). Shader Model 3.0 (GeForce 6x, ATI x1000 Series) is the standard today and new cards with Shader Model 4.0 (GeForce 8x) will be shipped late 2006/early 2007. The Xbox 360 uses an extended version of Shader Model 3.0.

So this is what you need at minimum before attempting to install XNA Game Studio Express:

  • Windows XP SP2 or Windows Vista

  • 512 MB Ram, but better to have more - 1 or 2 GB

  • 1 GHz CPU, the faster the better, compiling gets faster

  • Shader Model 1.1 graphic card (Nvidia GeForce 3 or 4, ATI Radeon 7x) or better Shader Model 2.0

Installing

Get the latest version of XNA Game Studio Express for free at http://msdn.microsoft.com/directx/xna/.

The beta versions still require that you install Visual C# Express and the latest version of DirectX 9.0c first; this will most likely still be the fact when the final version is shipped. All of these downloads are completely free and it is really a nice thing to have all these tools available without any costs involved. This enables many more people, especially students, hobbyists, and normal players, to check out the development environment and maybe get even more excited about game development than they already are.

If you want a step-by-step introduction to the install process and see which steps I took you can also watch the video tutorials I made for my the official XNA Starter Kit Racing Game on http://www.xnaracinggame.com.

Start with installing XNA Game Studio Express (see Figure 1-7). There are no special options you have to select; the installer will do everything for you (for example, adding firewall rules for Xbox 360 testing). The installer also adds the XNA help, the starter kits, and the project templates to get you started.

image from book
Figure 1-7

You will not really need the DirectX SDK, but as suggested before it is recommended to install it anyway. You will have additional documentation available and a great repertoire of tutorials and samples in case you need more information about common techniques for your graphic engine.

You can download DirectX from the Microsoft DirectX Developer Center page on http://msdn.microsoft.com/directx/.

When installing it you should select installing the Redistributable in the custom setup step too. You will need it if you want to install your game on other computers. When DirectX is installed you can check out the newest features by taking a look at the samples with the DirectX Sample Browser. If you haven’t worked much with Managed DirectX before and are interested, check out the documentation and tutorials.

If you want to use an Xbox 360 controller on your Windows machine (which works just fine thanks to the fact that the controller uses USB) you can just plug it into your PC and it should work fine on Windows XP and Vista after it automatically installs all required drivers. If that does not work automatically for you can also download the drivers yourself and follow the instructions from the official hardware site of Microsoft products at http://www.microsoft.com/hardware/gaming/download.mspx.

Last but not least, you will do a lot of unit testing in this book, and for that I usually recommend NUnit and TestDriven.NET, but because NUnit is an external dll and TestDriven.NET is not supported in the Express Editions anymore, you will implement your own kind of unit testing with a special class later on.

If you use Visual Studio 2005 I suggest using TestDriven.NET, and if you are using Visual Studio 2005 Team System you can also use the Unit Testing features implemented directly in VS there. Alternatively there are also other Unit Testing Frameworks around (for example, MbUnit, csUnit, and so on). Most of the samples in this book try to keep things simple and only use very basic features of unit testing and make it look like many little test programs.

You can certainly do all your work inside the XNA Game Studio Express IDE, and Microsoft encourages you to do so. All samples in this book work fine with the Express editions and I did not use any external dlls (which was also one of the requirements for the XNA Starter Kits). However, some people already have Visual Studio 2005 and may feel more comfortable doing their coding over there. Read on for a couple of tricks on how to get XNA working with Visual Studio 2005 Professional.

What about Visual Studio 2005 Professional?

XNA Game Studio Express is fine and a nice environment to work in. However, if you are used to tools like SourceSafe or any other CMS (Content Management System) or plugins like CodeRush, TestDriven.NET, and other productivity tools, you will run into a bunch of problems. As I said earlier it is not even possible to open your XNA projects from Visual Studio 2005.

The XNA Framework uses the .NET 2.0 Framework and DirectX 9.0c. This means to run games on any Windows PC, it needs the .NET 2.0 Framework, DirectX 9.0c, and the XNA dlls. If you are a game developer you will have the latest DirectX SDK anyway and if you have Visual Studio 2005, you will have the .NET 2.0 Framework too, so the only thing you need for running and even compiling XNA applications are the two XNA dlls:

  • Microsoft.Xna.Framework.dll

  • Microsoft.Xna.Framework.Game.dll

These dlls are referenced in all XNA projects, so if you just add them to a project in Visual Studio 2005, you can directly start coding. To get started just copy over the Game1.cs and Program.cs files from an empty XNA project you created with XNA Game Studio Express.

Another problem could arise if you work on a 64-bit operating system like Windows XP x64 or Windows Vista x64. Though DirectX 9.0c has had 64-bit dlls for some time now and the .NET Framework runs fine on 64 bit too, the problem lies in the XNA Framework, which is only available in a 32-bit version (called x86, by the way). People using the 64-bit operating systems of Windows had the same problem in the past with Managed DirectX, which is only available for 32 bit too. Using a 64-bit operating system does not mean you cannot use 32-bit applications anymore; quite the contrary. Almost all applications that exist today are written for 32-bit operating systems, but they run fine in the 32-bit mode of Windows XP x64 or Windows Vista x64.

Why do I even bring this up if you can run 32-bit and 64-bit applications on 64-bit operating systems? Well, you cannot use 64-bit assemblies (dlls) from 32-bit applications or vice versa. The reason for that is that a Windows process has to be run either in 64 bit or 32 bit; emulating 32 bit from 64 bit would be too slow and is not even supported. Now how do you get XNA working in 64-bit mode? You don’t, it is just not supported. Instead you have to make sure that the .NET Framework and your application run in 32bit mode, then Windows will start the whole process in 32-bit mode and you can load the XNA dlls just fine. If you don’t do that your game cannot even be started on any x64-bit platform.

In Visual Studio 2005 you can just select “x86” platform instead of “All CPUs” in the Project image from book Properties image from book Build screen. In XNA Game Studio Express there is no such option and if you want the same setting you have to add a line to your .csproj file in each PropertyGroup section:

  <PlatformTarget>x86</PlatformTarget> 

I also wrote a little tool that converts XNA Game Studio Express projects to Visual Studio 2005 projects and back, and it also handles the x64 bit issue. You can download it on my blog at http://abi.exdream.com.

Configuring Your Xbox 360

To connect your Xbox 360 to your PC you have to install the XNA Framework on your Xbox 360 first via the Xbox Live Service. Unlike the Windows platform the download of the XNA Framework for the Xbox 360 is not free. You will have to join the “Creator’s Club” subscription on the Xbox 360 through the Xbox Live Marketplace for $99 a year or $49 for four months. Microsoft does this to have a little control over the developers. Console development is usually very closed off and there is no open source thinking like in the Windows or Linux world. We can all just hope this is going to change.

First of all make sure your PC and the Xbox 360 are connected to the same network. You don’t have to connect the Xbox 360 directly to your PC; just plug it into the same network (router or modem). It is important that you always have access to the Internet from the console and not just to your PC because XNA requires an Xbox Live connection on your console. Once you have installed the XNA Framework on the Xbox 360, which also includes a custom version of the .NET 2.0 Compact Framework to make it run on the console, you can start the XNA Game Launcher (see Figure 1-8).

image from book
Figure 1-8

In the XNA Game Launcher you can now start your game projects or copy over XNA games from your friends or the Internet and start them on your console. Before you can connect to the PC you will have to make an encryption key first by clicking Settings and then “Create Encryption Key.” You will now see the encryption key; don’t close this window. On your PC open up XNA Game Studio Express and go to Tools image from book Options and scroll down. You will see the new XNA Game Studio option. Here you can add your Xbox 360 and enter your encryption key, and just click Add (see Figure 1-9).

image from book
Figure 1-9

After you have successfully entered the encryption key, you can click OK on both the PC and the console. If this failed or you reinstall XNA Game Studio, you can always get a new encryption key and enter it again here.

From now on you can create Xbox 360 projects and deploy them to your console, which can be done in the XNA Studio build menu. If you start to debug a project with F5 it will get deployed too and you can directly debug it on your console, which is pretty cool because you can step through code on your PC and immediately see the results on your Xbox 360 (kind of multi-monitor developing for free). Read more about running your first game in Chapter 2.




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