Original Post
I really liked the idea of a pure entity system like described in this article series.
Now, implementing the entity manager itself is very easy.
The hard part for me is designing interaction between components, and getting manual scripts for specific components.
I am trying at the moment to have a user input component, and while my game is very small, I do like the idea of setting a script manually for how the component should react to different events (such as mouse clicks, key presses, and so on).
Right now I give the component's constructor a callback function which is later on called by the appropriate system, but this just seems hack-ish and wrong.
Basically I want to give a human player a specific script that will tell it what to do in each event, but I rather not hard-code it.
Now on the other issue - interaction between components. I like the best the idea of letting a component to send a message to all the components that its owner owns, and whoever doesn't need the event will silently ignore it (the rendering component wont try to play a sound).
While this is all nice in concept, I can't see a clean way to implement it.
At the moment, I get the owner from the entity manager, then I tell the entity manager to send the message to all the components owned by the entity, but it seems a little weird that the entity manager should be involved.
The fact that the components have their callbacks given to them as parameters at creation time is also a bit weird as stated before.
I am wondering if anyone here experienced with this type of entity systems and have better solutions then mine.
I do not care much about efficiency right now as my game is very small and hardly requires anything, so I would rather have the "purest" solution even if it's slower then more optimal ways (like keeping references in components to other components they are known to change).
Thanks in advance.
Now, implementing the entity manager itself is very easy.
The hard part for me is designing interaction between components, and getting manual scripts for specific components.
I am trying at the moment to have a user input component, and while my game is very small, I do like the idea of setting a script manually for how the component should react to different events (such as mouse clicks, key presses, and so on).
Right now I give the component's constructor a callback function which is later on called by the appropriate system, but this just seems hack-ish and wrong.
Basically I want to give a human player a specific script that will tell it what to do in each event, but I rather not hard-code it.
Now on the other issue - interaction between components. I like the best the idea of letting a component to send a message to all the components that its owner owns, and whoever doesn't need the event will silently ignore it (the rendering component wont try to play a sound).
While this is all nice in concept, I can't see a clean way to implement it.
At the moment, I get the owner from the entity manager, then I tell the entity manager to send the message to all the components owned by the entity, but it seems a little weird that the entity manager should be involved.
The fact that the components have their callbacks given to them as parameters at creation time is also a bit weird as stated before.
I am wondering if anyone here experienced with this type of entity systems and have better solutions then mine.
I do not care much about efficiency right now as my game is very small and hardly requires anything, so I would rather have the "purest" solution even if it's slower then more optimal ways (like keeping references in components to other components they are known to change).
Thanks in advance.


