Wednesday, 22 January 2014

Moving from Windows Phone to Windows 8 Apps (The Silverlight Story)

So we begin the journey.  Last night I started investigating what I could and could not do with Windows 8.  I have a number of Windows Phone games that I was thinking to port to Windows 8.  The problem?  They use graphics in Silverlight libraries.

After much searching and gnashing of teeth I found an MSDN article that explains things far better than I ever could.

http://msdn.microsoft.com/en-us/library/windows/apps/hh465136.aspx

If you wrote your Windows Phone app using Silverlight (pretty much all WP7 was Silverlight) you CAN port it to Windows 8.  This article gives you the "search and replace" pieces you need so you don't have to pick stuff off one at a time.  Change this reference to that and so.  Read the article, life will be good.

Unless...

There is one bit of code I used from a gentleman in England by the name of Ed Smale that wrote a really slick Silverlight 3D dice simulator.  I used it (with his permission of course) in several games for Windows Phone 8.  They turned out pretty good and looked VERY good.  Ed does good work but he doesn't do Windows 8 (yet?).

Pig: http://www.windowsphone.com/s?appid=74821196-a8da-49f7-b589-e4c854ad8ee9
Two Pigs: http://www.windowsphone.com/s?appid=39018e3c-7d83-44cf-90ed-9da44fd9e95b
Stuck in the Mud: http://www.windowsphone.com/s?appid=aaabb666-17f2-4a44-b322-04b5722bf32f
Chicago: http://www.windowsphone.com/s?appid=bd300290-6d60-4d5c-9dc5-b5bae6c5ffdf

So I tried doing the conversion thing according to the library above.  Until I got to his Silverlight3D.dll library.  I just couldn't convert that.  The general rules seems to be Silverlight that looks like normal XAML will work fine.  Silverlight that looks like XNA (animation and games) will not.  You need to learn DirectX and rewrite things.

So, at least for me, that was a dead end.  I'm now faced with either doing something else (I rarely give up that easy) or doing differently.

I found on Codeplex a 3D dice simulator that I'm looking at but haven't decided on yet.  You may want to have a look.  Its DirectX and gives source code for both Windows 8 and Windows Phone 8 with a common library.

http://diceroller3d.codeplex.com/

It's pretty primitive and probably would need a lot of polishing to be used in an app but we will see where it goes.