Stack of game states
Posted: Thu Aug 16, 2012 4:41 am
Okay, so heres the thing.. I am developing a 2d game engine, and in every game engine a wise choice would be to have some sort of state management. I've researched a bit, and I've found out that a lot of people use a stack.
Then I found some problems about a game state stack, but I solved them by writing some scenarios on a piece of paper and found out that those definitely won't be a problem.. Anyways, I want to have 3 types of game states: primary, overlay and popup.
The primary game states will block any other game states (underneath this state) ability to render, handle events and update.
The overlay game state will block any other game states (underneath this state) ability to handle events and update.
The popup will not block anything.
This will result in a variety of different awesome game states, for instance an InventoryState overlapping a PlayState without pausing the game, and so forth. Now for the problem: how the fudge do I manage all of this? How do I even implement these 3 types?
So far I only have a get type method in my states, but I don't know what to do with the state manager.. How would I e.g. update the PlayState while having a InventoryState open? It's a stack. Should I just go with vectors?
Danke.
Then I found some problems about a game state stack, but I solved them by writing some scenarios on a piece of paper and found out that those definitely won't be a problem.. Anyways, I want to have 3 types of game states: primary, overlay and popup.
The primary game states will block any other game states (underneath this state) ability to render, handle events and update.
The overlay game state will block any other game states (underneath this state) ability to handle events and update.
The popup will not block anything.
This will result in a variety of different awesome game states, for instance an InventoryState overlapping a PlayState without pausing the game, and so forth. Now for the problem: how the fudge do I manage all of this? How do I even implement these 3 types?
So far I only have a get type method in my states, but I don't know what to do with the state manager.. How would I e.g. update the PlayState while having a InventoryState open? It's a stack. Should I just go with vectors?
Danke.