New project


Hello there,

I'm just going to introduce myself, because now you're going to see me more often ;)
- 21years old
- M
- French (sorry if i'm not always clear when i speak english)
- French scientific graduate
- French Computer Science Speciality : Developer
- Actually in French Geographic Information System (think at Google Earth and Google Map and that's it)



I have a good and a bad news


The good first,
me and my team are going to build up an online game.

(a little sum up first)
Perhaps some of you knows Lineage2 (MORPG),
We have a server (www.l2enigma.fr) and we work on the server side of this game for a few years.
the server works with MySQL and is in full java.

Our team :
- 3 java developers ( 2 real life working + me )
- 2 internet developers (php mostly)

and if we begin our new project we'll have 2 or 3 graphists with us.

I presented JME to my workgroup, and it really impressed them.
In 2 and half weeks I made a small world, added water, imported 3d models from blender and other stuff
Much more then I expected !!!

So it's obvious we'll use JME.

That's for the the good news.


The bad one.
I have many questions :D

I beginned with SimpleGame
then SimplePassGame
then BasicGame.

And now i'm trying StandardGame
(each time I rearrange my small world to fit the new type)

I find some errors :
  1. In JMEDesktopState line 77 :

    return new JMEDesktop("Desktop", DisplaySystem.getDisplaySystem().getWidth(), DisplaySystem.getDisplaySystem().getHeight(), guiInput);



    getWidth() and getheight() always return 640*480


  • I made small modifications :


public class DesktopState extends GameState{
   private JMEDesktop desktop;
   protected Node rootNode;
   protected Node mouseNode;
   protected int large;
   protected int high;
   protected InputHandler input;
   protected AbsoluteMouse cursor;
   
   
   public DesktopState(int h, int l) {
      large = l;
      high = h;
      cursor = new AbsoluteMouse("cursor",large,high);
      init();
   }
   
   private void init() {      
       
        rootNode = new Node("RootNode");
        rootNode.setCullMode(Spatial.CULL_NEVER);
        rootNode.setLightCombineMode(LightState.OFF);
       
        input = new InputHandler();
       

      TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
      URL cursorLoc = TestJMEDesktop.class.getClassLoader().getResource("jmetest/data/cursor/cursor1.png");
      Texture t = TextureManager.loadTexture(cursorLoc, Texture.MM_LINEAR, Texture.FM_LINEAR, Image.GUESS_FORMAT_NO_S3TC, 1, true);
      ts.setTexture(t);
      cursor.setRenderState(ts);

      AlphaState as = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();
      as.setBlendEnabled(true);
      as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
      as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
      as.setTestEnabled(true);
      as.setTestFunction(AlphaState.TF_GREATER);
      cursor.setRenderState(as);

      cursor.registerWithInputHandler(input);
      mouseNode = new Node();
      mouseNode.attachChild(cursor);

      cursor.setUsingDelta(false);
      cursor.getXUpdateAction().setSpeed(1);
      cursor.getYUpdateAction().setSpeed(1);
      cursor.setCullMode(SceneElement.CULL_NEVER);
      
       
        Future<JMEDesktop> future = GameTaskQueueManager.getManager().update(new Callable<JMEDesktop>() {
         public JMEDesktop call() throws Exception {
            
               return new JMEDesktop("Desktop", large, high, input);
            
            
         }
        });
        try {
           desktop = future.get();
           desktop.getJDesktop().setName("Desktop");
           desktop.getJDesktop().setBackground(new Color(0.0f, 0.0f, 0.0f, 0.0f));
           desktop.getJDesktop().setOpaque(true);
           rootNode.attachChild(mouseNode);
           rootNode.attachChild(desktop);
           rootNode.getLocalTranslation().set(DisplaySystem.getDisplaySystem().getWidth() / 2, DisplaySystem.getDisplaySystem().getHeight() / 2, 0.0f);
           rootNode.getLocalScale().set(1.0f, 1.0f, 1.0f);         
           rootNode.updateRenderState();
           rootNode.updateGeometricState(0.0f, true);
           rootNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
           rootNode.updateGeometricState(0.0f, true);
           rootNode.updateRenderState();
        } catch(InterruptedException exc) {
           exc.printStackTrace();
        } catch(ExecutionException exc) {
           exc.printStackTrace();
        }
       
        buildUI();
   }
   
   protected void buildUI() {
   }
   
   public void update(float tpf) {
      input.update(tpf);
      
      rootNode.updateGeometricState(tpf, true);
      
   }
   
   public void render(float tpf) {
      DisplaySystem.getDisplaySystem().getRenderer().draw(rootNode);
   }
   
   public void cleanup() {
      desktop.dispose();
   }
   
   public Node getRootNode() {
      return rootNode;
   }
   
   public JMEDesktop getDesktop() {
      return desktop;
   }
   
   public InputHandler getInputHandler() {
      return input;
   }
}



The JMEDesktop is well placed but the mouse coords begin at the center of the screen and can't go south or west of this point.
Since i added the mousenode and the jmedesktop on the rootnode and then move it,it should work.

2)

I just explored a little openGL so i don't really know what needs to be added or updated using the "GameTaskQueueManager".

(i can't find exemples for how to use this)



Is it only when adding a node or a spatial?

3)

how do I block a gamestate?

(exemple : block the game rendering when we open the menu)

4)

I'm looking for StandardGame exemples too.

  • An exemple were we can see how inputs are handle on another thread

1.) I made the change to JMEDesktopState to be able to explicitly pass a width and height, but I’d like a little further explanation on the other things you’re wanting added?  I’m sort of in a rush at the moment so I don’t have time to look at it in depth at the moment and if you could give clarification of the problem and how you are solving it that would be appreciated.



2.) Check this out: http://www.jmonkeyengine.com/wiki/doku.php?id=standardgame_gamestates_and_multithreading_a_new_way_of_thinking.  Simply put GameTaskQueue is utilized as a means to inject code into the OpenGL thread.  LWJGL/OpenGL is not thread-safe so when you are executing code that will hit that directly you’ll get nasty errors and strange repercussions if you are not executing in the OpenGL thread.  The GameTaskQueue is a simple means of providing you access to that.  Another alternative if you’re using StandardGame is the lock()/unlock() feature as well.



3.) I gave the answer to this in another thread I responded to.



4.) There are a few examples in jME about how to use StandardGame, but as far as inputs being handled in another thread I’m not sure I understand what you’re talking about. :o


1) Fixed thx

2)
I you could help me on this one : http://www.jmonkeyengine.com/jmeforum/index.php?topic=4174.0
it should help me to understand when or not to use the GameTaskQueueManager.

3) I find the topic ;)

4) Remove this one, i've found the answer i needed