Moonwards-Virtual-Moon
Moonwards-Virtual-Moon copied to clipboard
Refactor AEntities and AComponents for programming simplicity and clean engineering
Here are my plans to refactor AEntities and their AComponents.
- There should only be one class of AEntity. Remove the need for inheriting classes.
- AComponents should not directly call each other. Create Entity Programming Interfaces that components listen to for determining what to do.
- EPIs are the only things that should be called on when handling AEntities.
EPIs emit signals whenever their functionality is called. When components start, they either request or demand the EPIs they listen to from the AEntity. Another role of EPIs is to store variables for component to read or write to. This allows us to create a HumanoidMovement EPI that stores all the necessary variables and components can handle the logic of handling the variables.
A request is when the EPI is not necessary for the functioning of the component. If the EPI is not present in the AEntity, a dummy EPI will be returned that the component can treat as if it actually existed.
A demand is when a component expects the EPI to exist for it's purpose. The game will crash in debug mode, or emit an error in released versions if the demanded EPI is not present.
In order to have the request EPI return dummy EPIs, we need a dummy AEntity in the game with EPIs present to call. If a requested EPI is not present, then the AEntity just grabs the EPI from the dummy AEntity letting the component use it.
Thoughts?