Since XNA and Silverlight are both supported on Windows Phone 7, a common question is which makes more sense for developing games. The definitive answer is “it depends”
Both technologies have their benefits and it would be great if we could eventually get to the point where you could combine the graphics capabilities of both in the same application and use the best tool for the job. Now I haven’t delved too deep into the changes in XNA for Windows Phone so I’ll be going mostly off of what I’ve experienced with game development on XNA in the past.
Generally writing a game will be easier in XNA since XNA was built from the ground up to be a game framework. Many of the decisions made when architecting XNA also make it a non-ideal platform for developing many other types of apps besides games.
The most notable architectural difference is the idea of a visual tree versus drawing everything every frame. In Silverlight for something to be displayed it needs to be added as the child of some other element. In XNA, everything is drawn every frame. If you don’t explicitly draw something it won’t show up. Which one of these is better depends on your game, but if there is a lot of action the XNA “immediate mode” type rendering will probably be the better choice.
Let’s take a look at some benefits of each (I’m sure there are more on both sides):
XNA Benefits
- Great support for 3D
- Superior performance when many elements moving or being added/removed
- Built in game loop
- XNA’s polling based input generally a better fit than Silverlight’s event based input for games
- XNA content pipeline makes handling large stores of content easier
- More image formats supported
- Can make game for both Xbox and Phone
- Graphics blend modes (Silverlight only has alpha blending)
- More GPU acceleration built in
- Lighter memory footprint for bitmap based games
- Superior shader support
- Drawing with a “tint” easier
Silverlight Benefits
- Vector graphics (XNA has some very basic line drawing support)
- Vector drawing of text (XNA text is bitmap based)
- Can make game for phone and web
- Storyboard animations
- Visual states and behaviors
- Navigation framework
- Controls (button, listbox, user controls, etc)
- Expression Blend design support
- Event based model is more familiar to many developers
- Data binding can come in handy in some scenarios
- VisualTreeHelper useful for determining what element is being touched
So if you have a game that’s vector graphics based, or relies on things like buttons and other GUI elements you probably want to choose Silverlight for your game development. If you’re doing a 3D game or a 2D game with a lot of motion or particle effects choose XNA. If you’re somewhere in between you may want to pick whatever you’re most familiar with, or it may depend on whether you also want to make the game available on Xbox or web.
It’s great that both options are available and you have the choice of which to use.