Ethereum Entity Component System
Ethereum Entity Component System
World contracts are containers for entities, component contracts, and system contracts. Its core principle is to establish the relationship between entities and component contracts, and different entities will attach different components. And use the system contract to dynamically change the data of the entity in the component. Usual workflow when building ECS-based programs
- Implement the 
IWorldinterface to create a world contract. - Call 
createEntity()of the world contract to create an entity. - Implement the 
IComponentinterface to create a Component contract. - Call 
registerComponent()of the world contract to register the component contract. - Call 
addComponent()of the world contract to attach the component to the entity. - Create a system contract, which is a contract without interface restrictions, and you can define any function in the system contract.
 - Call 
registerSystem()of the world contract to register the system contract. - Run the system.