XNA 4.0 Workshop - Week 1 (Ch. 1-3)

Started by
23 comments, last by JWalsh 13 years, 3 months ago
Hey All,

Welcome to Week 1 of the XNA 4.0 Winter Workshop. Each week there will be 30-50 pages of reading to be done, plus some supplemental materials which may be provided by myself or one of the other students or mentors. I know it's a lot of reading, but it's necessary if we're going to get through the entire XNA Framework and Library in 16 weeks.

[size="4"]Reading Assignment

Chapter 1
Week 1 starts off the workshop slowly with a guide on getting XNA 3.0 (now 4.0) installed on your computer. This is an essential first step as you're not going to progress very far in the workshop if you don't have XNA Game Studio 4.0 installed on your machine. With that said, the instructions are a bit out-dated. As of XNA 4.0, XNA Game Studio is now integrated into the "Windows Phone Developer Tools" and is installed along side The Windows Phone Emulator and The Express Edition of Visual Studio 2010. You can get the required download from the AppHub Download Resources page.

This was confusing to many people at first as it seems to suggest XNA is now only for developing Windows Phone games. While XNA is the only way to develop hardware accelerated games for Windows Phone 7, it is NOT just for developing Windows Phone games. Once you've installed the Windows Phone Developer tools you can launch it or Visual C# 2010 (Express or Studio) and make games for both PC, Xbox 360, AND Windows Phone.

Note: The Windows Phone Developer Tools only works on Windows Vista or Windows 7. If you happen to have Windows XP still (upgrade to Win7), there is a separate installer that just includes the XNA Game Studio 4 extension to Visual Studio 2010. In this case, you will not be able to develop WinPhone7 games and you'll need to have a separate version of Visual Studio 2010 pre-installed on your machine. As with previous versions of XNA, the extensions work for both the full Visual Studio 2010, as well as the express edition.

