These ZIP archives contain source code from the book, XNA Game Studio Express: Developing Games for Windows and the Xbox 360, by Joseph Hall. The following paragraphs describe the changes that have been made from the XNA 2.0 version of the same code.
The Files
The update projects are compressed into ZIP files. They're separated based on the section of the book in which the example was developed, with one exception -- chapter 10's project is a monster beacuse of the WAV source files. That project has its own ZIP file.
Intuitive File Names
I used longer, more descriptive filenames for the solution files, project files, and directory names. The new names make it much easier to locate the source code for a specific chapter. This may cause issues if you do your development in a deeply-nested subdirectory, like the default Visual Studio project folder of "C:\Documents and Settings\{username}\My Documents\Visual Studio 2005\Projects\".
I suggest creating a folder off the root of the drive from which you wish to develop your XNA games. I use "C:\projects\" on my laptop, and "E:\projects\" on my desktop.
ZIP Anatomy
All of the ZIP files which host the book's source code use a parallel directory structure. I expect the user to download the ZIP files into a common directory, then extract the files from each ZIP directly into that directory, preserving the ZIP file's internal directory structure. For example, if you download PT1_CH04.zip, PT1_CH07.zip, and PT2_18.zip into the "C:\projects\" directory on your local PC, and then extract the files to that same folder, you should have the following directory structure on your local drive.
C:\projects\Part 1 - Introduction\CH04 - Graphics 2D\
C:\projects\Part 1 - Introduction\CH07 - Input GamePad\
C:\projects\Part 2 - Genre Studies\CH18 - Board Games\
Overview
The Project Conversion Wizard provides a point-and-click interface that will convert most of
your XNA 2.0 projects to XNA 3.x projects with no intervention at all. The following paragraphs
document where hiccups in the conversion process are likely to occur.
General Process
The *.sln solution files have a header that tells Visual Studio what version of the IDE was used
to create them. I created the XNA 2.0 solutions and projects in Visual C# 2005 Express Edition,
so the header for the solution files looks something like this:
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C# Express 2005
If you don't have a version of Visual Studio 2005 that supports C# projects installed on your PC,
Visual Studio won't know how to open the old (XNA 2.0) projects. So, I edited the solution file
headers to look like this:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Now, the solution is associated with Visual Studio 2008 (Professional Edition, in my case). When
you open the solution, the Project Conversion Wizard will automatically launch and you just need
to click "Next" a few times to convert your project to XNA 3.x.
A Note About My Development Environment
I just made the move to a MacBook so that I can write some applications for the iPhone
and iPod Touch. I've always done my XNA development in a virtual Windows XP machine, and that's
exactly what I'm doing now for my XNA 3.x work. To save space on the virtual hard drive, I only
have Visual Studio 2008 installed (discounting the VS2K5 instance that's installed when you
install SQL Server 2005, which doesn't support building C# projects).
So, the converted solution and project files that I'm posting reference the specific edition of
Visual Studio that I used to convert them. I have not tested these projects in Visual Studio C#
2008 Express Edition, but I don't expect you to have any problems if that's the version of VS
that you're using. If you do run into problems with these new projects, please let me know.
Chapter 24 - BrickBreaker Level Editor
While this project doesn't reference the XNA Framework, and it's not directly affected by the
conversion, I noticed some quirks in the converted project.
- The background color of the editor didn't match the background color of the
editor control. This may have been an issue with the original version as well,
but I went ahead and changed the background of splitContainer1.Panel2 to
ControlDark.
- The scroll bars weren't showing properly, so I reset brickBreakerEditorControl1.Size to
(480,480).
As an aside, don't forget that you can load the example levels from the game that we made in
Chapter 14. The level file for that game is named "example.bbl", annd you'll find it in the
"Part 2 - Genre Studies\CH14 - BrickBreaker\levels" folder.
Chapter 26 - Content Pipeline Extensions
I never updated chapter 26 (Content Pipeline Extensions) for XNA 2.0 because I wanted to dig a
little deeper into the changes that were made to that component from XNA 1.0 / XNA 1.0 Refresh
to XNA 2.0. I never got around to researching that, so this code is also excluded from the
XNA 3.0 / XNA 3.1 updates. Sorry about that.
I'm in talks with the publisher now to do a new
edition of the book, and if I start down that long and tiring path, I'll be sure to post the
code for Content Pipeline extensions long before the book is released. If I decide not to do
a new book, I'll be focusing on content for a new website that I'm developing with an artist
budddy, and I'll make a point to focus on Content Pipeline extensions.
Chapter 27 - Embedded Resources and Localization
The conversion for this solution isn't as point-and-click as the others have been.
Chapter 27 illustrates how you can use embedded resources in your games. Those resources are
precompiled using a "staging" project, isolated from (not referenced by) the other projects. To
get those pre-built resources into your game, you have to manually add them to the "Embedded
Content" project under the "Resources" subdirectory. So, the steps to get this solution
converted are:
- Convert the *.csproj project files using the conversion wizard.
- Rebuild the "CH27 - ERaL Resource Staging" project.
- Copy the *.xnb files from the "bin\x86\Debug\Content\media" folder to the
"Resources" folder of the "CH27 - ERaL Embedded Content" project.
- Rebuild the solution (which includes all the "CH27 - *.csproj" projects.
- Run the "CH27 - Embedded Resources and Localization" project to see the results.
Welcome.exe
I doubt that anyone ever looked at this console application that was included on the CD-ROM
that accompanied the book. It really serves no useful purpose in a web-based distribution of
the project files. I didn't bother to convert the project and solution files. If you really
want an updated version of this application, let me know. I might get around to it if I think
there's a demand for an update.
Thanks!
Thanks for your patience, guys! Enjoy the code, and let me know if you find any issues or need any help.
Oh, and if you're reading this blog post and you're asking yourself, "Book? What book?" -- click here to see what the fuss is all about. You can read Chapter 07 here, and Chapter 18 here. If you like what you see, please feel free to buy a copy of the book here.
-- joe