Saturday, September 24, 2011

Physics Helper XAML for Metro WinRT

Today I released an initial Alpha version of Physics Helper XAML - which allows you to easily create 2D physics based games and simulations for Windows 8 Metro Apps using C# or VB. It is a port of my previous Physics Helper project and uses the Farseer Physics Engine


As you'll see, Physics Helper XAML is a rewrite of the Physics Helper project for the following reasons:
  • When I initially started porting the Physics Helper to Metro, I assumed I would be able to fix any compatibility issues by using compiler directives as I have done in the past with WPF, Silverlight, and WP7. But as I quickly found out, there are so many little differences that the code quickly became cluttered. Additionally, there are changes on the XAML side which are not easily danced around because there are no compiler directives for XAML at this time.
  • Behaviors were used extensively in the original Physics Helper, but are not yet available for Metro app development. In fact, there is no version of Blend available yet for Metro apps - so who knows for sure if Behaviors will make the cut for Blend 5?
  • This gave me a great opportunity to clean up and simplify the code! The Physics Helper has been around since Silverlight 2 and has gathered some baggage through the addition of Behaviors, changes to Silverlight, and the addition of other platforms. So this was a great chance to... er.. "re-imagine" the code.
Getting Started

I encourage you to read the Documentation for details on using the new Physics Helper XAML classes. I think you'll find them very simple to use and quite performant.

What's Next

My personal goals are to port some of my Windows Phone 7 Silverlight Games to Metro using this new version of the Physics Helper. A secondary goal I have is to back port Physics Helper XAML to Windows Phone 7 and Silverlight, with the hopes of having a single code base again to support these other platforms. Again, because of all of the changes in Metro and WinRT, I am not positive this will have a great outcome - but it is definitely a goal I will strive for!

In the meantime, I hope you have some fun with this new set of controls!!