iPhone Gaming Framework: ObjC Template

Well, everyone… the time has finally come! Yesterday I got an email in my mailbox about a really interesting website that linked to my two blog posts about iPhone development, the Parsing XML files on the iPhone, and the iPhone Gaming Framework tutorials.

Best Universities: 100 free courses tutorials for aspiring iPhone app developers

While looking through the wealth of information on those articles, I found a really neat one.. how to create a project template! This is something I’ve wanted to do for everyone interested in getting started with iPhone game development, but have not had time to really research it on my own.

So, fast forward a few hours, I made a few changes to the ObjC framework and stored it into a template! I would like to first note, that this framework most likely has a few bugs in it. I tried to track down what I could, but I’m sure I didn’t get them all. My current efforts are more directed towards my C++ Djinn Engine, so this project took a back seat, but I felt a lot of people could really use this to jumpstart their efforts.

Anyway, if you choose to use this template, be sure to mail me with your finished projects or development blogs. I always love to see what people are up to! If you’ve used XNA at all, you’ll recognize the Screen Controller and be comfortable with how it works.

If you have any questions, feel free to comment ( so others can help answer and benefit from the questions as well )

How to install the template!
Step 1) Download the zip file located HERE

Step 2) Navigate to ~library/Application Support/Developer/Shared/Xcode/ and create the following folders: Project Templates/iPhone Templates/ .. Your final directory structure should look like ~library/Application Support/Developer/Shared/Xcode/Project Templates/iPhone Templates/

Step 3) Unzip the OpenGL Screen Controller.zip into your iPhone Templates directory. This will add the OpenGL Screen Controller folder and project template. Your new directory structure will look like:
~library/Application Support/Developer/Shared/Xcode/Project Templates/iPhone Templates/OpenGL Screen Controller/(project files here)

Step 4)Open up XCode, create new project, and you’ll see on the left side “User Templates” with a sub-category “iPhone Templates,” clicking on that will bring up your Screen Controller template.

Look at the code, see how its done. Build and run it, and if you click “Level Play” it should transition to a new screen (the gameplay screen) .. click anywhere else in the frame while on the gameplay screen, and it will remove that screen from the screen controller and go back to the title screen. Trace the code, see how it does it, and start playing around.


5 comments so far

  1. moski on

    Works like a charm, thanx alot

  2. wuzutags on

    Thanks craig. It really works! I’m also a game programmer but quite new to objective-c which i’ve been coding for 3 months now. I’ve also been able to develop a complete game using UIkit and some Quartz but not yet opengl. This is my first game project with opengl on the iphone which your framework has really helped me understand. It does have some bugs which I’m fixing now. One obvious one happens when you try to return to Title Page by clicking anypart of the screen. When the this click happens in the rectangle of the “Free Play” menu button though its not visible from the gameplay screen , causes an error but any other point outside this works fine.
    I’ve been looking at cocoa2d, oolong and sio2 engine but they all look too bulky and heavy for me. If in case I should settle on one, will it be possible to fit it into your framework easily?
    I’d like to ask if your engine is ready for use in alpha stages.

    • Craig on

      I’m sure thats the first of many bugs in the template, What I may end up doing is just putting up a group at code.google.com and letting anyone just download it through SVN directly into xcode and if they want to submit changes to it, that could be an easy way of doing it.

      I checked out all of those when I started on the iPhone, and yeah… they are quite bulky but then again they are complete game engines. It would take some tweaking to get them to work with the screen manager set up in this template, but probably do-able. Each of those engines have a solution for screen management however, so I’m unsure what real benefit it would be to have this one in there.

      The Djinn Engine is probably not even in its alpha stages. There are a few systems that need to be implemented, right now I am working on an ActorController class that will manage the actors objects on screen. After that, i’ll need a few more systems in place before I could call it ready, such as solutions for networking, sound, any sort of physics, etc. My goal is to have it ready for game development by the end of summer, beginning of fall.

  3. llamaaardvark on

    As an XNA-now-iPhone developer, I leapt at the chance to use this template; thanks a lot!
    However with a blank template, if you change the Active SDK to 3.0 the code produces a blank white screen. The expected buffer image arrives for a frame when you press the home button, then the app closes. I suspect there is probably a quick fix for this, can you suggest one?

    • Craig on

      This is a separate project file from my active project… but I remember there being problems with the 3.0 OS that I need to look into. It is a simple fix, and I’ll look into it when I get home tonight and maybe have a patched version up soon. Thanks for reminding me!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: