Making level editing system like in 0x10c - tips

Can you give me tips on how to make level editing system similar to one found in upcoming Notch’s 0x10c game? For now I have following two classes:



[java]/*

  • To change this template, choose Tools | Templates
  • and open the template in the editor.

    */

    package mygame;



    import com.jme3.scene.Mesh;

    import com.jme3.scene.Node;

    import com.jme3.scene.shape.Box;



    /**

    *
  • @author Darkhog

    /

    public class EditableObjectBase extends Node {

    private EditableMesh realobject; //actual mesh which is visible in game

    private Box boundaries; //for checking which face is clicked



    public EditableObjectBase(float x, float y, float w, float h){



    }

    }

    [/java]



    [java]/

  • To change this template, choose Tools | Templates
  • and open the template in the editor.

    */

    package mygame;



    import com.jme3.scene.Mesh;



    /**

    *
  • @author Darkhog

    */

    class EditableMesh extends Mesh{

    private Boolean[] vertexshown = {true, true, true, true,true, true, true, true}; //which vertices are visible. This is needed so we can have slopes.

    public EditableMesh(Boolean[] verticestate) {

    if (verticestate==null){

    throw new NullPointerException("“verticestate” when trying to create EditableMesh was null!");

    }

    if (verticestate.length!=8){

    throw new IllegalArgumentException("“verticestate” must have 8 items");

    }

    for (int i=0;i<8;i++){

    vertexshown=verticestate;

    }



    }

    }

    [/java]



    Isn’t much because I just started. However I already have mindblock already. Even though I basically know WHAT I want to achieve, don’t exactly know HOW I will do that. Maybe I’m just tired and blabbing like always, who knows.

    I just know that I’ll have to use Mesh, because basically mesh can be modified at runtime which gives you various slopes, though basic shape is box (if you still don’t know what I mean, look up 0x10c on youtube, or even better look through Notch’s archived streams on twitch.tv, there are some screencaps from 0x10c editor there).

    Maybe small gif:

    http://i.imgur.com/FLsvV.gif



    So basically I’ll need all help I can get since the only article on Wiki about using Mesh class is really confusing.
1 Like

Well you are going to have to get intimately familiar with building meshes from scratch. Start with a 2d triangle, then build a pyramid. Then Build some of the shapes in that gif. When you understand how that works and can do it easily then you can work on picking nearby vertexes and adjusting them when the mouse moves. All you really have to do is modify the vertex buffer when you adjust the points of the mesh. That is the only hint I can give you cause this could take weeks to explain how to make a full game. I will however answer specific questions.



This should be an interesting project though, and a great learning experience.

@Sploreg said:
Well you are going to have to get intimately familiar with building meshes from scratch. Start with a 2d triangle, then build a pyramid. Then Build some of the shapes in that gif. When you understand how that works and can do it easily then you can work on picking nearby vertexes and adjusting them when the mouse moves. All you really have to do is modify the vertex buffer when you adjust the points of the mesh. That is the only hint I can give you cause this could take weeks to explain how to make a full game. I will however answer specific questions.

But as I said, the only article on wiki about building meshes is confusing. I know about counter-clockwise vertex order thing, but rest is going away from me. Also I don't really know how to calculate proper normals.
@Sploreg said:
This should be an interesting project though, and a great learning experience.

I'm sure it will be! That's why I'm tackling this task (and I have some pretty neat things in my sleeves).

If you can point me towards some other articles/tutorials about Mesh class that's dpesn't throw at you everything at once like article I've mentioned and you probably know which one it is (and if you don't, well click here), I'd be very grateful.

@Darius, that’s pretty much it. It explains everything. That is what I used to learn. There’s also a FullCodeSample - you might want to download that and experiment with it.

Between the tutorial and the source code for the various JME meshes, you have everything you need to learn mesh creation.



If it’s still confusing then this may be too hard for you… that stuff is about as straight-forward as it gets, I think.