I also study this and come up with some solutions that can be quick and non-intrusive.
The goal of creating a component-based application is that you can add and remove components whenever you want at runtime, and have little or no connection; components can coexist without even knowing about each other.
So how does the âvisualizationâ component know where it should look or worse, what should it display? My answer is that each component to be shared has access to a common table of proprietary entries stored in their container (usually in a game object or game object).
For example, suppose a game object with a motion component, a rendering component, and a symbol component
Rendering components request their container for a property named "positionx", "positiony" and "positionz" (if it is a 3D game), and then request the property "rendermodel". Based on this, the rendering components display the property returned by rendermodel in positionx, positiony, and positionz. Positioning properties are changed by the movement component, which itself sets the "speed" property on the container, which, in turn, is configured by the symbol component based on keyboard input.
If these properties do not exist, they are created at the time of their request and initialized with a valid value (for example: 0).
In my opinion, components should never request another component, since they should be considered as general as possible.
source share