StandardGame assistance?

I tried to use standard game however i'm having some difficulties compiling does anyone see the error


package Example;

import com.jme.app.AbstractGame;
import com.jme.app.SimpleGame;
import com.jme.scene.Skybox;
import com.jmex.game.StandardGame;
import com.jmex.game.state.DebugGameState;
import com.jmex.game.state.GameState;
import com.jmex.game.state.GameStateManager;

public class StandardGameHelloExample{
    private Skybox sb = null;
   
    public static void main(String[] args) {
        StandardGame app = new StandardGame("HelloExample");
        app.setDialogBehaviour(0);
        app.start();
       
        GameState gameState2 = new GameState();   // Create our game state
        GameStateManager.getInstance().attachChild(gameState2);   // Attach it to the GameStateManager
        gameState2.setActive(true);   // Activate it
       
        /**
        TerrainManager manager = new TerrainManager();
       // First a hand made terrain
       rootNode.attachChild(manager.getHomegrownTerrainBlock());
       // Next an automatically generated terrain with a texture
       rootNode.attachChild(manager.getHeightmapterrainblock());
       // Finally a terrain loaded from a greyscale image with fancy textures on it.
       rootNode.attachChild(manager.getComplexTerrainBlock());
       */
       
       // initialize the SkyboxManager
       // this needs to be called once, before you can get() the manager
       SkyBoxManager.init([u]cam[/u]);       
       rootNode.attachChild(SkyBoxManager.get().getCreatedSkyBox());
       
       //Move the skybox into position to the location of the camera so it moves with it
       SkyBoxManager.get().update();
       
    }
}

I'm confused about what you don't understand…



GameState is abstract, use something like BasicGameState instead, and there are a bunch of variables you haven't declared… the javac error messages are fairly self explanatory?

i understand a bit i changed it to BasicGameState gameState2 = new BasicGameState(null);



but the only 2 things are cam and rootNode do i have to declare them in standard game ? i just basically copy and pasted the one i had using SimpleGame.


package Example;

import com.jme.app.AbstractGame;
import com.jme.app.SimpleGame;
import com.jme.scene.Skybox;

public class HelloExample extends SimpleGame {
    private Skybox sb = null;
   
    public static void main(String[] args) {
        HelloExample app = new HelloExample();
        app.setDialogBehaviour(AbstractGame.NEVER_SHOW_PROPS_DIALOG);
        app.start();
    }

    protected void simpleInitGame() {
        /**
         TerrainManager manager = new TerrainManager();
        // First a hand made terrain
        rootNode.attachChild(manager.getHomegrownTerrainBlock());
        // Next an automatically generated terrain with a texture
        rootNode.attachChild(manager.getHeightmapterrainblock());
        // Finally a terrain loaded from a greyscale image with fancy textures on it.
        rootNode.attachChild(manager.getComplexTerrainBlock());
        */
       
        // initialize the SkyboxManager
        // this needs to be called once, before you can get() the manager
        SkyBoxManager.init(cam);       
        rootNode.attachChild(SkyBoxManager.get().getCreatedSkyBox());
    }
   
    @Override
    protected void simpleUpdate() {
        //Move the skybox into position to the location of the camera so it moves with it
        SkyBoxManager.get().update();
    }
}

The rootnode comes from the game state, the camera comes from standardgame.  You should take a look at the javadocs for BasicGameState and StandardGame:  http://www.jmonkeyengine.com/doc/

also take a look at other examples using GameStates like the jme-demos oder MonkeyMahjongg



Basically you create a new class which extends BasicGameState and implements your Game logic / creates your game level.

Then in SimpleGame you create an instance of your own Gamestate not BasicGamestate.