Hello everyone. This is my first post here! I did not see a section for introductions, so if there is, please forgive me.I am really enjoying JME so far. A lot of work/talent must go in to this! Thanks for that
I am relativity new to java. I have spent most of my time on web programming and such. (I also did a lot of Actionscript back in the day so java feels very friendly to me). I can’t say if I am doing this in the most efficient way or not, but if feels OK. I have a mathematics degree so the logic comes quite naturally. Anyhow, I apologize in advance if my java “lingo” is not quite up to scratch. There may be better ways to say the things I say. I am a bit neurotic, so I feel the need to explain myself all the time… so forgive me for my long-winded post too. lol.
I have been inspired by many sources to try Entity-Component Programming… I just love the idea of the whole thing. (Maybe it is my background in web development that causes this.)
I have attempted to create a simple Entity-Component setup that is compatible with JME. Right now I am just experimenting with it in a few simple ways-- no ambitious plans.
Here is what I have:
I have a MultiHashmap that holds all the initially created “entities”. The entities have uniquely generated tags. Components are set to the tags by a method that is called after the given entity’s creation (I did this so I could churn out entities with certain components in a ‘for loop’ or something). I then access this map from a game state (which acts as my system) and pull out all the entities with a given component. This is stored in it’s own Hashmap. The state manipulates this Hashmap through whatever logic it possesses.
My questions are:
1: If i was clear enough in my description-- is this following the “rules” of an entity component system?
2: How does one incorporate models without breaking the rules? Right now I have a simple ‘position’ system that generates cubes for the position entities. The cubes are moved around by the position values being updated. There is still only data in my position components, and models are handled by the position system. Is this OK? Are models usually incorporated in the position system? What I did works, but I’m not sure if it is the ‘proper’ solution. What i did felt very “sloppy”. I am hopeful that I have not just found a complicated way to do OOP haha.
I can’t sleep at night because I am trying to wrap my head around this.
Going out for a walk to think!
-J