Hello Stack Exchange,
I apologize if this has been asked already, but I couldn't find an answer through searching...probably due to being unable to describe what I am looking for very well.
So, last weekend I spent several hours writing a basic entity component model in Javascript. I was largely referencing the Ash action script game engine. I successfully worked out how the systems, components, nodes, and entities all link up, but one thing that eludes me is how to implement the "watcher" that checks the entities for their components, creates nodes for them, adds those nodes to the various systems automatically, and watches for any changes in the components on an entity. I was a bit confused by the way it works in Ash and all of the posts and tutorials on the subject that I have read seem to forgo the details of that part of the implementation. I would be grateful if someone could help walk me through the logic or point me to resources that explain that portion of the idea more clearly.
Right now, I currently have the following...
- Entity which is assigned components.
- Engine which keeps a track of the systems and entities.
- Node which contains references to the components in an entity that we want the system to modify (currently creating these manually and adding it to the system).
- Component which contains the data to be modified by the system.
- System which operates on the nodes which in turn change the data in the entity.
I also have various other classes dedicated to holding lists of the various objects. Please help me understand where to go from here. If you need me to post my actual code or be more descriptive, let me know.
Thank you very much.