Black screen of death

I've a really weird problem, whenever I try to run the game, I get a black screen. I've tried waiting, but after an hour, still the same, black screen.



To make it all weirder: the game didn't crash, instead, whenever I press ESC it stops immediately.

The debug shows nothing strange, it is the same debug as before.



Does anyone know what could have caused this?  :?



PS if you need sources I'll give them. I don't wanna post them if you don't need them, since I've approximately  got 10 files of about 500 lines each.

many things to check - first - start with the cam, is it actually looking at something ?



you could attach the cam to a node - and place something at a defined point on the node

The cam always worked. I've set up a skybox, so I should see it. With the previous versions of my game my cam always worked, until now. So it's defenitially nothing with the cam's location.

SeySayux said:

The cam always worked. I've set up a skybox, so I should see it. With the previous versions of my game my cam always worked, until now. So it's defenitially nothing with the cam's location.


so what did u change or add into ur new version?

Owkey, I'll spit out a changelog:



Accidentially deleted the code  :wink:

Decompiled the classes;

Removed physics;

Tried to add a chase camera;

Tried to remove a chase camera;

Imported the whole project into NetBeans;

Messed days with my CVS Server to get it working;

Reinstalled my CVS Server

Added an input handler

Reorganization: Player and Terrain are now classes instead of methods

Gravity (thanks to neakor)

Steepness test (again, thanks to neakor)



I believe that was all…



EDIT: … It wasn't:

Misc class that contains shared method's and constants;

Camera debugger: It can move the camera up, down, forward, backward and increase it's X angle, to figure out which spot is best for a 3rd person view.

have u tried to run the jme built in tests? do they also give u a black screen?



if they work fine, then its probably ur camera or chasecamera if u havent removed it is doing something wrong.



try asign the chase camera to ur terrain with a relatively big y off set and c what happens.

I'll try to run some of them, and see what happens. What I ran until now didn't gave me black screens.

I've ran almost any test, and they work, except maybe for the render to texture tests, they didn't… well… made a texture of the rendering. But for the rest, everything worked fine.

since all the tests r fine, then its ur camera thats having problems.

can u post ur camera code?



or u can try to asign ur chase camera to ur terrain with a relatively big y off set and c what happens.



or if u dont have a chase camera, set the camera's location to a place above the terrain and c what happens.

Camera code… oh well. That means i'll have to post half of my code. I've put the name of the method and class above each block:


SRBase.initSystem
        try
        {
            display = DisplaySystem.getDisplaySystem(properties.getRenderer());
            display.createWindow(properties.getWidth(), properties.getHeight(), properties.getDepth(), properties.getFreq(), properties.getFullscreen());
            cam = display.getRenderer().createCamera(display.getWidth(), display.getHeight());
        }
        catch(JmeException jmeexception)
        {
            jmeexception.printStackTrace();
            System.exit(1);
        }
        display.getRenderer().setBackgroundColor(ColorRGBA.black);
        display.getRenderer().setCamera(cam);


SRBase.initGame()
        //create camera node
        cameraNode = new CameraNode("camera node",cam);
       
        //create terrain
        terrain = new Terrain();
               
        //create player
        player = new Player(cameraNode);
        player.updateWorldBound();
        //Vector3f vector3f = new Vector3f(-60F, 5F, 60F);
       
        //make player and terrain aware of each other
        player.setTerrain(terrain);
        terrain.setPlayer(player);
       
       
        // create inputhandlers
        sip = new SRInputHandler(player);
       
        // add the inputhandlers
        input.addToAttachedHandlers(sip); //standard input handler
        input.addToAttachedHandlers(player.cd); // debugger for camera position
       
        //attach the player & terrain
        rootNode.attachChild(player);
        rootNode.attachChild(terrain);


Player(constructor)
    public Player(CameraNode cam) {
        this();
        this.cam = cam;
        this.attachChild(cam);
        resetCamera();
        cd = new CameraDebugger(cam, Misc.THIRD_PERSON_LOC, Misc.THIRD_PERSON_ROT);
    }


player.resetCamera
    public void resetCamera() {
        cam.setLocalTranslation(Misc.THIRD_PERSON_LOC);
        cam.setLocalRotation(Misc.THIRD_PERSON_ROT);
    }


CameraDebugger - Full source
import com.jme.input.InputHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.input.action.InputAction;
import com.jme.input.action.InputActionEvent;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.CameraNode;
/*
 * CameraDebugger.java
 *
 * Created on 29 juli 2007, 11:20
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author SeySayux
 */
