Monorun for Windows Phone

August 19, 2013

When you want to test out a new language or a new development process, monorun is a perfect candidate for porting. The reason is that monorun contains most of the key components that make up a game. It’s got assets, interaction, score and highscore.

When we started developing the web-version, we didn’t have any plans of taking the game any further. But when a friend of mine asked for permission if he could port the game to Android (Java), it hit me. I wanted to port the game to Windows Phone.

And to make things better Microsoft had a deal on the windows phone developer license this summer, costing me only $19.

The process of porting the game hit a few snags at first. I wanted to use XNA, but Microsoft has decided not to add support for it on Windows Phone 8 (it’s compatible, but you lose WP8 specific functionality). I decided that I was going to use the Open Source implementation called MonoGame. I started working on the game, but when I was playing around with the touch gesture functionality I hit a bug in MonoGame, you couldn’t retrieve the touch position, which is “kind of” critical for monorun. I upgraded to the latest version, but no luck, the bug was still there. So I switched over to XNA and targeted Windows Phone 7.1 and upward (which I guess in the end was quite good).

Once I got going with the port, I noticed that building the game with C# and XNA was a lot easier than what it was building it in javascript. I could’ve finished the game a lot quicker, but I didn’t feel like grinding through my spare-time like I did with the web version.

monorun_for_windows_phone

I needed the game to be able to talk with the API, and I knew that Johan (who is building the android version) will also need access. So I updated it so that it doesn’t only rely on the built in cookie-session handler. When you start the game, you’ll have to make a request to the API which in turn gives you a session ID that you’ll have to use when you post the high score. I also added documentation of the API so it would make third-party implementation easier.

As I was looking into collision detection in XNA, I found this video, which describes a quite similar technique that I’ve used, only a lot more efficient. So after I had implemented it in my phone app, I naturally ported it over to the javascript game.

Because monorun was, and is, a learning experience, I’ve uploaded all the source code for the game on github.

And without further ado, let me introduce you to Monorun For Windows Phone, and I’ve set the price at an reasonable level of zero dollars.

The hero image was based on the excellent psd from Liwen Guo

Tags