Since completing my first iPhone app and having it published on the AppStore, I’ve been held by the idea that I should write an app for the Windows Phone 7. Since this is a small market at the moment, it’s an ideal time as getting noticed is more likely.
With this in mind, I’ve decided to write a small game. One that might make me some cold hard currency. I came up with an idea for the game whilst out for run. It’s pretty simple and whilst it won’t win me any awards, it should be simple enough to write. To makes things even more interesting, I’m going to write the game for both the Windows Phone 7 XNA platform and the iOS platform. I should be able to write the code in parts, making sure each platform functions correctly as I go. Phew.
Platform Differences
These two platforms have significant differences, but some similarities too. Aside from the obvious ones, like manufacturer, the differences are mainly superficial. Both have a very narrow hardware range. The iPhone has only four models and their specs are predictable. The WP7 has many more models, but they base specification for all these devices is the same. This makes the experience predictible on both platforms. Since the iPhone has been around much longer, older models of the hardware get taken out of the equation.
Development Differences
When it comes to developing on these platforms there are some differences too. Thankfully, writing code is writing code, so once the basic components of an application are understood, the differences are really down to IDE, API and programming language. Whilst developing Caffeine Club, I’ve become quite adept at switching from Objective-C to C# so this won’t worry me too much.
iOS Development
Development on iOS is done, as mentioned, in Objective-C and C++. For the purposes of game development, the Framework of choice is Cocos2d. This is an external framework as there are no dedicated game related frameworks in the iOS SDK. The recently launched Xcode 4 is Apple’s IDE and whilst it’s very powerful, I’ve yet to see it match Microsoft’s offering. I think I need more keyboard shortcuts 😉
For physics, the Cocos2d framework comes bundled with two physics engines – Box2D and Chipmunk. The former is a C++ library and if offers some very powerful simulation features. Chipmunk is an Objective-C library and whilst very comprehensive, it’s not as powerful as Box2D. Whilst the C++ syntax can be a little scary, I’m going to go with Box2D.
Windows Phone 7 Development
Unlike iOS, WP7’s SDK includes a technology called XNA. This framework is the game development platform for both the XBox 360 and the Windows Phone 7. It can also be used on any .Net platform. It’s effectively a framework designed and build for the purpose of writing games. This makes it easier to get your game “off the ground” as it were. Visual Studio 2010 is the IDE I will be using. C# is the language of choice too.
In terms of Physics engines for WP7, the Farseer Framework is what I will be using. This is a very robust engine and offers a very easy programming model.
Common Bits
I’m going to try a tool called Tiled for developing my levels. This is a tile based level generator, that is compatible with both Box2D and Farseer (the former I’ve tested, the latter I haven’t). This will mean that any levels I build, should be compatible with both platforms.
As for audio, I’m clueless. I’d imagine this will be MP3, but I’ll figure that out at the end. Cocos2d does include an Audio specific framework and XNA also has an API for audio, so it shouldn’t be too difficult. Well, less difficult that getting the sounds in the first place!
Source Control
For this I’m going to use Git. I would have preferred to use Perforce, but XCode 4 has dropped native support for Perforce and added native support for Git. I need to get an add-in for Visual Studio 2010, but I’m sure there is a compatible one.
I’ll be hosting my source code in the “cloud” somewhere. I’m testing some vendors at the moment to ensure it all works.
Wish me luck
Finally, please wish me luck. This is a totally bonkers I’m committing to, but it will be one hell-of-a learning experience if nothing else. I’m still trying to figure out how to structure my posts and whether I’ll alternate between iOS and WP7 or whether I’ll post the code side-by-side. I’ll do a few posts and find out.
Hopefully, somebody will find this informative.