ECS
Why ECS?
ECS (Entity-Component-System)
ECS is suitable for decoupling large data objects, commonly used in games where each character (Entity) has extensive data that needs to be split into physics engine-related data, skin-related data, character attributes, etc. (multiple Components) for consumption by different subsystems (Systems). When workflow data structures are complex, ECS is very suitable for decomposition.
Solution Comparison
Let's compare two data solutions:
1. ReduxStore Solution
Advantages:
- Simple to use with centralized data management
Disadvantages:
- Centralized data management cannot update precisely, leading to performance bottlenecks
- Poor extensibility, adding new node data couples everything into one large JSON
2. ECS Solution
Notes:
- NodeData corresponds to ECS - Component
- Layer corresponds to ECS - System
Advantages:
- Node data is split for individual rendering control, enabling precise performance updates
- Strong extensibility - adding new node data just requires adding a new XXXData + XXXLayer
Disadvantages:
- Has a certain learning curve