Level architecture question

Posts: 14
Joined: 2010.09
Post: #1
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!
Quote this message in a reply
Posts: 12
Joined: 2009.08
Post: #2

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.
Quote this message in a reply
Posts: 14
Joined: 2010.09
Post: #3
Do you know of any open sourced level editors? Maybe information on efficient ways of creating one?
Quote this message in a reply
Posts: 96
Joined: 2011.07
Post: #4
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.


iFrog is coming.
Quote this message in a reply
Posts: 14
Joined: 2010.09
Post: #5
Thanks a lot. That is very helpful.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Undefined symbols for architecture i386: "_SCNetworkReachabilitySetCallback" sefiroths 1 9,400 Aug 19, 2011 05:45 AM
Last Post: sefiroths
  Mock Hard Drive Architecture Nick 6 7,175 Jun 16, 2005 09:49 PM
Last Post: Nick