public class CameraDebugger extends InputHandler {
   
    public Vector3f        up = new Vector3f(0f ,  0.1f,  0f  );
    public Vector3f      down = new Vector3f(0f , -0.1f,  0f  );
    public Vector3f   forward = new Vector3f(0f ,  0f  , -0.1f);
    public Vector3f  backward = new Vector3f(0f ,  0f  ,  0.1f);
   
    public    float  lookDown = (float)Math.toRadians(  10 );
    public    float    lookUp = (float)Math.toRadians( -10 );
   
    private CameraNode cam;
   
    /** Creates a new instance of CameraDebugger */
    public CameraDebugger(CameraNode cam, Vector3f startpoint, Quaternion rotation) {
        setCamera(cam);
        cam.setLocalTranslation(startpoint);
        cam.setLocalRotation(rotation);
        KeyBindingManager keyboard = KeyBindingManager.getKeyBindingManager();

        keyboard.set(       "up", KeyInput.KEY_O );
        keyboard.set(     "down", KeyInput.KEY_L );
        keyboard.set(  "forward", KeyInput.KEY_I );
        keyboard.set( "backward", KeyInput.KEY_K );
       
        keyboard.set(   "lookUp", KeyInput.KEY_U );
        keyboard.set( "lookDown", KeyInput.KEY_J );
      
        addAction( new CameraMoveAction( cam,  forward ),  "forward", true );
        addAction( new CameraMoveAction( cam, backward ), "backward", true );
        addAction( new CameraMoveAction( cam,       up ),       "up", true );
        addAction( new CameraMoveAction( cam,     down ),     "down", true );
       
        addAction( new CameraRotateAction( cam, lookUp   ), "lookUp", true );
        addAction( new CameraRotateAction( cam, lookDown ), "lookDown", true );
    }
   
    public void setCamera(CameraNode cam) {
        this.cam = cam;
    }

    public CameraNode getCamera() {
        return this.cam;
    }
    private class CameraMoveAction extends InputAction {
        private Vector3f direction;
        private CameraNode cam;
        public CameraMoveAction(CameraNode cam, Vector3f direction) {
            this.cam = cam;
            this.direction = direction;
        }
        public void performAction(InputActionEvent e) {
            cam.getLocalTranslation().add(direction);
        }
    }
   
    private class CameraRotateAction extends InputAction {
        private float direction;
        private CameraNode cam;
        public CameraRotateAction(CameraNode cam, float direction) {
            this.cam = cam;
            this.direction = direction;
        }
        public void performAction(InputActionEvent e) {
           float f[] = cam.getLocalRotation().toAngles(null);
           f[0] += direction;
           cam.getLocalRotation().fromAngles(f);
        }
    }
}



And last but not least:

Misc
    public static Quaternion THIRD_PERSON_ROT = new Quaternion(new float[]{(float)Math.toRadians(0), (float)Math.toRadians(0), (float)Math.toRadians(0)});
    public static Vector3f THIRD_PERSON_LOC = new Vector3f(0f,0f,0f);



That was all

ur THIRD_PERSON_LOC is (0,0,0), this might be a location inside ur terrain.



try set it to somewhere u r sure that its above the terrain.

We're talking about local translation here. cameraNode is attached to Player. And even if it was inside my terrain, I would see the inside of my terrain, right?

theres no inside of ur terrain, besides if u want the camera to follow ur player, u should use chasecamera not cameranode.

theres no inside of ur terrain,

I'm obviously too dumb to enable backface culling

besides if u want the camera to follow ur player, u should use chasecamera not cameranode.

It offers me greater control (ie I can use first person too if I want) and when I used chasecamera, it didn't work. Now it doesn't work either, but then it actually worked more... cheez this is confusing. Anyways, if you cannot post code that makes the chasecamera stuff immediately work, I keep with those things.

I believe I start to understand what happened: Because THIRD_PERSON_LOC was 0,0,0 the camera actually was inside it's parent (the player box). Since I don't cull backfaces, it only looked like the screen was black. I'll take a look and try to modify the 0,0,0. Anyways, you can still help me with chasecamera.

Also, it seems like I forgot to set the camera's frustum :wink:

You can still help me with the chase camera, if you want  :wink:

SeySayux said:

Also, it seems like I forgot to set the camera's frustum ;)
You can still help me with the chase camera, if you want

I tried the flag rush chase camera and it didn't work for me… I'll try again and see what happens.

The camera seems to work all right now, thank you very much  :smiley: