Monstercraft Postmortem Part 2: XNA and WP7
The game that eventually mutated into Monstercraft was first targeting Xbox360 when development started in 2008. We’ll go into the nitty gritty in a future post, but for now we’ll focus on the final few months of development. Sometime around spring/summer of 2010 after Windows Phone 7 was announced, I decided to switch the focus to touch based input with the plans of supporting WP7, iOS and possibly other touch devices.
I took what I learned from porting Zombie Outhouse between the various platforms and created a system that would automatically scale the game to the various resolutions. Specifically, the supported resolutions were 480×320 for original iOS, 960×640 for iOS Retina Display devices (iPhone 4 and iPod Touch 4G) and an in-between resolution of 720×480 for Windows Phone 7. The WP7 resolution is perfectly in between the two iOS resolutions.
The native resolution for the Windows Phone 7 is 800×480 so you get black bars on the sides of the game screen. Yes, it’s not using the full screen, but it’s the only way to keep the aspect ratio the same across all platforms. Also, WP7 handles scaling/centering automatically so that saves some development headaches. There was no support for the 1024×768 iPad resolution because it was a very different beast and I decided to hold off worrying about it until later.
I wrote a special container class that stored all the coordinates for various textures, screen positions, etc. I used the lowest res as a base size (for iPhone OG resolution) and scaled everything up by 1.5x for WP7 or 2x for iPhone4 when it initialized. It helped to space out all objects on-screen on even coordinates so it scaled smoothly for the WP7 version.
As in Zombie Outhouse, I had two sets of textures and fonts, 1x and 2x versions. The WP7 version loads the 2x version so its graphics would remain as sharp as possible.
I am still refining this process for future games and eventually would like to figure out an automatic system for supporting the full 800×480 resolution for Windows Phone 7.