Assets for jMonkeyEngine 3.0 Game Development: A Practical Guide

Hi all,

I’ve started in the book “jMonkeyEngine 3.0 Game Development: A Practical Guide” but there frequent references to assets needed to develop the software that the book explains., such as:

Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

There is a zip file available with the book, called JME.zip, but it only contains the code examples. Does anyone know where I can find this material?

Thanks for any help!

This is part of JME, just use it.

Thanks for your quick response, but I don’t understand what you mean with “use it”. The files mentioned in the code are not in the ZIP. When I extract the zip, and do a

$ find . -name Unshaded.j3md

to find the file mentioned, nothing is returned.

It is in the engine JARs. And if you have the engine set up. The just type the code, compile and run. The asset manager will find it.

Ah, that’s where they are. However, on page 19 of the book I mentioned, the code example refers to a

picture.setImage(assetManager, "Textures/ColoredTex/Monkey.png", true);

This image is not there. I can create my own of course, but what is the best way to add for instance a classpath location like /src/main/resources to the assetManager? I did

assetManager.registerLocator("src/main/resources/", ClasspathLocator.class);

and it worked, but that’s ugly.

That too is there. In the test-data. Are you using the SDK? Or did you set it up by some other way?

I’m using my regular NetBeans 8.2 installation, because the SDK complained about an internet connection being not available. I also prefer Maven over Ant, and I found a pom.xml with the correct repo and dependencies.

I also read somewhere that the SDK is no longer maintained.

Thanks for pointing me to the resources on github. I have cloned it and can now just copy the assets to my classpath. But is there an established way to let the assetManager use the classpath?

According to https://wiki.jmonkeyengine.org/jme3/beginner/hello_asset.html it should just work if I put all the assets in a directory named assets in the top level of my project, but that doesn’t seem to work either:

com.jme3.asset.AssetNotFoundException: Textures/ColorTex/Monkey.png (Flipped)

Well, not entirely true. It is just separated from the engine. Core devs focus now entirely on the engine which I think is smart. And SDK has other people working on it.

You can add maven through plugins in the SDK.

Add the test-data library.

This is now called

Textures/ColoredTex/Monkey.png 

The asset manager is already using the classpath. It knows nothing of “assets.jar” except that it’s a jar on the classpath.

Sorry for reviving this, but if anyone else is looking for the answer in the future, after adding this to my pom:

<build>
        <resources>
            <resource>
                <directory>src/main/resources/assets/</directory>
            </resource>
        </resources>
    </build>

the resulting artefact contains anything under that directory, and the assetmanager will find them.

Thanks all for the help!

2 Likes