I'm making a Component Based Game Engine, and i try to separate data from logic as much as possible by using this design:
/ | \
EntityManager ComponentManager SystemManager
(vector of entities) (map of (entities - vector of components)) (vector of systems)
Where essentially all these managers are just holders of Entities, Components, and Systems accordingly.
A brief description of my implementation is:
Entity: a class that represents every object in the game (just and UUID).
Component : an abstract class that (its subclasses) will hold only data about a specific thing for an Entity, ex. PositionComponent will only have the x,y values of an Entity nothing more.
System: a abstract class that (its subclasses) will have all the logic to act on Enities, ex. PositionSystem will have in its Process() method passed by the Engine an Entity to operate on, and change its component values using some predefined logic.
My problem is, how do i make objects communicate a senario like this? For example how can i send a message from a System (that resides in the SystemManager) to the ComponentManager so i can get a specific component for the current Entity that the system is processing (i already have the methods in ComponentManagers to do this, thus my problem is what is the PROPER way design to do this)?
Or generally a game that is modeled like a Operating System (in layers from the inner kernel to the outer world) how can achieve communication between every layer? Are there any good design patterns that are useful for this purpose?
Any help appreciated.