Chapter 2
Chapter 2 of the book assumes you have an interest in developing XNA games for the Xbox 360 and shows you how to create an Xbox 360 game, how to purchase the required Creators Club Subscription (if you're interested in deploying to the Xbox 360 - not required for the workshop), how to connect your Xbox 360 to your PC via a LAN connection, and finally, how to deploy and debug your game on the Xbox 360. After that, it goes into basic information on how to manage games for multiple platforms, including how to copy your project from one platform to another. With XNA 4.0, Microsoft has added the Windows Phone platform as well. So any project you make for either PC, Xbox 360, or WinPhone 7 can easily be exported to another platform with a few clicks. Note also that XNA Game Studio 4.0 comes along with a Windows Phone Emulator. So even if you do not own a WinPhone (Like me), it's still possible for you to "test" your games on that platform.

As a side note, deploying to the Xbox 360 or WinPhone emulator is a time-consuming process, and debugging is also more tedious. In general, I like to develop a game for the PC first, work out all the bugs/kinks, and then port the game to the chosen console. This means I have faster iterations while developing the game, and only really need to spend time deploying to the consoles when I test the games on those platforms. Does this sometimes mean I'll have unexpected surprises when I change platforms? - Yes. But the time I save in development more than makes up for the time I spend trying to figure out what's different on the new platform.

Note: As the workshop progresses I'll point out key differences between the consoles so there's fewer surprises for readers. The first, which isn't entirely relevant yet, is that the x86 architecture is a little-endian architecture, while the Xbox 360 is big-endian. This means if you're serializing data between PC and Xbox 360 (such as with networking or shared files), then the order of your bytes within a word or dword will be wrong. The Windows Phone 7 is bi-endian, so it's up to the OS to determine. Fortunately, the .NET Compact Framework has a static field that allows you to test whether your application is running in big or little endian: BitConverter.IsLittleEndian.

Chapter 3
Chapter 3 is on "Performance Considerations" and is designed to help readers realize that XNA is a managed framework, and as such has some performance and memory caveats which you need to be aware of. Many of the suggestions in here will be intuitive for experienced C# or Java developers. If you're new to the Managed scene, make notes and then move on. I have a phrase I often repeat to my junior developers which I heard many years ago when I was learning about eXtreme Programming: "Optimize Last." While it is important to develop with memory and performance limitations in mind, it's far too easy to get caught up in the "optimization" phase of development and forget to actually finish the project. This is a form of procrastination for many people. So while you do need to "Measure, Measure, Measure...." don't start measuring and optimizing until you've finished the project or until you reach a point where performance is so poor it makes development difficult.

The second part of Chapter 3 is source code for a benchmarking framework. Please note that it will not compile for XNA 4.0 as XNA 4.0 had many breaking changes in the Graphics API as well as the GameTime class. I'll provide functional XNA 4.0 Source Code a little later (my laptop is out of juice and it has my projects on it), as well as supplemental material indicating why the source code doesn't work.

[size="4"]Supplemental Reading

Below is a list of supplemental reading that might help this week's reading make more sense to you. I am likely to add to this list over the course of the week (or even the workshop) and will make an announcement when I've added additional reading or resources.

GameDevelopedia.net Tutorial #1 - This tutorial shows how to create your first "application" with XNA 4.0.
*RealTime Revisited - A blog post I did about the changes to GameTime class in XNA 4.0

[size="4"]XNA 4.0 Source Code

Chapter 2 Updated Source Code
Chapter 3 Updated Source Code
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Advertisement
Are we required to purchase the Creators Club membership for this? Or will we be mainly doing PC development until later on? I ask this because I cannot deploy to the 360, since I don't have 100 dollars to spend on the membership right now.

Are we required to purchase the Creators Club membership for this? Or will we be mainly doing PC development until later on? I ask this because I cannot deploy to the 360, since I don't have 100 dollars to spend on the membership right now.


Zack - Great question. The Xbox 360 Creators Club membership is not required for this workshop. I will be emphasizing PC development for this, while providing ports to Xbox 360 and WinPhone 7 where applicable, and also pointing out specific Xbox 360 and WinPhone requirements. But, you're not required to do either Xbox 360 or WinPhone development during the workshop.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

'Zack said:

Are we required to purchase the Creators Club membership for this? Or will we be mainly doing PC development until later on? I ask this because I cannot deploy to the 360, since I don't have 100 dollars to spend on the membership right now.


Zack - Great question. The Xbox 360 Creators Club membership is not required for this workshop. I will be emphasizing PC development for this, while providing ports to Xbox 360 and WinPhone 7 where applicable, and also pointing out specific Xbox 360 and WinPhone requirements. But, you're not required to do either Xbox 360 or WinPhone development during the workshop.


Is it mostly going to be mouse + keyboard input, or will there be focus on the 360 controller as well?

Is it mostly going to be mouse + keyboard input, or will there be focus on the 360 controller as well?


If you only have a PC then all your input will likely be keyboard & mouse input, however we will cover all of the input devices in good detail.

If you do not have an Xbox 360 but are interested in working with the Xbox 360 Game Pad, you can pick up a USB powered one for the PC for around $40 at most game/electronic stores. If you think you may ever want to port your game to the Xbox 360 then I highly recommend doing so.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
I just want to mention that if you are a student, you can get a free XNA Creators Club Academic Subscription for 12 months from MSDNAA or Dreamspark. Although i am not sure if this subscription is version specific or not. Just wanted to put that out there :)

I just want to mention that if you are a student, you can get a free XNA Creators Club Academic Subscription for 12 months from MSDNAA or Dreamspark. Although i am not sure if this subscription is version specific or not. Just wanted to put that out there :)


My school was never recognized by the MSDNAA so I never could get the sub.

'Mohanddo' said:

I just want to mention that if you are a student, you can get a free XNA Creators Club Academic Subscription for 12 months from MSDNAA or Dreamspark. Although i am not sure if this subscription is version specific or not. Just wanted to put that out there :)


My school was never recognized by the MSDNAA so I never could get the sub.


Maybe I'm wrong, but don't you have to go through your school's IT department to get authorized to access it?
I don't know about high schools but for colleges you simply use the .edu email address for recognized colleges.
...it's like a cycle with every other MMO post. The poster first posts it without a template the day he joins. Then a month later posts it again this time with the template but due to the feedback stated as "ANY" he gets flamed badly. Recovering from such an event takes a couple of weeks before he dares post again but this time he remembers to state the feedback as "ENCOURAGING ONLY" and then no one posts and the project dies away. Tired, the poster returns to the confines of his cave and I don't know what happens after that....
I also recommend implementing the controls of the Xbox 360, aside from the keyboard. It is very fun to play with the vibration and can move objects with sticks =P

This topic is closed to new replies.

Advertisement