3d block editor EDIT: download link!

It took me about a day to create a 3d block editor. Here’s a screenshot:

http://tier91.com/wp-content/uploads/2011/08/blockshot-1024x595.jpg

Any advice on what to do with it?

1 Like

:smiley:

Thats the spirit.



Make it interact with a basic AI using simple, scriptable rules. JYthon could be of help here. Make a pet-game of it. Something like a good old tamagotchi or so.

Maybe a jSims of life xD.

Well I can figure out how to access an object from Jython script within a Java context, but I can’t figure out how you would talk to that object from another Java object.



Problem:

  • load Python script into PythonInterpreter using Jython
  • instantiate instance of Java object from the Python script

    ?? but how do you bind the Java object instantiated in the Python script with other parts of the code that contain the JME objects?



    A few quick tips would help me with the scripting aspect before I begin designing the code. Any advice KuroSei?

Should I use the built-in jbullet physics in JME3 or should I write my own? What is the trade off?



For the first incarnation of the program, I want to make it extremely simple and uncomplicated with just a few solid simple features.

I thin jbullet is easy to use, so why not use it?

And jython:

PythonInterpreter py;

You can add a Object to python with a name



py.set(“myobj”, yourclass);



myobj.addXYP(…)

Or you could use a static class.

Cool, thanks! That’s good advice.



I got it so you can walk around in the map with jbullet physics now!



I’m going to add file operations to load/save maps now.

In the mean time I’m looking for more advice as to generally what the program should become (sims, tamogochi, etc)…

And - just in case - you want to call Python functions from your java code…

( I needed quite some time to figure that one out. A lot of trial and error. :smiley: )



[java]

/**

  • Calls a GameMode method with the given arguments
  • @param FName The name of the Function
  • @param args The arguments to pass to python

    */

    public void callGMMethod(String FName,Object[] args) throws PythonException {

    try {

    PyObject M=GameMode.get(FName);

    PyObject[] TArgs=new PyObject[args.length];

    // Fill the array.

    for (int i=0;i<args.length;i++) {

    TArgs=Py.java2py(args);

    }

    // Call the function :wink:

    M.call(TArgs);

    } catch (Exception e) {

    throw new PythonException(“Could not call GM-Method '” + FName + “’ (” + args.length + " Parameters)");

    }

    }

    [/java]

Thank you so much for that advice! :slight_smile:



I’ve got file operations working.



Next I gotta spend a little while collecting ideas for what to do with it. I will definitely try using Jython.

Hmm I liked the tamogochi idea :smiley: And yeah I use Jython too and really like it :smiley:

Here’s a link to the download of the first prototype:

http://tier91.com/?p=37

Here’s an excerpt from my planning document (an “MG” is a “Monkegochi” character):

KEYS:
F1 = HELP SCREEN
F2 = SELECT NEXT MG
F3 = SELECT PREV MG
F4 = TOGGLE CURRENT MG AUTOPILOT
F5 = SAVE MAP
F6 = SAVE ENTIRE STATE
F7 = LOAD MAP
F8 = LOAD ENTIRE STATE
F9 = CREATE NEW MG @ CURSOR
F10 = ERASE CURRENT MG
F11 = POSSESS 1st PERSON
F12 = RETURN TO 3rd PERSON VIEW
F = >>kick "F"
E = (automatic) eat (touch food to eat it) "E"
Z = >>poop "Z""
Q = >>sleep (shows zzzz's above head for awhile) "Q"
1 = >>yell (shows yelling balloon) "1"
2 = >>smile (shows "yes!" thought balloon) "2"
3 = >>grumble (shows swearing balloon) "3"
W = >>walk fwd ("W")
S = >>walk bkwd
A & D = >>turn ("A" or "D")
SPACE = >>jump ("SPACE")
X = >>avoid object/area (walks in opposite direction) "X"
G = >>approach object/area (walks toward) "G"
R = >>pick up selected block "R"
T = >>place block at selected location "T"
I = cursor fwd
K = cursor bkwd
J = cursor left
L = cursor right
O = cursor up
. = cursor down
ENTER = place/remove block
PLUS KEY = next texture
MINUS KEY = prev texture
GENERAL STRATEGY:
- Simple application/game.
- Few simple features, correctly implemented.
- Lots of testing.
- Specific design w/ prepared code testing for new features.
- Add one feature at a time.
GENERAL IDEAS FOR THE NATURE OF THE GAME:
- sims
- tamagochi

you can use beanshell instead of jpython, beanshell allows you to use java as a script language.

Maybe you should do a performance comparison before you decide what is better.



Pros : 1) You dont need to bind anything, can use all java code instantly.

2) Java is easier to use.

With JSR-223 scripting support (built into Java) you can access all kinds of scripting languages, including JavaScript (built into Java), Groovy, jpython, etc…



Personally, I’d recommend groovy over beanshell. It’s Java with extra dynamic goodies.



…and to pass in objects created outside of the scripting language then you will always need to bind something. Though in this cases it’s just giving objects a scope and a name to use in the scripts.

I can use all classes with jPython too.

Just write





from mygame.package.NPC import NPC



class NPC_MYNPC(NPC)

When it comes to jython i can help. Just write me a message with a question. :wink: