Game State Management
Hello forum. I am planning to have some sort of game state management for my iphone game but I have some questions. I would have a certain class be my "state-manager" and some other class be my "state" class. The only problem is what classes to use. For my "state-manager" class I could use either the appdelegate or a viewcontroller. I think the appdelegate class may suite me better because I can access it anywhere, including inside the "state" class to notify the appdelegate to change states. However, I'm wondering if a viewcontroller would be better to use as a "state-manager" if it has any features that would be useful but not avaliable in the appdelegate. Also, the "state" class has a similar decision. I could use a viewcontroller or a single UIView. A viewcontroller may add more flexibility with the states, for example I was thinking that the "game state" class could be a subclassed viewcontroller, and that a "game view" UIView subclass would be contained inside of the viewcontroller. I could also have a "game data" class contained inside of the viewcontroller, so that the "game view" class could access the "game data" class to find locations to move certain CALayers to (which are used as the sprites in the game). The original viewcontroller could control the timer (or display link), control a soundmanager, and maybe handle networking. However, a viewcontroller as the "state" class may be unnecessary, and a UIView class as the "state" class may be easier when using transitions from one state to the next. It would be great if anyone has some input or suggestions on this decision, and if anyone else has used something like this before.
__________________
A 14 year old app developer...god help me...
|