SimpleState

Is there a state class that is as simple as "com.jme.app.BaseSimpleGame" ? Because "com.jmex.game.state.BasicGameState" just doesn't compare to "com.jme.app.BaseSimpleGame" . I guess I can just implement that stuff myself… I'm just wondering if there was something like that already. Then what I noticed is that "DisplaySystem.getDisplaySystem().getRenderer().getStatistics()" doesn't update in "com.jmex.game.state.StatisticsGameState" or obviously the classes that is extended by it…



Thanks

SF



Edit: The statistics is updating now again, sorry my mistake.

baseSimpleGame is not a game state class. it extends base game. so its a game class like simple game, base game or standardgame.



so technically u cant compare those two.



if u wanna use game states, i suggest using either standardgame + gamestate or basegame + gamestate.



the choice of which gamestate class to use as the foundation game state is really up to u.



but for a big project u should consider extending basicgamestate.



for testing purpose u should just use debuggamestate. :smiley:

I'm sort of just messing around. I am using debug game state at the moment. Here is 2 for the challenges I have with using debug game state: 1) If I don't have the center point of a object in my sight then the object doesn't display. 2) I'm not sure how to add stuff like terrain pages and water to game states.



The reason why I'm using game states and not just the simple test or base game it self is because I want to write a server and client. The debug game state is quite nice for this too because it has support for headless.



Edit: I just found out what node.setModelBound(new BoundingBox()); does. :wink: Sorry my mistake again. :stuck_out_tongue:

ScarFreewill said:

The reason why I'm using game states and not just the simple test or base game it self is because I want to write a server and client. The debug game state is quite nice for this too because it has support for headless.


well, game states are game states, they pretty much have nothing to do with the main game loop which is created by basegame standard game or simplegame.

a complete game implementation consists of  a main game loop and several game states if u would like to use them.

well terrain or water or whatever can be added either to the main game(base game for example) or u can put them in a game state so u can disable them when u dont need them. to create a terrain u need to check out the tests. they should give u a pretty good idea on how to implementa terrain page.

This was to easy to be passable! The textured terrain page is working now. 8) I'll add a sky dome and some water tomorrow. (or later today 3:56am. I've got 3 hours of sleep  :P)



Thanks for you support.

I can't get the sky dome to load here is a test:


   StandardGame game = new StandardGame("TestGame");   // Create our game
   game.start();   // Start the game thread
       
   DebugGameState gameState = new DebugGameState();   // Create our game state
   GameStateManager.getInstance().attachChild(gameState);   // Attach it to the GameStateManager
   gameState.setActive(true);   // Activate it

   SkyDome skdome = new SkyDome("skyDome", new Vector3f(0.0f,0.0f,0.0f), 11, 18, 850.0f);
   skdome.setModelBound(new BoundingSphere());
   skdome.updateModelBound();
   skdome.updateRenderState();
   skdome.setDay(267); //267
   skdome.setLatitude(-22.9f);
   skdome.setLongitude(-47.083f);
   skdome.setStandardMeridian(-45.0f);
   skdome.setSunPosition(8.75f); //5.75f = 5:45 am
   skdome.setTurbidity(2.0f);
   skdome.setSunEnabled(true);
   skdome.setExposure(true, 18.0f);
   skdome.setOvercastFactor(0.0f);
   skdome.setGammaCorrection(2.5f);
   skdome.setRootNode(gameState.getRootNode());
   skdome.setIntensity(1.0f);
   gameState.getRootNode().attachChild(skdome);


I am getting

Exception in thread "main" java.lang.NullPointerException
   at org.lwjgl.opengl.GL11.glHint(GL11.java:1477)
   at com.jme.scene.state.lwjgl.LWJGLTextureState.apply(LWJGLTextureState.java:400)
   at cwstrike.game.b3.SkyDome.setupLensFlare(SkyDome.java:569)
   at cwstrike.game.b3.SkyDome.<init>(SkyDome.java:166)
   at cwstrike.game.b3.TestDebugGameState.main(TestDebugGameState.java:61)


I know I have to update and render the dome but it crashes before it can get to the updating and rendering.

u cant just attach a new node to the rootnode when the game is already running.



u need to either put ur skydome inside the debuggamestate or create ur own gamestate and put the skydome in there.



then u need to use gametaskqueuemanager to attach both game states.

Why cant you attach a new node when the game is running? That would result in a very limited gaming engine.

Isnt the problem that he needs to create skydome is the GL thread.



http://www.jmonkeyengine.com/wiki/doku.php?id=simplegame_to_standardgame&s=thread

u cant just attach a new node to the rootnode when the game is already running.

I tried running it within the constructor of the Debug Game State it did not work. I tried to attach the Debug Game State to the Game State Manager and to activate it after creating the skydome that too didn't work. I hope creating it within the GL thread will help. I'll reply soon...

Its working now. I guess it was because it was not executing in a OpenGL thread.

ScarFreewill said:

Its working now. I guess it was because it was not executing in a OpenGL thread.


thats what i meant to say. by saying game is running i mean the gl thread is running~ and thats y u need gametaskqueuemanager if u r using standardgame

:smiley: I think both adamgp and I didn't understand you, but thanks for making it clear :wink:

(I still dont understabd  :slight_smile: )



Wouldnt you still need to use the GameTaskQueueManager even if the game hadn't been started?

adamgp said:

(I still dont understabd

You can also use

game.lock();

//do something that needs to be synchronized…

game.unlock();





This is functionally equivalent to putting it in the queue, except you are guaranteed it will be executed at this time, and not in the future.

I was referring to StandardGame anyway, since BaseSimpleGame doesn