Hello there, I’m very new to JME3 and game development in general.
I got some initial feel from JME3 and now I’m confused about the way the game developed with JME3 should be designed - where to put game logic and where not to.
First approach says, put the game logic into AppStates and Controls. That’s what they are meant for, right? If a unit should be able to move, then write a MovementControl and attach it to the Spatial. Everything is pretty and clean and you get saving and loading the game for free as long as everything is Savable. The problem with this is, I’m reading a lot of posts saying how very important it is to separate graphics and game logic. Which makes absolute sense.
Create your own classes for your entities, having all your data and implemented behaviour in your own code that is completely independent on JME3. Your engine will be called by JME3, which will provide an update() event for timing, UI events from mouse, keyboard etc., and your engine provides an interface to JME3 that allows it to draw all objects for the user.
My 5 years of experience with software development in Java tells me that the second approach is the correct one. I can theoretically switch engines without rewriting the core game, I can implement networking (which is IMO impossible with everything being directly updated in controls - pretty much every change needs to be transformed to a message/event and processed in that form), I can run simulations without starting any graphics etc. But … what are the Controls and AppStates for, then? And how about the physics implemented in JME3 (and similar things)? What if there is something in JME3 that can actually affect the entities? Should I just ignore the implemented physics and implement my own, so I have the core engine logic separated?
If you ever wrote a game using a JME3, what is the normal flow of the game in respect of where is located which code? What are you actually using your Controls for, when not for updating your entities’ attributes, which is what they are designed for? Are you just using them as proxy classes to call your own Controls in your own code? That seems really ineffective. And it definitely isn’t “not having any logic in JME3 code”.
Hope I’m making any sense here. I’ll be very grateful for any insight into this.