I have been using different game engines (mostly C++ based) for quite some time, and a month ago i found JME! So I put my previous graphic projects on hold and started writting a game with JME.
For now I managed to make a simple application where 3D characters stand around, walk around if you click somewhere or use the keyboard, and attack each other if you click on another character (it's turn based). Thanks for the help on the forums, the great tutorials and the test programs. Most other engines don't offer 1/10 of the help I found here.
Now, for my question… I'm starting to implement the game logic. I'd like to split the program so I can use JME classes only for rendering and input, and use some kind of listener or obsever to communicate with the main program logic. Something like the MVC architecture or some design patterns.
Which architecture do you recommend?
I'd like to use some simple swing components for testing, and then switch to JME with as little code adaptation as possible. e.g. I'd use a normal window to display a matrix (for the field) and some circles (for characters) in it with a controller and model behind, and then change the window to a JME window with a terrain and 3D models with the same controller and model behind.
You can use a MVC approach and it could well be the right choice.
But bear in mind that depending on your application, there's a good chance the 3D engine will be involved in the model and controllers.
For example, collision detection, phyics (even if it's just simple movement you write yourself) etc. would go on regardless of views. You will probably have 3D data such as vectors (velocities, positions), geometry etc.
Yes, I'm aware of that.
But for now I just need for the controller to know the state of the game and handle input data. If I use JME and click somewhere, I cast a Ray and get the intersection coordinates with the desired object and forward them to the controller…the same is with a JComponent component that implements MouseListener. Then the model does some math and replays back an action. The controller doesn't care if it's a skeletal animation or a simple drawLine if the view's interface is the same. Right?
I hope that I can easily convert jme.math…Vectors to some simple vectors and matrices.