I’m new to JME and after reading the tutorials for beginners I think I got a general idea of how to use the engine. Now I would like to code a small test game just to get used to the it. Problem is: I don’t know how to get started. What I would really need would be some general advice on game architecture or a sample project with source code. All sample games I’ve seen so far are more like tech demos and already compiled.
Watch Monkeyzone if you need a testproject.
In general the golden rule of programming is: First the concept then the code.
You can program and watch where it leads but without at least the general idea what has to be done you will just lose yourself in the first few days of progress and stop your project depressed of life and what it gave you in the awfull process of development.
After the general idea what your game shall be like you have to decide how you achieve your most important goals like gameplay and questsystems aso.
You will encounter a lot of problems in your progress so the more you plan the better you will do.
Well, actually I didn’t intend to produce a “real” game not even just a very small one.
I wanted to make some kind of test setup to play with the engine. Just a simple terrain and an object that can be moved. Then this could be improved. Maybe I would give the player the ability to jump and add a few platforms. Then add a few enemies that simply move towards the player. After that I could code some kind of GUI start screen…
Nothing fancy just a testcase to practice.
The problem is that even something as small as this needs a structure but I don’t know common structures in JME.
I would like to learn the JME way of problem solving.
The tutorials just showed how to achieve one special feature at a time. Moreover everything was done in just one class.
I don’t know how to put it all together.
Therefore I’d appreciate some source code or advice on architecture.
Monkeyzone is an interesting example but I couldn’t find any source code and the explanations here http://hub.jmonkeyengine.org/2011/02/13/monkeyzone-a-jme3-game-from-the-core/ didn’t cover my needs
the source of monkey zone can be found here: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:monkey_zone, but a lot of it looks complicated because there is a lot of networking involved. Best practices can be found here: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:best_practices
For future reference most things that you will want can be found in documentation → tutorials & docs. It is very good. Most of the time questions get asked in the forums they are directed to one of the links in this section :). The way you structure your code is up to you, and many people will have opinions on it, its best as you say just to test it out, and you will soon find out how to properly lay everything out, gl
You’re right, the source code is pretty difficult. It’s hardly readable and I would lie if I said I understood even one fifth of it. Yet sometimes it can help to take a short look at their code to understand the proper use of a technique.
It’s just that Monkeyzone won’t compile on my machine. I downloaded the entire filesystem that was available and opened the project with JME just to be confronted with numerous errors. I guess Monkeyzone was targeted to an older version of JME and suffers from API changes. Did I make a mistake or are these known errors ?
Make sure you have the nightly download. When i first tried it, i couldn’t compile it either (about 2 months ago), but now i can
Its meant to be run with the nightly version of jme3. Still there might be some compile / run errors with the monkey zone code at the moment, yes. All the code is commented though, if you really have a hard time reading it I suggest reading the code and jme3 manual a bit more until you understand it. Fixing it to an extend that it runs should be a nice test for that
One of them seems to be
Compiling 74 source files to /home/jason/jMonkeyProjects/trunk/build/classes
/home/jason/jMonkeyProjects/trunk/src/com/jme3/network/physicssync/PhysicsSyncManager.java:40: cannot find symbol
symbol : class Server
location: package com.jme3.network
A little poking around (wither with autocomplete in JMP or in the java docs) shows that
is wrong, replace with
Youll find a lot of things like that.
Well thats only true for the alpha-4 version, as said you should use the nightly version of jme3 for MonkeyZone.
Oops, yeah, just an example of a way to poke around the code. Also, you dont really need monkeyzone to be buildable / runnable to understand whats going on. Start digging in ClientMain.java, and ignore (for now) the network stuff.
Heres how some of my ‘exploratory missions’ into the code are like :
-Check out private variables, see something like private BulletAppState bulletState;, look at the javadocs for what BulletAppState might be, look in the tutoirals section to see whats there regarding this class.
-See an unfamiliar function in ClientMain called startNifty(). Right click it, Navigate->Go to Source (Gotta love JMP), read that function and try to understand what its doing.
-see things like flyCam that must be inherited, begin to wonder where it and other objects like it are imported from, which leads to a better understanding of SimpleApplication.
Really, this framework is a BIG picture, you gotta get nose-close to it all over and build the picture of it in your mind.
haha, that is exactly what i do. you get a +1 thumbs up for that.
its funny to see the very method i use to learn and become familiar with jME typed out on the forums by someone else. it makes me feel just a bit more connected to this world.
p.s. @zwillenguru one thing i tend to do when creating seperate classes to be used by my main app class is to make constructors requiring the main app to pass a reference to itself when it calls them, and also by making getters in my main app that return the objects found only inside my main app class that i may need in other classes. this way my PlayerCharacter class will have access to the assetManager of my main app to load a model to represent itself, and access to the rootNode of my main app to attach itself to (making it visible in the scene).