Search code examples
javaarchitecturegame-enginejmonkeyengine

Java Monkey Engine Tutorial


I've worked my way through the tutorial series of jme and feel like I've understood the basics. Now I would like to create a first very simple game. Nothing fancy just a simple test scenario: The player should be able to move an object. Then I would like to expand it. However I don't know how to start. It's hard to explain but I just don't know where to put my code. The manual says that there are "controls" (implemented as interfaces) that let you hook your code up to frequent update calls or other events (that's what I understood) but I can't grasp how to use them.

More detailed description. You could skip this:

To get the point clear - I'm coming from the engine Unity3d. The usage was quite pleasant, the community helpful and the documentation great. But you have to spend about 1000$ to get the full version and be allowed to use pro features (shadows, custom shaders, some advanced tools,...). After a while the temptation of open-source was simply to big. In unity3d you basically have an advanced 3d editor and a scene graph. You can place objects in the scene and access and modify them over the scene graph. You can use predefined objects such as lights or particle systems and change them to suit your needs but most things you use are custom made and puzzled together by different components: a mesh, a collider, a few scripts. And this is where your code comes to work. In unity3d your program is split into small scripts and these are added to the objects of each scene. The scripts have access to the underlying engine, the properties of their object and can use a special framework for math, networking,... Each script can also define functions to be called in certain events: update(), onCollisionEnter(Collider other), onTriggerEnter(Collision other), ... This was extremely easy to use. Admittedly huge architectures can be difficult to implement but this setback was complemented by very high productivity.

Frankly: I need advice how to structure a simple game with JME.

  1. What architecture do you recommend ?

  2. How are controls used ?

    I would appreciate a link to a tutorial (I already read the flagrush series) or any other resource.

Thank you for your help


Solution

  • I'm not sure how well you read the tutorials but they quite literally explain the things you asked for.

    Anyway, you code everything so you don't add an object and put code in it you instance an object trough code.

    Input is handled by the InputManager, as long as you still use SimpleApplication as foundation you don't have to think about it and use it the way you learned in this tutorial