Start() eats my thread

Well due to the precahcer ect. I now ran into quite an intresting prbolem, wich I can't find a solution for,

normally as seen in various examples, the start() method should return when the game is started (jme tests, stardust), but for some reason mine does not O.o

Here is the relevant problematic part:

starter thread

               Runnable starter = new Runnable(){
                  public void run() {
                     final MassiveSpaceEngine game = new MassiveSpaceEngine(settings);
               new Thread(starter).start();

package Engine;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.logging.Level;

import org.lwjgl.opengl.GL13;

import GameStates.LoadingAnimatedState;
import Interface.Settings;

import com.jme.input.FirstPersonHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.system.DisplaySystem;
import com.jme.system.GameSettings;
import com.jme.system.JmeException;
import com.jme.system.PropertiesGameSettings;
import com.jme.util.GameTaskQueue;
import com.jme.util.GameTaskQueueManager;
import com.jme.util.Timer;
import com.jme.util.resource.ResourceLocatorTool;
import com.jmex.physics.PhysicsSpace;

public class MassiveSpaceEngine extends FixedLogicrateGame {
   PhysicsSpace physspace;
   private Settings mysettings;
   private Camera cam;
   private Timer timer;

   public MassiveSpaceEngine(Settings settings) {
      //physspace = PhysicsSpace.create();
      this.mysettings = settings;

   protected void cleanup() {
      // TODO Auto-generated method stub


   protected void initGame() {
   public void InitLoading() {
      System.out.print("start loading");
      display.setTitle("New Horizons (Loading)");
      LoadingAnimatedState loadingstate = new LoadingAnimatedState(display);
      System.out.print("end loading");

   protected void initSystem() {
      System.out.print("end init system");
   private void BasicInit() {
      display = DisplaySystem.getDisplaySystem("LWJGL");
      display.createWindow(settings.getWidth(),settings.getHeight(), 32, 120,mysettings.isFullscreen());
      PositionWindow();//needs the fields display and mysettings!!
      cam = display.getRenderer().createCamera(display.getWidth(),display.getHeight());
      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);
      cam.setFrame(loc, left, up, dir);
      display.setTitle("New Horizons Client");

   private void PositionWindow() {
      Toolkit toolkit = Toolkit.getDefaultToolkit();
      Dimension scrnsize = toolkit.getScreenSize();
      int x = mysettings.getWindowlocationx();
      int y = mysettings.getWindowlocationy();
      if(scrnsize.width-display.getWidth() < x){
         x = scrnsize.width-display.getWidth();
      if(scrnsize.height-display.getHeight() < y){
         y = scrnsize.height-display.getHeight();

   protected void cameraPerspective() {
      cam.setFrustumPerspective(45.0f, (float) display.getWidth()
            / (float) display.getHeight(), 1, 1000);

   protected void cameraParallel() {
      float aspect = (float) display.getWidth() / display.getHeight();
      cam.setFrustum(-100, 1000, -50 * aspect, 50 * aspect, -50, 50);
   protected void reinit() {
      // TODO Auto-generated method stub


   protected void render(float percentWithinTick) {
        DisplaySystem.getDisplaySystem().getRenderer().clearBuffers();// Execute renderQueue item

        // Render the GameStates

   protected void update(float interpolation) {

   protected GameSettings getNewSettings() {
      return new PropertiesGameSettings(".");


This code returns me

106.03.2009 17:07:59 start
INFO: Application started.
06.03.2009 17:07:59 com.jme.system.PropertiesGameSettings <init>
INFO: PropertiesGameSettings created
initsystem06.03.2009 17:07:59 com.jme.input.joystick.DummyJoystickInput <init>
INFO: Joystick support is disabled
06.03.2009 17:07:59 com.jme.system.lwjgl.LWJGLDisplaySystem <init>
INFO: LWJGL Display System created.
06.03.2009 17:08:01 com.jme.renderer.lwjgl.LWJGLRenderer <init>
INFO: LWJGLRenderer created. W:  800H: 600   Version: 2.0.1
06.03.2009 17:08:01 com.jme.renderer.AbstractCamera <init>
INFO: Camera created.
06.03.2009 17:08:01 com.jme.util.lwjgl.LWJGLTimer <init>
INFO: Timer resolution: 1000 ticks per second
06.03.2009 17:08:01 create
INFO: Created GameStateManager
end init system

As you can see with the Sys.out messages, enither the InitGame nor the InitSystem nor the Constructer seemms to be the reason  (I tried adding super(); to the Constructer, it changed nothing)

Does anyone knows why I have this behaviour?

Basically it probably won't be much a problem to work around that, since the game itself seems to work (If i add something in the initgame, it gets executed)
However it seems like I have some huge error in my code, and I don't really like the idea to keep it.

I haven't run your code but it looks like you're getting expected results - you'll get control back after starting a thread, but not after starting a game. Calling the game's start method just puts you into a big while. Since both your output statements are within the same thread, you never reach the second one. If you printed your output from the main thread then you would.

So this produces "1"


While this should produce "12"

new Thread(starter).start();

Only StandardGame implementations return after the start() call, what Alric said is right on the mark.

ah, yep that was one part,

of ym problem XD