StandardGame and GameStates Question

hello everyone,



im just beggining to learn standard game and game states,



***how should i toggle a game state setActive() ?

  • i want a key input to set a gameState to setActive(false), thats why i tried using keybindingmanager but where should I validate if the correct key is pressed? In SimpleGame it is usually on simpleUpdate() method, but since standard game cannot be subclassed how should i accessed its update method?



    Can i know how do you guys manage your game states? i am confused about game states

    for example:
  1. i have a player game state - has PLAYERNODE
  2. i have a terrain game state - has TERRAINNODE
  3. i have a skybox gamestate - has SKYBOXNODE



    **what if i need them to share same lightState how do you do it guys?
blur said:

***how should i toggle a game state setActive() ?
- i want a key input to set a gameState to setActive(false), thats why i tried using keybindingmanager but where should I validate if the correct key is pressed? In SimpleGame it is usually on simpleUpdate() method, but since standard game cannot be subclassed how should i accessed its update method?


You will want to use the update method in each of your GameStates.  That said though, this is kind of an extreme use of the GameState I think.

blur said:

Can i know how do you guys manage your game states? i am confused about game states
for example:
1. i have a player game state - has PLAYERNODE
2. i have a terrain game state - has TERRAINNODE
3. i have a skybox gamestate - has SKYBOXNODE

**what if i need them to share same lightState how do you do it guys?


The current project I'm working on doesn't have a player character.  It is instead, a scene with buildings and an OpenGL GUI on top of it.

Our GameStates are:

  • LoadingGameState - Progress bar for the loading of scenery

  • SceneGameState - Skybox, ground (for now), buildings, lighting

  • GUIGameState - FengGUI layer and nothing else here



Of course, when we work on streaming terrain, then that will get its own GameState, but in more traditional terms you might consider thinking about GameStates as pre-packaged level that you can turn on or off throughout the game.  You can also use it for an in-game menu, a console, etc.  Basically, any time you might think "I wish I had another root node", its time to think about creating another GameState ;)