FixedLogicrateGame Help?

I want to make something using FixedLogicrateGame, and I am having a bit of trouble setting it up.  It gives me an error which I dont understand. My earlier question I solved eventually, and now a new one popped up. Is initGame called more than once? Or are there multiple threads? Or am I being stupid and not seing something?

This is the console text:

In main( String[] args )

Sep 19, 2006 9:31:43 PM start

INFO: Application started.

Sep 19, 2006 9:31:43 PM com.jme.system.PropertiesIO <init>

INFO: PropertiesIO created

Sep 19, 2006 9:31:43 PM com.jme.system.PropertiesIO load

INFO: Read properties

In initSystem( )

In initGame( )

Done with initGame( )

Sep 19, 2006 9:31:46 PM com.jme.input.joystick.DummyJoystickInput <init>

INFO: Joystick support is disabled

Sep 19, 2006 9:31:46 PM com.jme.system.lwjgl.LWJGLDisplaySystem <init>

INFO: LWJGL Display System created.

Sep 19, 2006 9:31:46 PM com.jme.system.PropertiesIO save

INFO: Saved properties

Sep 19, 2006 9:31:46 PM com.jme.renderer.lwjgl.LWJGLRenderer <init>

INFO: LWJGLRenderer created. W:  640H: 480

Sep 19, 2006 9:31:46 PM com.jme.renderer.AbstractCamera <init>

INFO: Camera created.

Sep 19, 2006 9:31:46 PM com.jme.util.lwjgl.LWJGLTimer <init>

INFO: Timer resolution: 1000 ticks per second

Sep 19, 2006 9:31:46 PM com.jme.scene.Node <init>

INFO: Node created.

In initGame( )

Sep 19, 2006 9:31:47 PM com.jme.scene.Node attachChild

INFO: Child (Board) attached to this node (Root Node)

Sep 19, 2006 9:31:47 PM com.jme.input.lwjgl.LWJGLMouseInput <init>

WARNING: Problem during creation of Mouse.

java.lang.IllegalStateException: Display must be created prior to creating mouse

at org.lwjgl.input.Mouse.create(

at com.jme.input.lwjgl.LWJGLMouseInput.<init>(Unknown Source)

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(Unknown Source)

at com.jme.input.InputSystem.update(Unknown Source)

at Source)

at classes.TiltBall.main(

java.lang.IllegalStateException: Mouse must be created before you can read events


at com.jme.input.lwjgl.LWJGLMouseInput.update(Unknown Source)

at com.jme.input.InputSystem.update(Unknown Source)

at Source)

at classes.TiltBall.main(

Sep 19, 2006 9:31:47 PM start

INFO: Application ending.


Here is my code:

package classes;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.math.Vector3f;
import com.jme.bounding.BoundingBox;
import com.jme.scene.state.TextureState;
import com.jme.image.Texture;
import com.jme.util.TextureManager;
import com.jmex.model.XMLparser.XMLtoBinary;
import com.jmex.model.XMLparser.JmeBinaryReader;
import com.jme.scene.Node;
import com.jme.light.DirectionalLight;
import com.jme.scene.state.LightState;
import com.jme.renderer.ColorRGBA;
import com.jme.input.InputHandler;
import com.jme.scene.shape.Quad;
import com.jme.renderer.Camera;
import com.jme.util.Timer;
import com.jme.system.DisplaySystem;

 * @author Gibi
public class TiltBall extends FixedLogicrateGame {

   static TiltBall tb = new TiltBall();
   private int width, height, depth, frequency;
   private boolean fullScreen;
   private Camera camera;
   private Timer timer;
   private Node rootNode;

   public static void main(String[] args) {
      System.out.println("In main( String[] args )");
   protected void cleanup() {
      System.out.println("In initGame( )");
      camera = null;
      timer = null;
      rootNode = null;

   protected void initGame() {
      System.out.println("In initGame( )");
      rootNode = new Node("Root Node");
      Quad board = new Quad("Board", 100, 100);
      Texture boardTex = TextureManager.loadTexture(
      TextureState boardTS = display.getRenderer().createTextureState();
      //update the scene graph for rendering
      rootNode.updateGeometricState(0.0f, true);
      System.out.println("Done with initGame( )");

   protected void initSystem() {
      System.out.println("In initSystem( )");
      width = properties.getWidth();
      depth = properties.getDepth();
      frequency = properties.getFreq();
      height = properties.getHeight();
      fullScreen = properties.getFullscreen();
         display = DisplaySystem.getDisplaySystem(properties.getRenderer());
         camera = display.getRenderer().createCamera(width,height);
      catch(Exception ex){
      camera.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
      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);
      camera.setFrame(loc, left, up, dir);
      timer = Timer.getTimer();
      KeyBindingManager.getKeyBindingManager().add("exit", KeyInput.KEY_ESCAPE);

   protected void reinit() {
      System.out.println("In reinit( )");
      display.recreateWindow(width, height, depth, frequency, fullScreen);

   protected void render(float interpolation) {
      System.out.println("In render( float interpolation )");

   protected void update(float interpolation) {
      System.out.println("In update( float interpolation )");
      interpolation = timer.getTimePerFrame();
         finished = true;


Can anyone help?  :( :? :// :'( :|

your exception occurs in the main loop of AbstractGame.

FixedLogicrateGame extends AbstractGame, which unlike BaseSimpleGame does not define any input handler (you'll have to define it yourself - take a look at BaseSimpleGame.initSystem()). an application which doesn't provide any input handling is makes no sense (at least provide the means to exit the application).

Thanks. I tried that, i thought it was wrong. Tried it again, turns out (after some time searching through the jme source code), that I need to do display.createWindow(width,height,depth,frequency,fullScreen), not display.createHeadlessWindow(width,height,depth).

It works! * Feeling jubilant *  XD :slight_smile: :slight_smile: :slight_smile:

huh? i didn't even notice that you created a headless window.

well, i'm glad you found that out. :slight_smile: