Potential Issue with Tutorial 3 - Hello Assets

Hello. I’ve just started playing with jME in order to get familiar with it for an upcoming project. I’ve been going through the tutorials, and am currently working with the third. I don’t have any issues understanding the tutorial, and have already completed the primary objective of depicting the scene with the green ninja standing over a stone wall having a little teapot on it.



There is an exercise at the very end of the tutorial, though, that deals with loading a scene in a few different ways. The application builds and runs, but the result is a black screen. While I realize my inexperience with the engine could be the cause, my interpretation of the warning errors I later noticed leads me to believe that the “town.zip” file that was provided lacks some of the required files.



Here is a part of the output that seemed related to the problem:

[java]WARNING: Cannot locate resource: Scene.material

Feb 2, 2011 7:15:25 PM com.jme3.scene.Node attachChild

INFO: Child (main-scene_node) attached to this node (Root Node)

Feb 2, 2011 7:15:25 PM com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

WARNING: Uniform m_VertexColor is not declared in shader.[/java]



I looked inside of the archive and noticed that the Scene.material file was missing. I attempted to run some of the later snippets of code instead, but those either resulted in a similar problem or crashed outright. I looked inside of the archive and noticed that the root folder lacked a Scene.material file. I did, however, find it in a subfolder. I played with it for a while, for example, I moved the Scene.material file from the subfolder to the root of the archive, but I got another warning that a different resource was missing. I’m not exactly sure what is wrong-- the description in the tutorial sounds simple enough, so I’m pretty sure I’m following the instructions correctly. Is there something wrong with the town.zip file, or have I managed to make a complete fool of myself in this seemingly trivial exercise? Any help would be appreciated.



For further reference, the tutorial I’m referring to is here.

Well that was silly. I didn’t even post the code. Here it is-- though it is almost entirely a copy/paste from that particular section of the tutorial.



[java]package mygame;



import com.jme3.app.SimpleApplication;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;

import com.jme3.scene.Spatial;

import com.jme3.asset.plugins.ZipLocator;





public class Main extends SimpleApplication

{



public static void main(String[] args)

{

Main app = new Main();

app.start();

}



@Override

public void simpleInitApp()

{

assetManager.registerLocator(“town.zip”, ZipLocator.class.getName());

Spatial gameLevel = assetManager.loadModel(“main.scene”);

gameLevel.setLocalTranslation(0, -5.2f, 0);

gameLevel.setLocalScale(2);

rootNode.attachChild(gameLevel);

}



@Override

public void simpleUpdate(float tpf)

{

//TODO: add update code

}



@Override

public void simpleRender(RenderManager rm)

{

//TODO: add render code

}

}[/java]

Hello Guys, tryng to test jme today! I am having exactly the same issue as my friend above, can someone help me, needs more information?

Thank you all!



Ps: So exciting using Java to program games, now that multthread is activated we can use all the power of the jmm and the concurrent api. Nice Job guys!

Hello little noob, the tutorial 3 is a bit trick because the Monkey guys don’t say to put a light to see the enviroment, obvious but not to any one so use it:

[java]package mygame;

import com.jme3.app.SimpleApplication;

import com.jme3.asset.plugins.ZipLocator;

import com.jme3.light.AmbientLight;

import com.jme3.light.DirectionalLight;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Spatial;

/**

  • test
  • @author normenhansen

    */

    public class Main extends SimpleApplication {

    public static void main(String[] args) {

    Main app = new Main();

    app.start();

    }

    @Override

    public void simpleInitApp() {

    assetManager.registerLocator("town.zip", ZipLocator.class.getName());

    Spatial gameLevel = assetManager.loadModel("main.scene");

    gameLevel.setLocalTranslation(0, -5.2f, 0);

    gameLevel.setLocalScale(2);

    rootNode.attachChild(gameLevel);

    setUpLight();

    }

    private void setUpLight() {

    // We add light so we see the scene

    AmbientLight al = new AmbientLight();

    al.setColor(ColorRGBA.White.mult(1.3f));

    rootNode.addLight(al);

    DirectionalLight dl = new DirectionalLight();

    dl.setColor(ColorRGBA.White);

    dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal());

    rootNode.addLight(dl);

    }

    @Override

    public void simpleUpdate(float tpf) {

    //TODO: add update code

    }

    @Override

    public void simpleRender(RenderManager rm) {

    //TODO: add render code

    }

    }

    [/java]