iDevGames Forums
Level architecture question - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Level architecture question (/thread-9543.html)

Level architecture question - Jmcclane - Nov 15, 2011 07:41 PM

Hey guys,
I am currently creating a 2D side-scroller using an MVC architecture with OpenGL and OpenAL. I have pretty much based my game on the template from the Apress Beginning Iphone Games Development book (there was an article written about it on this site). The book only uses one view and minutely describes introducing enemies into the scene.

My question is this: Using this template, what would be a good architecture to organize and swap different scenes(levels or menus). How could one go about introducing AI elements into the scene in a deliberate fashion? (non random) I have read posts about reading data from plists and what not, but I cant seem to put the pieces together as to how one would switch between levels and read in AI data in an efficient matter.

Any advises or informative sources would be much appreciated.

Thanks Guys!

RE: Level architecture question - zenkimoto - Nov 18, 2011 08:13 AM


Perhaps, you could briefly describe the architecture to those who don't have the book? I skimmed through the section you were talking about (I believe Chapter 7). I think the best way is to have an external tool (level editor) write out to a level file and have the Scene Controller load the level in a plist format. During the load process, you create your scene objects and object meshes and add them to your Scene Controller. As far as AI, if it had parameters, it could be loaded up here too. (Harder for higher levels, etc)

The only other alternative would be to create a base abstract SceneController class and inherit from it to create your levels. But I would prefer the former.

Hope this helps.

RE: Level architecture question - Jmcclane - Nov 22, 2011 09:55 AM

Do you know of any open sourced level editors? Maybe information on efficient ways of creating one?

RE: Level architecture question - ipeku - Nov 22, 2011 11:31 AM

One possibility is creating your own level editor and making it store data into an NSData object (.plist file) that consists of your collection of hierarchical level data, for example, an NSDictionary that contains NSArrays that contain your SceneObjects.

Then, you can think of one Model as a level or even a part of a level (the next screen that will appear). At a given time create a new model object, fill it with new data and plug it into your game loop. When you're done with a model just release it.

I have one project going where we made a level editor for the client. The editor uploads the levels to a server from where the game binary can download them. This allows you to separate the level design process and the game development process.

RE: Level architecture question - Jmcclane - Nov 27, 2011 01:52 PM

Thanks a lot. That is very helpful.