Foundation - Systems #8

Open
opened 2026-01-06 02:24:40 +01:00 by cat · 0 comments
Owner

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.

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<Transform>(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.
cat added the Kind/Feature
Priority
High
2
labels 2026-01-06 02:24:40 +01:00
cat added this to the Tourmaline Engine - Basics project 2026-01-06 02:24:40 +01:00
cat added a new dependency 2026-01-06 21:21:05 +01:00
cat removed a dependency 2026-01-06 21:21:10 +01:00
Sign in to join this conversation.