Cocos2D and UIKit working together

I have been refactoring BocceBeers lately, and as a fan of tools such as Interface Builder, I didn’t have the time to really learn the ins and outs of CocosBuilder, and I already had working gameplay code, so I wouldn’t really need to rebuild the game in CocosBuilder because that would be a make-work project.

What I did need to do is make User Interfaces for the iPad version of the game that I am making.  So I thought, now that I’m an experienced App Developer, can I not just use UIKit and make NIB files?

The answer is yes.  I decided to go about making a general solution (demo project) for any of  you seeking to use UIKit for menu systems, but then leverage the power of Cocos2D for your gameplay.

I also created an asynchronous scene loading class which you can check out as well.

Please check out the demo project on github here.

Chipmunk Physics Library

Of course this post isn’t for everyone, but if you ever are in need of a physics engine in your game (or app for that matter), I can’t be more thrilled with the Chipmunk Physics Library, written by Scott Lembcke, over at Howling Moon Software.

It’s a 2D Physics Simulator, which I originally used years ago on BocceBeers, and with this latest upgrade, am using again.  The most important thing I find with 3rd party libraries (beyond doing what they say they can do), is documentation, examples (there are PLENTY), and support.

I have no idea how the author of this lib has the time to develop, market, and support his library, but whenever I post anything to the forums, he’s got it answered within 24 hours.  Every time.  It’s so amazing to not have to get stuck on a problem and wait for the developer to get back to you.   (Ever had a problem with Twitter on iOS… man…)

Anyway, go check it out for yourself.  There are some pretty videos.  🙂


Physics-based Animation not in a game? Great idea!

Was reading this post discussing Facebook Home and how they use a physics engine to drive animations (Nice site design, BTW), and got inspired. I mean, Apple provides quite a lot of APIs for us to use as iOS programmers and it’s easy to forget to think outside the box when they make things just so convenient.

Next time I have the chance, I’m going to try to make some prototypes with Chipmunk Physics, one of the 2 physics engines that is packaged with the Cocos2D Framework and the one I personally prefer since it’s really straightforward, really high performance, and has an Objective-C wrapper which keeps everything in a familiar flavour. I already know how it works thankfully, due to the work I did on my very first piece of self-made software, BocceBeers! (**note: I made BocceBeers years ago for iOS 3.x and haven’t updated it since… sorry.)

The question is, how do I tie into the run loop or do I just schedule a repeating NSTimer that updates the simulation? Research time!

(UPDATE: The Author of the library posted this to github that should form the basis of the work. Now it’s just about setting up interesting physics underneath and figuring out interacting the the objects.)