Basic structure of an iOS game with OpenGL

Nibbie
Posts: 1
Joined: 2011.10
Post: #1
Hey all,

Let me start by saying I've done lots of game dev before, just not for iOS or using Objective C. I'm going to be developing my own game engine for personal use, and am curious on the best way to structure the core of it all.

First of all, what is the best way to run the main game loop? Using an NSTimer or a classic while loop (perhaps on it's own thread)?

I would also like to use a "state" system (menu, game1, game2, etc). I would also like to take advantage of the UIKit (skinned of course), as it'd be easier to make menus and take text input (so I believe, maybe it's not so hard to make a custom UI).
I current have a GLView, which sets up the OpenGL layer and context and an instance of this view is added to the window (I avoid using nibs). However, I currently have no view controller, and am still somewhat confused on the concept. From what I understand I would need one to control input and interaction with UI? Does this mean for every GUI I have I'd need a view controller? I'd like to be able to have a menu state with many views (main, options, etc), and the game state with the GL view, an ingame GUI, and a pause menu, and maybe other ingame menus.
I'm not excatly sure how to layer this and properly handle transitions.
I would like to always have the underlying OpenGL view as you could make cool menu backgrounds and effects (such as Fruit Ninja), so that would always be my base layer. Being so, should I add subviews to the GLView, or to the window, but on top of the GLView?
Also, where would be the best place to handle my core timing and game loop and such, the main app delegate or in the GLView?

Lastly (for now lol), where should I handle input events, from the window, or the GLView?

Thanks!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Basic Questions for a Word Game avidgamer101 4 4,345 May 19, 2012 07:26 PM
Last Post: MattDiamond
  Level data structure tfifriday 3 3,004 Jan 9, 2009 02:30 PM
Last Post: ThemsAllTook
  Basic OpenGL ES question, please help abdm436 3 3,787 Oct 17, 2008 06:06 AM
Last Post: imaumac