Systems class

Hi all,

I was wondering about the various systems i have in my game (that i really need). And they are three:


  1. Physics System
  2. Entity System
  3. GameState System



    Perhaps we could unite those classes under a single superclass so that future systems could be easily plugged in.



    Then we could do some optimisations for the systems. Like have AbstractGame have an arraylist full of systems, and it would call their update(float time) automagically. Ofcourse there will be some mechanism to disable some updates and keep others, or pause them all…etc.



    What do you think?



    DP

It would look something like this then?



interface JMESystem {
   JMESystem create();
   JMESystem getInstance();
   void update(float tpf);
}



I don't know... they work a bit different, e.g. the GameStateManagers render method also needs to be called, and at least I only have the PhysicsSystem created and updated from my ingame state.

something like that yes.



In your case, you wouldn’t add the physics system to the arraylist but call it directly from your game system…



DP

I’m not really seeing a good reason for this… Are there really any benefits to this? I imagine any new big systems added to jME would require certain customizations that this slight bit of abstraction would be trivial.

It just gives a starting point of systems. E.g. Ive noticed that AI is VERY game specific, and it would just be easy for a jME user to find a starting point in which things are already made for them…



Or a ShaderSystem to handle coordination of shaders or something (i just made that up btw…)



DP

I like the idea of all the various systems having a common root like DP stated. If I want to add an AI system all I have to do is inherit from the BaseJMESystem class and that can automagically register me with the AbstractGames’s System list and I know I’ll get called according to my game type (fixed rate, or as fast as possible with time delta).