I want to use a component based system in my game. It should have subsystems for logic, and every subsystem has a list of components which stores the data.
The problem is: How to sync the components?
- Should I have a pointer to another component (Movement subsystem needs position of entity, so its component has a pointer to the position component?)
- Should I go with a observer pattern, which notifies all other (registered) subsystems, that the position of the entity has changed? Then I need a reference from the movement subsystem to the position subsystem, to get the actual position, because with the notify I only want that the notified subsystem adds a "to-be-processed" entry to it's queue. This should avoid a confuse processing of the entities.
Are there other (better?) approaches?
Thank you for your tips!