Add support for x2 archetypes i a single system. #2

Open
opened 2026-05-06 21:21:43 +00:00 by larssonmartin1998 · 0 comments

Since the systems dont get the entire range of entities as a parameter, it's difficult to do any comparisons to other entities within that archetype. For instance, a collision detection system which would need to compare all transforms against all other transforms.

In order to keep our nice API which also enables chunking from Taskflow without off loading that to the game creation space, we need to add the ability for a system to request more than one tuple of components, i.e:

hephaestus.create_system([](const IEngine& engine, std::tuple<const Transform&> archetype1, std::tuple<const Transform&> archetype2){
    // Some comparison code
});

This would ideally be called like this from the system (not accounting for chunking of parallel workflow just visualising):

for (auto& [component] : components) {
    for (auto& [other] : components) {
        if (component == other) continue;
        system_callback(engine, component, other);
    }
}

This will allow for the same nice API and scheduling while still enabling more complex systems. This should ALSO support different archetypes, meaning we could request tuples that have different components in it.

Since the systems dont get the entire range of entities as a parameter, it's difficult to do any comparisons to other entities within that archetype. For instance, a collision detection system which would need to compare all transforms against all other transforms. In order to keep our nice API which also enables chunking from Taskflow without off loading that to the game creation space, we need to add the ability for a system to request more than one tuple of components, i.e: ```cpp hephaestus.create_system([](const IEngine& engine, std::tuple<const Transform&> archetype1, std::tuple<const Transform&> archetype2){ // Some comparison code }); ``` This would ideally be called like this from the system (not accounting for chunking of parallel workflow just visualising): ```cpp for (auto& [component] : components) { for (auto& [other] : components) { if (component == other) continue; system_callback(engine, component, other); } } ``` This will allow for the same nice API and scheduling while still enabling more complex systems. This should ALSO support different archetypes, meaning we could request tuples that have different components in it.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
larssonmartin1998/atlas#2
No description provided.