A game is a set of Game States.
Each Game State contains game objects, may be list, may be scene graph or any other data structure.
We can use Game States as Game Locations, too.
How do you share data between Game States, for example, hero and his/her inventory when it moves from one location to another?
It looks like Composite (hierarchical) Game State is a good idea. For example,
GameState MainMenu GameState LoadLevel GameState Gameplay - contains inner states GameState Location1 GameState Location2 GameState Location3 GameState MiniGame1 - contains inner states GameState LocationInMiniGame1 GameState LocationInMiniGame2
So we can hold shared data (hero, inventory) in Gameplay object. But this approach does not look very correct and flexible. If some objects are outside scene graph (ie in the parent Game State), how would you include it in the scene graph? Via special node type that mounts different scene graphs or scene graph branches together?
If we have stack of active Game States, and each state can contain inner state machine, and scene graphs of different Game States can be mounted into one giant graph, it can become very complex system that is hard to debug.
Very interesting to read your suggestions. How do you organize game data between Game States in your real applications?
(For editors: possible additional tags: OOP, game-state.)