My February game for my one game a month challenge is now complete and in apple's hands for approval. In designing this game I always intended it to be available for both iOS and OS X even though I knew nothing about OS X development. I expected the conversion to be a complete disaster but everything actually went better than expected...
My preparations were actually quite simple:
- Minimised usage of UIKit until it was nearly completely unused.
- Made sure to use % of self.size coordinates instead of hard coded coordinates where possible.
- Made sure that any variables or defined code that relied on device type or screen size to be stored in my constants.h file so it could be easily modified.
As you can see, my preparations were rather minimal. We are talking about a very small time investment in order to get my game on another platform.
The conversion itself was rather painless:
- I created a new Mac OS X Sprite Kit project and dumped my game in to it.
- Setup the appDelegate to point to my first game scene.
- Went through each scene replacing Touch events with Mouse click events.
- Fixed links to plists, the way I referenced them in iOS didn't work for Mac OS, I believe using the code I changed it to in iOS as well will resolve this issue in the future.
- Fixed some game center differences.
- New Icons, profiles, settings, etc
The process took less than 4 hours and in the future I expect it to be a lot quicker now that I have learnt a few things. I plan to make all future SpriteKit games completely cross platform (assuming Mac OS X sales will be reasonable).
I know this post was vague, drop me a line if you want a tutorial.