Entity Component System

Entity: Represents an Entity in the game and is a container for Component. There is no data or logic in itself.

Component: All the attribute components of an entity. One or more components make up the logical entities in the game. Data only, no logic involved.

System: The part that performs logical operations on the Component set. A System can operate on one or more classes of Components. The same Component can be associated with different logic in different systems. (System cares about component, not entity)

Use the Singleton pattern and put common code into Utility functions to resolve possible coupling problems between systems

Advantages of ECS framework:

1) High reusability: easy combination between components

2) Strong scalability: Object-oriented thinking is what the object itself is, while data-oriented thinking is what the object has, adding new functions is to add new components, without modifying the previous logic

3) Performance provides greater room for optimization

4) Reduced coupling between codes

Disadvantages of the ECS framework:

1) Data-oriented programming mode is bound to cause a large number of components and system combinations, which will form great difficulties for code reconstruction

2) The coupling between the write module and the system is too high, resulting in the reuse of some functions to run in the whole ECS environment

3) All data are open, and bad data design will have a great impact