Game made of Gamestates and only it!

What would happen if instead of having a MainGame + Gamestates we had a Nothing + Gamestates?

the MainGame were a GameState itself? There is a bad side? what the is worse can happen?

Ignore Core-Dump, he's just trying to confuse you…just try it and see what happens. :wink:



Core-Dump, SHHH! GameStates are really cool, maybe it will just magically work. :slight_smile:

Well who or what would create the display? And something needs to render your Gamestate e.g. call GameStateManager.update()/Render()

Maybe they contain some AI and start rendering themselves if they get bored enough :wink:



sorry Guedez :), maybe explain bit more what you try to achieve with the method you describe.

Creating a very small Main class that extends Simple/Base/WatheverGame



then create the usual methods like simpleInit() simpleUpdate() simpleRender() and updateInput()…



on those methods they gerenciate the GameStates, like in


simpleInit(){
    GameStateManager.create();
    MainGameState gm = new MyGameState(WhateverParametersUNeed);
    HUDGameState hgm = new HUDGameState();
    GameStateManager.addChild(gm);
    GameStateManager.addChild(hgm);
    gm.setActive(true);
    hgm.setActive(false);
}



simpleUpdate(){
    GameStateManager.update(Interpolation));
}




simpleRender(){
    GameStateManager.render(Interpolation);
}



updateInput(){
    for( GameState gs : GameStateManager.getChild()){
         GameStateWithInputUpdate gi = (GameStateWithInputUpdate) gs; /*just make sure every GameState on your game is a GameStateWithInputUpdate*/
         if(gi.isActive())
              gi.updateInput(ParametersThatAssureThisIsPossible);
     }
}



so, when you want to switch to your HUD, just hgm.setActive(true); and all others .setActive(false);

something like that!

Well yes, and whats the problem doing this? Works without problems.

Woot!

i dont want to bash the frog, but i think StandardGame is not much more than that.  :wink:

Why would I be offended by that? :)  My purpose in writing StandardGame was to provide a "standard" game scenario that could be re-used rather than forcing people to have to write their own each time they make a game.  Simplicity was what I was going for…it has increased in complexity over the years, but the idea is pretty simple.  However, there are quite a few other gotcha's that StandardGame does (like GameTaskQueue) that you should be aware of.

actualy i made my own since the only ones i knew were BaseGame, SimpleGame and SimplePhysicsGame. Also i will have a better idea of what i am doing if i implement it myself ;D



I have modified GameStateManager a bit, since i can't make a class that extends it, i have Ctrl+C'd it and changed the name, then added what i wanted, do i need/can/should to add the Copyright stuff on the modified class? -> making it supports only two fast toogleable main linked GameStates(+ it's children if needed) + updateInput method. that calls the GuedezStates (extends GameState) updateInput() methods, if anyone asks why i modified it.



i also will want to add a darkned image of the "Game" main GameState when i pause/disable it to show up the "Menu" main GameState(the darkned image would be like a background image for the ingame menu), i was thinking of a modified screenshot (what i can't find a where it's implemented…) or there is a better way to do it?