It’s been a while since I posted anything to the blog as I tend to use Twitter these days for gamesy stuff but I thought I’d recap exactly what I’ve been doing these past few months in Pumpkin Land.

I’ve been keeping busy converting various bits n bobs of Java, frameworks and libraries to C#, in an attempt to release some of the awesome games from Puppy Games on the iPhone via the awesomeness that is Mono / Mono Touch.

I’ve worked with the Puppy guys in the past, bringing Ultratron to the Xbox 360 via XBLIG / XNA Games Studio and entering a Droid Assault WIP to the 2011 Dream Build Play contest (we didn’t win).

Previously, I’d used a hybrid approach when dealing with the Puppy code in XNA. A bit of their stuff, a bit of mine, the Content Pipeline, etc, in a mash up of conflicting styles and designs goals. And while this worked, it involved a fair amount of hacking, bug hunts and lots of head scratching trying to fit square puppies in round, pumpkin shaped holes.

So, this time would be different! I’d convert the whole Shaven Puppy Games Library (SPGL), their support tools, their reflection based resource loaders, their GUI, the lot! Oh, and therefore any bits from The Lightweight Java Game Library (LWJGL) that the Puppy engine utilised. It would be a fairly complex conversion but ultimately make converting the games much, much easier.

I started sometime in October, maybe the 14th and by mid December I was done. A minimal SPGL proof of concept app running in the iPhone simulator on my brand new shiny MacBook Pro. Sprites, music, SFX, arbitrary geometry, text, touch all present and correct.

The actually journey from Java source to running appplication wasn’t too bad. A few folks commented that it should be a breeze to convert to C# due to the similarity of the languages, and while mostly right, there were a few bumps along the way.

Firstly, I ‘needed’ a new Mac. Mine was old and slow and the keys were silver instead of the new flat black ones and, ok then, I just wanted a new one. Then I had to set up the Mono environment which was quite difficult for someone that bootcamped Windows pretty much exclusively on the old one. Where do the libraries go? Ah, Nant is compiled with MCS and I want a v4 compler so I need DMCS, blah, blah, blah. I shouldn’t complain though as without Mono none of this would be possible. And it really is an outstanding piece of work created by magic, pixie dust and lots of hard graft by the folks at Xamarin

Next was down to a combination of too many late nights and grand incompetence on my part. Trying to run my Mono code on the iPhone. That’s desktop code. On the iPhone. What was I thinking!? Once I realised what I fool I’d been I created some Mono Touch solutions, referenced the correct framework libs and we were good to go.

Then there was all the Java bits ‘missing’ from C# that I needed to either duplicate or rewrite. I chose to duplicate and spent some time in java.nio, java.io etc dragging more and more bits of core functionality in until finally drawing a line, adding some NotImplemented exceptions and commenting out some stuff that probably will never be called anyway.

Generics are different. A bit of head scratching there. Annotations / Attributes close enough to hack around a solution (no generic attributes allowed in .Net). Reflection pretty much the same really just different keywords so I either added extension methods or changed the source code to be more Dot Netified. Default scope rules are different, no biggie though. Checked exceptions – gone. Iterators to foreach mostly ok (except for list modifications while traversing) and probably a few others that I forget now.

I must thank Cas Prince for putting up with me hassling him late at night on Skype about Java syntax or functions or why my sprites aren’t showing / are the wrong colour!

So there we are. All ready to go in the new year, hopefully with some cool games for desktops, mobiles and tablets. Cas will do the Java side and I’ll port to iOS.

Merry Christmas.

PS – I’ve also got a Windows Phone 7 / Xbox ports done now too. Happy days 🙂

Leave a Reply