If you want to create some fun physics-based games for this upcoming platform, you’ll first want to first visit the Windows Phone Development site and download the tools you’ll need.
The Physics Helper Library is a collection of Behaviors and UserControls that make is easier to create 2D physics games in Silverlight using the Farseer Physics Engine. The Physics Helpers have gone through several different iterations – in their original release for Silverlight 2, they were solely UserControls; in Silverlight 3 support for Behaviors was added, and later WPF support was added into the library, thanks to contributions from the community.
Now that everyone, including myself, is hyped about Silverlight on the Windows Phone, I was eager to get the library working under the new emulator, and it turns out that it didn’t take much effort at all because of the great job the Silverlight team did to make Windows Phone a “real” Silverlight (version 3) implementation!
Because Windows Phone contains a true Silverlight 3 implementation, assemblies are binary compatible, and you don’t even need to recompile the Physics Helper assemblies for the Phone. In fact, all I needed to do was remove a reference to System.Windows.Browser (as that is missing on the phone), and I was up and running.
Another Physics Sample!
Pete Blois (on the Microsoft Blend team), has also ported his Box2D Engine based samples to the Windows Phone and created a really neat physics based game which he demoed at MIX10. If you want to check out the Box2D engine instead of Farseer, you can check out Pete’s work.
Accelerometer Support
The Windows Phone doesn’t have any useful hardware buttons for games, so you can bet that the Accelerometer on the device will be very important for input. Mike Harsh gave a great presentation at MIX where he explained the axes of the Accelerometer:

As the device is tilted, you’ll usually get a value between -1 and 1 for each axis. I say usually because if you fling the device around you could actually get a bigger number – that’s because the value is based on G-force. At least, that is the idea, I haven’t had my hands on an actual device to confirm J
The problem is that the emulator included with the Windows Phone developer tools does NOT simulate an accelerometer. But in chatting with Pete Blois, a good workaround for now is to use a mouse drag event to emulate the accelerometer “tilt.” You can see this method in the Sample project at the top of this blog post. Note that there is an “AccelerometerWrapper” class which handles the Perspective Transform and mimicking the Accelerometer with mouse movements. Again, I haven’t tested this on an actual device but from what I’ve heard this is a good simulation of the accelerometer data.
The Sample Project
Let’s dissect the sample a bit. Because of the similarities in code between browser-based Silverlight 3 and Phone-based Silverlight 3, I am taking the approach of a single solution that contains both a SL3 project AND a Windows Phone project. Then I am using a linked file to reuse the exact same code for the main game user control (ucMainGame):

I think I will stick to this approach because it will allow supporting multiple platforms (web + phone) with a single project. And to be honest I’m not all that happy with the Windows Phone Emulator’s speed so for most debugging tasks I can stick with the Silverlight 3 web project.
More Resources
If you’re new to the Physics Helper, check out the videos and info at http://physicshelper.codeplex.com.
If you’re new to Windows Phone Development (like all of us), you’ll be happy to know that 90% of the game is knowing Silverlight. But for the other 10%, check out these sessions from MIX:
Changing our Game – an Introduction to Windows Phone 7 Series
Authoring for Windows Phone, Silverlight 4 and WPF 4 with Expression Blend
Overview of the Windows Phone 7 Series Application Platform
Building Windows Phone Applications with Silverlight, Part 1
Building Windows Phone Applications with Silverlight, Part 2
Silverlight Performance on Windows Phone