Using BaseGame or StandardGame

Hello everybody…



I have noticed that there are differences between StandardGame and BaseGame (new cvs version updated)…

I would like to make LoadingGameState in my project, but my project extends BaseGame, not StandardGame, but when I try to make LoadingGameState in a project that extends BaseGame, it not works…

What I have to do to make this work???

StandardGame have many differences from BaseGame, and if I make my game extends StandardGame, i'll have to make  A LOT of modifications…



please help…



thanks…



Guilherme  :smiley:

Hi,



You just have to create an instance of GameStateManager and update it in your base game.



// Must be called before getInstance()!
GameStateManager.create();

GameStateManager gsm = GameStateManager.getInstance();

gsm.update(float);

etc



StandardGame isn't required to use GameStates at all.

Well I think so anyways  :P

Darkfrog will make it all clear! (for once.... (maybe  :| ))


- Chris

Hal is right…that should be all that's necessary.



BTW, if you did decide to use StandardGame you shouldn't have to extend it…that's sort of the point of it.  You don't have to extend it.

Hi,


darkfrog said:

BTW, if you did decide to use StandardGame you shouldn't have to extend it...that's sort of the point of it.  You don't have to extend it.


I have to admit when I first switched to using StandardGame I actually extended it in the beginning (I wanted a global Input handler).  It wasn't till a little later I realised I could just create a Gamestate from the beginning and always leave it active to achieve the same effect.

So maybe the idea of extending StandardGame is built in' as it were because thats how the other game types are used.

Perhaps it would be a good idea to add an explanation to the javadoc of the class explaining it doesn't need to be extended?


- Chris

Ohhh, yeah,  :D  :D, sorry, because i'm little newbie hehehehe



but, now, where I put these methods??? in which method of my BaseGame class???



and what about the loading game state that i would like to show??? it'll be the same o the TestLoadingGameState??? in method main?

What methods are you referring to?



The stuff that is in the "main" of TestLoadingGameState the majority of that should go in the constructor or init of your Game if you're not using StandardGame.


// Must be called before getInstance()!
GameStateManager.create();

GameStateManager gsm = GameStateManager.getInstance();

gsm.update(float);

etc



this code... where I put the GameStateManager.create();
the update(...)???

is it all in initGame???

Hi,



Check out the source for StandardGame to see where it calls the GameStateManager methods.



Or think about where you might call init/update/render methods in your game for a moment…




  • Chris

Like Hal said, you simply would create the GameStateManager in your init and then update it in your game's update method.

ok… now the calls for GameStateManager are in the right methods (initGame, etc), but my game initiates on a black screen (that nothing is showing) and then the game starts, but no LoadingScreen was showed…



here is my code:


protected final void update(float interpolation) {
        /** Recalcula o frame rate. */
      timer.update();
        /** Atualiza o tpf para obter o tempo por frame de acordo com o Timer */
      tpf = timer.getTimePerFrame();
     
      // Atualiza os GameStates
       GameStateManager.getInstance().update(tpf);
     
      /** Checa por atualiza

Try disabling lights and see if anything shows up?



You know, it wouldn't be too difficult to switch over to StandardGame if you're willing to make the switch?