Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am porting an AGS game to iPhone, and was wondering what the best approach to the port would be? Is there a mature engine developed solely for the point-and-click style? Note: I have never developed an adventure point-and-click game before.

If not, how best would you structure your code and assets?

More specifically, how would you deal with say 100+ scenes. My initial approach is to create a scene superclass with things common between all scenes, like backgrounds, music, doors, windows, characters. Then for each scene an inherited version of that superclass with more particular things like checks, dependencies etc. Upon entering the scene, you'd check for dependencies and go from there. This is all off the top of my head mind you, so probably forgetting quite a bit.

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Chances are, there are no (maybe one or two hobby ones) 'mature engines' for iPhone point-and-click.

However, Cocos2D iPhone has a high level of abstraction, so it should be easy enough to use that.

As for code structuring, that's really up to you. I personally would have a system where:

  • The background is just a static image.
  • Items are graphically static on the background, but in code they exist with a position and general rules for combining. So a lamp at (x,y) would receive the touch there and do whatever it has to.
  • If an object is on the screen, it could have checks for 'am I being used with object X?' and 'has event Y happened?'. This indicates you would need a set of event flags, muchlike an RPG. Something like 'has player opened secret door', 'has player killed bad guy', 'has player unlocked safe', etc.

EDIT: Following your edit, Cocos2D has its own Scene class. This can quite easily be derived from, and would save significant time from having to develop a whole scene object.

As for doors, I would treat them as a separate object. If you give each object the player as a parameter when you press them, you could simply have pressing a rock call player.add_item(this), and a door player.setzone(scene.leftexit).

I wish you luck with your project.

share|improve this answer
    
Good suggestions, but how would you organize those 3 bullet points at a higher level. That's fine for a few little scenes. But for 100+, you'd need a more organized structure. –  Dominic Bou-Samra Jan 19 '11 at 18:09
    
Cocos2D itself has a structure of using Scenes and transitions between them, so that takes a lot of the work for you. Backgrounds could be stored in a texture atlas if you wanted. And how much more organized do you want that a Lamp, which has a description when you press it? And event flags are a good way to run things - not only is there the check(Player_Found_Door) way, but as the flag is set in a function you can change all the items you need then. –  The Communist Duck Jan 19 '11 at 18:33
1  
I've heard tons of great stuff about using cocos2d for any 2d iphone game. –  Dream Lane Jan 21 '11 at 21:21
    
Try Kobold2D (kobold2d.com) - it's an improved Cocos2D engine with more sample code and easier to get into. I'm the author so take it with a grain of salt, but it's also what my users are saying. :) –  LearnCocos2D Sep 14 '11 at 9:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.