WP7 "XNA for Silverlight Developers" Series
XNA development can be an abrupt mental shift for those who've lived in a GUI client world. For those in that boat, myself included, XNA seems very "low level" (yeah, yeah, I know you Assembly/C++/MFC/I code IL in Notepad guys are saying, "HA!".. yeah... yeah... lol
Getting up that learning curve just-in-time can be tough. That's why when I saw this series from Peter Kuhn (aka Mister Goodcat), I wanted to call it out to you, to help you up that curve.
- XNA for Silverlight developers: Part 0 - Why should I care?
- XNA for Silverlight developers: Part 1 - Fundamentals
- XNA for Silverlight developers: Part 2 - Text rendering
- XNA for Silverlight developers: Part 3 - Animation (transforms)
- XNA for Silverlight developers: Part 4 - Animation (frame-based)
- XNA for Silverlight developers: Part 5 - Input (touch + gestures)
- XNA for Silverlight developers: Part 6 - Input (accelerometer)
- XNA for Silverlight developers: Part 7 - Collision detection
Around the time the first Windows Phone 7 devices were released to the market, one popular sentence you heard was "every Silverlight developer is a Windows Phone 7 developer" – and that's true. Silverlight is Microsoft's main platform to do Windows Phone 7 development, and every desktop Silverlight programmer will feel comfortable in the new mobile programming environment instantly. Sure there are differences and libraries specific to the devices, but you won't have to learn a new programming language or new ways to define your UI, and you can use the same development environment you've been using for normal Silverlight development all the time. That's great!
However, Silverlight is not the only possibility to create software for Windows Phone 7 devices, there's also XNA. Most people that are interested in developing for the new mobile platform probably have already read about it, mostly in the context of game programming. This article tries to give a quick overview of XNA on the mobile platform for Silverlight developers who have not dealt with XNA in detail before. It explains the possibilities of interaction between Silverlight and XNA, and why you as a Silverlight developer should care about XNA even if you don't want to develop games.
In successive parts of this series, we'll go into the details of programming 2D games for Windows Phone 7 using XNA, with special focus on those parts that require a change of thinking when you are coming from a Silverlight background. I strongly encourage you to comment on each part and request more information about topics you are interested in. If possible, your feedback will directly result in the design of future articles.
I liked the pragmatic advice in choosing a XNA or SilverLight path.
Choosing between Silverlight and XNA
Because XNA is a dedicated framework for game development, a lot of people perceive this as the only possibility to create games for Windows Phone 7; some even think it is a certification requirement to use XNA when you want to publish applications to the game section of the market place. This could not be more far from the truth. You are free to also choose Silverlight as your development tool for game creation. In fact, I know of several games in the market place that are made with Silverlight, and your decision on what technology to use should be made carefully to optimize your development process in terms of efficiency, depending on your requirements.
When to choose XNA ...
When to choose Silverlight ...
Each article in the series builds on the last and not only includes the source but better, the theory and concepts behind the source. Not just the how, but the why...
For example in XNA for Silverlight developers: Part 1 - Fundamentals he discusses one of the fundamental differences between SilverLight and XNA;
Event-driven vs. Polling
In Silverlight, when you are interested in any kind of data or information, the common way to get it is to subscribe to some sort of event (I also count callbacks and similar constructs to that). No matter if it is user actions you want to be notified about, the arrival of data from a returning asynchronous operation, or other situations that require transportation of information: the runtime, third party components, or even objects you have written yourself send you a notification whenever the data you have asked for is available. That also works the other way round. If you want to notify someone else that something interesting has happened, for example signal to a UI component that your data has changed, you raise events. We've all gotten used to interfaces like INotifyPropertyChanged, do we?
This picture is quite different in XNA. A lot of work there is done using polling. For example, instead of being notified by an event that the user has touched the screen, you actively keep asking the screen if something interesting happened since your last call. Like on that long trip in the car, when your kids in the back seat keep asking "are we there yet"; with XNA, you are the kids, and you ask 30 times a second.
As a starting for point WP7 SilverLight developers to get up to speed on XNA, this series is hard to beat.
Here’s a few more links you might find interesting:
- App Hub
- Mixing the Game State Management and Platformer XNA Recipes
- Mister Goodcat, Peter's blog
- Webday WP7 Preconf: Windows Phone 7 Application & Game platform - Silverlight & XNA
- Webday WP7 Preconf: WP7 XNA Game Platform - Deep Dive