Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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

  • This topic is locked This topic is locked
24 replies to this topic

#1 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 17 January 2011 - 12:23 PM

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.

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.

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

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

Sponsor:

#2 Zack T.   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 January 2011 - 12:58 PM

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.

#3 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 17 January 2011 - 01:04 PM

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

#4 Quanta_StarFire   Members   -  Reputation: 146

Like
0Likes
Like

Posted 17 January 2011 - 01:32 PM


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?

#5 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 17 January 2011 - 01:47 PM

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

#6 Mohanddo   Members   -  Reputation: 109

Like
0Likes
Like

Posted 17 January 2011 - 02:11 PM

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 :)

#7 Zack T.   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 January 2011 - 02:20 PM

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.

#8 Quanta_StarFire   Members   -  Reputation: 146

Like
0Likes
Like

Posted 17 January 2011 - 02:31 PM


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?

#9 dhulli   Members   -  Reputation: 204

Like
0Likes
Like

Posted 17 January 2011 - 02:44 PM

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....

#10 Puyover   Members   -  Reputation: 189

Like
0Likes
Like

Posted 17 January 2011 - 02:49 PM

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

#11 Chr0n1x   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 January 2011 - 03:34 PM



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?


For MSDNAA you have to ask your IT department if they have a subscription, however for a CC membership you just need to visit www.dreamspark.com and link your Live ID to your student email - most universities and colleges are signed up there and they just authenticate you with the university.

#12 SiCrane   Moderators   -  Reputation: 9626

Like
0Likes
Like

Posted 17 January 2011 - 03:44 PM

One thing to mention is that the Platformer project mentioned at the end of Chapter 1 is missing from XNA Game Studio 4. An update for that has been posted in MSDN blog entry here.

#13 Slateboard   Members   -  Reputation: 202

Like
0Likes
Like

Posted 17 January 2011 - 03:56 PM

I see someone answered the questions about dreamspark already.

#14 Half_Duplex   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 January 2011 - 04:12 PM

If anyones interested, this blog entry helped me with converting some of the code to 4.0 in Ch 3.....

http://blogs.msdn.co...studio-4-0.aspx

There's also some other entries about differences with 4.0 there that were helpful.

#15 Steve25   Members   -  Reputation: 130

Like
0Likes
Like

Posted 17 January 2011 - 04:21 PM

If anybody needs some help converting the XNA 3 code to XNA 4 I've already been through these chapters and I have done so myself. Post them here and we should be able to help. As for getting a free Creators Club Subscription, this is true through either DreamSpark or through the Academic Alliance

#16 shawnre   Members   -  Reputation: 266

Like
0Likes
Like

Posted 17 January 2011 - 04:51 PM

I know it was said that big-endian vs. little-endian isnt relevant yet, but could someone elaborate on that a little more? Maybe a general synopsis of the concept.

Thanks!

#17 Chr0n1x   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 January 2011 - 05:20 PM

I know it was said that big-endian vs. little-endian isnt relevant yet, but could someone elaborate on that a little more? Maybe a general synopsis of the concept.

Thanks!


Endianness refers to the order in which bytes are arranged in memory.

For example in a little-endian machine (x86) a 4-byte integer would be stored with the least significant byte first, so when viewing the four bytes (A,B,C,D) you would see it as D,B,C,A, where D is the least significant byte, and A is the most significant byte.

The 360 on the other hand is big-endian, and so it stores its bytes with the most significant byte first (or A,B,C,D) - when communicating between the PC and the XBOX over a network - or when sending files, you need to reverse the byte order to ensure the PC (or Xbox) reads the data correctly.

Here is a visual example that might help: http://en.wikipedia....0C0Dh_in_memory

If you are only working on one platform, or you are not communicating between them then you do not need to worry, however it is always good to know and remember in case you want to do this in future. Some nice little tricks can be used for development on the XBOX if you setup a system to communicate between PC and XBOX (or even WP7)

#18 silverwaves   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 January 2011 - 05:26 PM

if you are going to be using the 360 game pad on the pc/lappy you will need to download the drives for it aswell
which you can get from
http://www.microsoft.com/hardware/download/download.aspx?category=gaming

#19 toddworld   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 January 2011 - 05:34 PM

Sorry if I missed it up above but I don't see it anywhere....what was the name and author of the book again?

Thanks,
Todd

#20 Chr0n1x   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 January 2011 - 05:37 PM

Sorry if I missed it up above but I don't see it anywhere....what was the name and author of the book again?

Thanks,
Todd


http://www.amazon.com/Microsoft-XNA-Game-Studio-Unleashed/dp/0672330229/





PARTNERS