handcircus

A few days with the official iPhone SDK

(Warning, bit of a technical post). I’ve had a couple of days to play with the official iPhone SDK now that it has been released. Its obviously significantly easier to get things up and running now and theres a lot of documentation and a number of videos up at the iPhone DevCenter. First up, the presentation for the SDK launch was pretty impressive. Dual distribution, both via iTunes and the AppStore directly on the iPhone/touch and a 70% cut of the royalties is extremely fertile soil for development. £50 to sign up to be a registered iPhone developer (and allow signing of your apps) is not bad. They’ve obviously had a few inspirations from Installer.app (eg autoupdating of apps) and the whole package looks very streamlined and easy to use. They’ve handed out beta copies of the SDK, allowing anyone to have a go (even without an iPhone). The SDK includes a simulator, allowing you to run and debug your apps on the desktop, and also allows tethered running and remote debugging for a physical unit that you have plugged in (although you will need to have paid your £50 and got yourself a certificate, none of which Apple has released yet). The frustrating part is that without the certificate you are slightly crippled by the fact that the emulator won’t properly support the accelerometer or multitouch (other than basic pinch gestures) and most significantly for games, it wont allow OpenGL code.

That all said, its been great fun. I’ve been getting my head round the basics (Core Animation, Multitouch input, Quartz rendering), and am trying to piece together a toolkit for making games. First priority is rendering and a physics engine, so (much like the excellent iPhysics) I’ve been playing with Erin Catto’s wonderful Box2D engine, and ported the TestBed over to the iPhone just as a little warm up project to get my head round the SDK. I think Quartz might be a little slow but as soon as I can get a certificate I can start using OpenGL instead which should hopefully start to really allow more complex scenes.

Heres a little vid of the Box2D testbed running (although embedded vimeo doesnt work on Google Reader sadly):

Also, it looks like firmware 2.0 has already been leaked and hacked, bypassing the need for you to obtain a certificate from Apple. This should certainly speed things up for some.

12 Responses to “A few days with the official iPhone SDK”

  1. Andreas Says:

    This being a technical post, hope you won’t mind if I ask a technical question :)

    I’ve done a little bit of Objective-C, but only enough to glue together their screensaver framework with some C++code, but does this mean you can compile C++ code to run on the iPhone ?
    Or are you using a Objective-C port of Box2D ? ( a quick Google didn’t turn up anything )

    I’m super keen on doing some stuff for the iPhone, but I had nightmares the other night about converting lots of old C++ code to Objective-C :)

    /A

  2. handcircus Says:

    Yeah theres no problem mixing and matching C++, C and Objective-C. You just need to make sure any Objective-C files that import C++ headers or contain both have the extension “.mm”. I’m just using the vanilla Box2D 2.0 code. So you should be able to re-use everything :)

  3. Andreas Says:

    Excellent news, thanks!

  4. John Says:

    Nice article, I come from a PC and games programming background and as I’m waiting for my Mac Book Pro I haven’t had a chance to try out the new iPhone SDK so I would love to ask you these questions.

    Has anyone got an existing open source game/graphics engine running on the iPhone and which one would you recommend?

    Is it possible to start developing for OpenGL ES without a certificate either by unlocking the iPhone or by using the emulator? (from your post the emulator seems like it doesn’t work with OpenGL).

    Would it be best to use floating point maths? (OpenGL ES seems to use both fixed and floating point however from the looks of it floating point seems to be the correct choice so I just want to confirm)

    Cheers,
    John.

  5. handcircus Says:

    Hi John,

    A few people have been porting various libraries to the iPhone. Theres a port of SDL here - http://code.google.com/p/iphone-sdl-mame/ (open source) and a port of Yeti3D here - http://www.marcogiorgini.com/articoli.asp?art=112 (closed source)

    For physics, both Chipmunk and Box2d seem to be pretty easy to get up and running. I’m not aware of any full game engines that have been ported, I think its a matter of rolling your own for now out of your preferred libraries.

    For OpenGL you need to have a certificate to get started (the simulator wont let you run OpenGL ES code), even with the latest beta, and you cant test on the device without a certificate. I’m using floating point maths with Box2d without any probs.

  6. Pauliver Says:

    I was wondering if you would be willing to share you full box2d port and nice gui you made to go with it and the demos. I have to admit that I’m having a bit of trouble porting it myself [no real openGL experience, and objective-c is different...] and having it as a sample/starting point would be greatly appreciated.

  7. handcircus Says:

    Hi Pauliver,

    I’ll definitely work on publishing an iPhone port soon as I can. That version is out-of-date - it won’t compile on the latest beta and uses quartz rather than OpenGL so runs like a dog on the device. I’ll put something up on the blog soon as I release it

    Simon

  8. Liam Walsh Says:

    Hey Si,
    Awesome post. Maybe you could do a super technical post for people like myself who are trying to use the official SDK but still want the apps to actually appear on the phone. (I need accelerometer stuff). Trouble is Apple are not really playing ball until late June when I kinda sorta need this done long before then.
    Anyhoo, it’s a lovely platform and the first time I’ve felt the need to be involved in a mobile platform, ever. Despite knowing enough java and flash to get stuff onto any other mobile the iphone made me go out and learn objective c and the whole cocoa framework!
    Hope you’re well mate, take care and keep up the blogging.
    Liam

  9. handcircus Says:

    Yeah maybe I will do something a bit more technical soon. Apologies for the lack of updates - been really busy with a number of projects (new version of bountee and an iPhone game). The program is a lot more open now - I’ve been accepted so can now run apps on the device itself with the latest beta - you should definitely apply, it costs about £60 but will give you full access and allow you to sell/distribute at the end of june.

    I’m giving a talk in just over a week about progress so far - I’ll try and put up a post about this in a mo.

  10. wilson Says:

    hi i dont realy no much about SDK and stuff because its too complex for me :( but im interested in box 2d and was wondering if there was any way to get it on my ipod or will it be avalible in the itunes store because i would pay for it.

  11. fourfingeredfish Says:

    came across this: Oolong Game Engine http://www.oolongengine.com/ for the iphone sdk supports Bullet SDK (3d phyics engine) http://www.bulletphysics.com/Bullet/wordpress/ . I can foresee some amazing games coming to the iphone.

  12. matax Says:

    Can you send me thhe testbed box2d iphone port source?

Leave a Reply