Using either a Headless game or a Visible one

Well I'm currently working a bith more on the Gameserver for my game.

Now I thought that it would be pretty helpfull if I have a optional Rendering, so that i can see what the Server sees. After looking a  bit at  Standartgame, I came up with this (I extend FixedLogicrateGame) cause it kinda simplifies the serverside logic. While in debug = true everything works as expected, debug = false throws this one

06.04.2009 15:43:54 com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
06.04.2009 15:43:54 com.jme.input.lwjgl.LWJGLMouseInput <init>
WARNUNG: Problem during creation of Mouse.
java.lang.IllegalStateException: Display must be created.
   at org.lwjgl.input.Mouse.create(
   at com.jme.input.lwjgl.LWJGLMouseInput.<init>(
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.jme.input.MouseInput.get(
   at com.jme.input.InputSystem.update(
   at Starter$
   at Source)
06.04.2009 15:43:54 class GameObjects.Universe start()
SCHWERWIEGEND: Exception in game loop
java.lang.IllegalStateException: Cannot determine focused state of uncreated window
   at org.lwjgl.opengl.Display.isActive(
   at com.jme.input.lwjgl.LWJGLMouseInput.update(
   at com.jme.input.InputSystem.update(
   at Starter$
   at Source)
06.04.2009 15:43:54 start
INFO: Application ending.

   protected void initSystem() {
      if (debug){
         display = DisplaySystem.getDisplaySystem("LWJGL");
         display = DisplaySystem.getDisplaySystem("dummy");
      timer = Timer.getTimer();
      if (debug){
         display.createWindow(settings.getWidth(),settings.getHeight(), 32, 120,false);
         display.createHeadlessWindow(settings.getWidth(),settings.getHeight(),settings.getDepth() );
      cam = display.getRenderer().createCamera(display.getWidth(),display.getHeight());
      if (debug){
      Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
      Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
      Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
      Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
      if (debug){
         cam.setFrame(loc, left, up, dir);

I already tried to do the camera stuff for the dummy as well, but that just thorws nullpointerexceptions.

Can anyone maybee give me a hint why this does not work?

It seems FixedLogicrateGame does not properly support headless rendering. You may need to edit it to remove references to InputHandler and other rendering stuff so it works.

As Momoko_Fan already said just comment the line 'InputSystem.update();' out.

MouseInput and KeyInput do not support a Dummy input systm yet.

The funny thing is, JoystikInput does support it.

You could implement the missing DummyMouseInput and DummyKeyboardInput classes, and use this new classes by setting dummy providers before starting the game.



Hm I think i will take a look into creating the dummy classes, and if i get them to work, maybee someone can integrate them into the framework then, so everyone will be helped a bit :slight_smile:

Sure, just post a patch in the contribution depot if it works out.

Maybe there is also a good reason why they are missing, but i can't think of one right now.

Done, and seems to work as expected, now back to the Server codeing ^^