Project's template (without SDK)

Here is my minimal build.gradle template, for what it’s worth:

apply plugin: 'java'
apply plugin: 'application'

mainClassName = 'mygame.Main'

repositories {

ext.jmeVersion = "[3.1,)" 

dependencies {
    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
    runtime files("assets")        

Ha! that could work
Still, remember people are coming from the SDK : right click/new project /jme basic game/ click on the green arrow.
Many of them don’t even know command line… so we have to start cool… with commands with max 2 params :stuck_out_tongue:
idk really… of couse savvy devs will get this sorted out anyway… but what about the others?

files(“assets”) will not include the assets into the distribution created by ‘application’.

I merge assets into src/main/resources (create the default dir). bonus, it will works with IDE.

(never try) but IDE could create a project by cloning an existing one.

I actually don’t like any current approaches to assets. It’s a pain and yes, I think for gradle it may be best to put them in resources. Leaving them separate let me make -assets.jars pretty easily, though.

Here is my blue cube source file to go with that project:

package mygame;

import com.jme3.math.ColorRGBA;
import com.jme3.material.Material;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;

public class Main extends SimpleApplication {
    public static void main( String... args ) {
        Main app = new Main();
    public void simpleInitApp() {
        Box box = new Box(1, 1, 1);
        Geometry geom = new Geometry("box", box);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Blue);

Put it in src/main/java/mygame relative to the template and you get the standard JME blue cube app.

Honestly, in all of this, typing it 100% from memory with no IDE… two things tripped me up:

  1. remembing the damned location for Unshaded.j3md
  2. forgetting that box’s default constructor makes a box of size 0. :smile:
1 Like

Anyway, this thread is good because there are a lot of things to work out before we even really standardize a template.

For example, some prebuilt plugins for application bundles that actually work, etc… I really miss a launch4j exe generator as the new SDK never produced workable bundles for me on any platform and I had to go back to manual launch4j execution.

well intellij can open a project from github, but it clones the project and use it directly, It’s not using it as a template.

My problem with this is also that a basic in a template project like this you have plenty of hardcoded stuff like the name of the app and the group…
We’ll have plenty of games called project_template in the group… :stuck_out_tongue:
People not knwoing how gradle works will never know they have to change it…

EDIT: actually the default name of the app is the current directory…so it could work…

And the group is totally unnecessary until you want to push something up to a maven repo.

It should be left out of an app template.

Edit: then the only thing the user would have to change is the mainClass… and they already have to do that in the SDK.

yeah and they most of the time keep the Main class anyway…

I really wish there was a configurable way to add things to the init task.
gradle init jme-app
…would be so cool.

The doc, will include instructions so user will learn how to customize build (for desktop dist, android dist, generate assets as a separate jar, …)

To generate bundle with exe, with or without bundled jre I suggest my own plugin Gradle - Plugin: net.alchim31.getdown :wink:

1 Like

yeah exactly

Users don’t read doc… they want to click on things

Does it also make a stand-alone .exe without getdown?

I’m wary of anything like what the SDK did before since the apps failed to run on the three different platforms I tried.

Maybe, my vision is distord by Arch Linux approach.

that’s weird…got it to work on windows and osx…

Failed to work on Win XP, Windows 7, and two versions of Linux Mint.

For Math Attack, I let is use the executable jar.

getdown is used as launcher, bootstrap and work as standalone, without need to setup a http server. I used it to distribute app for LudumDare and

Anyway… IMO we’ll never beat the right click new project in term of UX…
Let’s pick the approach that is not too painful for users and not too demanding for us

1 Like