My latest iOS app, Shape Matcher, was recently released into the wild. It’s an iOS (available on iPad and iPhone) shape matching game for young kids’ – about all the gaming logic I can handle as a night-time Obj-c novice. Anyway, I figured it might be useful to others if I documented what software, frameworks and tutorials I used to develop it.
Inkscape is an awesome open source vector graphics editor. One of the things about writing a game is that you’ll probably need to draw some cute backgrounds or characters. Unless you’re a designer who already owns a copy of and knows how to use something like Illustrator or Photoshop, you’re going to want this software.
Drawing itself is a skill I don’t really have, and that really sucks. These days, apps have to look as good as they work. I might be good at writing software but I’m really not very good at drawing stuff – or at least that is what I was convinced of until Jas and I finally sat down and tried to learn how to draw digitally. We followed a fantastic tutorial called 2D Game Art For Programmers – Part 1 and by the end of it, we weren’t too bad at drawing some nice scenes and basic characters. All it took was for us to sit down and actually put our minds to it and it turns out that we’re not that bad at drawing after all!
If you plan on including lots of images in your iOS game, you might find it easier to use sprite sheets instead of lots of individual images. This is especially true if you plan on supporting different devices with different resolutions (because you need to supply resized images for each differently sized device). Zwoptex is a tool that allows you to create sprite sheets from your original images. You can then use Cocos2D’s built-in support to load the sprite sheets in your game. You can download Zwoptex for free, and if you don’t purchase it, it will take a couple of seconds longer to export the sprite sheets but it will still work properly otherwise. Much recommended!!
There seems to almost be a little bit of a cult following around Sublime Text. I’ve heard lots of well-known developers say that they use it as their primary code editor. It does seem to be nice and fluent. There are a few things about the UI that make it stand out. I use it when needing to copy plist values from the temporary files that Zwoptex outputs to my app ones. It certainly does the trick.
Most games have some sort of sound effects or soundtrack. Luckily cocos2d, the gaming framework I use, allows you to include sounds in your game really easily. But you still need to make your sounds or edit open source ones you find online. GarageBand provides a nice interface to do just this. You can then export them as .mp3 files and include them in your Xcode project. Simple!
cocos2d for iPhone is a framework for building 2D games. It adds support for important gaming functionality like transitions between scenes, sprites and sprite sheets, effects and actions, menus and sound… just to name a few. Shape Matcher is the second iOS game using cocos2d that I’ve worked on. Earlier this year, Jas and I wrote and released Easter Egg Hunt, also using cocos2d. So far we are both very happy with the framework as it provides a lot of functionality that I wouldn’t want to try and write from scratch. The only criticism I have right now is that the latest stable version, cocos2d-iphone-2.0, does not have support for the new iPhone 5 Retina Display screen resolution. Version cocos2d-iphone-2.1 beta3 does, but it’s still in beta. Either way, you can get around it in code if you need to.
Localytics offers integrated app analytics for your apps. They have an iOS library that you download and link to in your app. You can then track certain events in your app, such as when a user clicks a particular button or when they’ve spent a particular amount of time on any one scene. This information can be truly invaluable and the Localytics library makes it super easy to use. Their website, where you can view graphs about your app’s usage, is easy to navigate and nicely responsive. They aren’t free but they offer a free trial that doesn’t end, as far as I know. You have to pay to access some of the more interesting reports.
Although it can take months to write even a semi-decent iOS game, most people aren’t prepared to part with even $0.99 USD for it. I’m not quite sure I’m prepared to spend hours upon hours writing games that don’t make me a cent in return, but I would like people to actually play my games! In terms of games, this is where In-App Purchases come in very handy. You can put your game on the App Store for free, but sell extra scenes or options from within the game itself.
Luckily, Apple has made it pretty easy to integrate In-App Purchases in your application and theres a ton of help on the internet on how to use it. I used one of Ray Wenderlich’s awesome tutorials, Introduction to In-App Purchases, to learn how to include some in-app purchases in my game.
Tips and tricks
Below are a few more little tips and tricks to help you get going.
It’s a good idea to create both ‘test’ and ‘live’ versions of your app on Localytics so you can test your integration with them and not pollute your ‘live’ analytics. Just before you archive and submit your app to be reviewed, change the Localytics app ID in your code to the ‘live’ one. Don’t forget to do this!!
Although I totally missed it in the Apple documentation, apparently if you have any In-App Purchases in your app, you must provide a ‘Restore Purchases’ button in case the user installs your app on a new phone and has already made purchases. This button seems somewhat overkill since clicking on the buy button again will allow the user access to the purchase without charging them again but I guess it’s nicer for the user to click on a ‘restore’ button than a ‘purchase’ button. Apple app review staff will reject your app if you don’t provide this button. Ask me how I know this…
When creating the individual images that you’ll use in your game, export them in the largest size you’ll need them from Inkscape. Import them into Zwoptex to create a sprite sheet and save this workspace. You can then set up the publish settings to export one sprite sheet for each device resolution you want to support (except for the iPhone 5 that actually has a different ratio). When you press the ‘publish’ button, Zwoptex will create a spreadsheet per setting. This saves a lot of time when you’re writing a universal iOS game and keep making subtle changes to your drawings.
Below is a handy table of iOS device sizes that you’ll want to use in your publish settings for each iOS device:
So what are you waiting for? Go download these tools and get started on your first iOS game! If you have any questions, please feel free to ask :)