Foundation - Systems #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Now that we have entities and components, we need systems that can manipulate the components each ECS step. By adding systems we will achieve a very bare-bones ECS system. Some additional things to add afterwards would be prefabs.
Systems works with each individual component being continuous on memory. This does mean we need to cache each system's input. For example if System A wants to process Transform, every transform should be on an std::vector<std::any_cast(std::any)> or std::span so we can feed the data more efficiently.
There is high likelihood of a certain system asking for 2 or more components per entity. As an example if System asks for components A and components B, the vector returned should consist of every entity that OWNS BOTH! A cool thing we can add is std::variant support. With std::variant a system can tweak similar components. For example if poison works the same with component player HP and component boss HP the same system should be able to process both thanks to std::variant.
Note: This is a bad example as same component for HP should be used on both boss and player. However I could not think of a better example at a spur of the moment.