Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Without should narrow archetypes #91

Open
memorycode opened this issue Dec 22, 2023 · 4 comments
Open

Without should narrow archetypes #91

memorycode opened this issue Dec 22, 2023 · 4 comments
Assignees
Labels
blocked Another issue is preventing this

Comments

@memorycode
Copy link
Contributor

Currently, using :without(Components.B) in a query is similar to querying normally, using world:get(Components.B) to check if the component is present, and using continue to skip the iteration (though faster.) This is intended behavior and is documented.

for id, a in world:get(Components.A):without(Components.B) do
    -- Do something
end

for id, a in world:get(Components.A) do
    if world:get(id, Components.B) do
        continue
    end
    
    -- Do something
end

However, this approach comes with a few downsides:

  • The cost of iteration on entities with excluded components is hidden.
  • The archetype is broader than required.

Giving :without the ability to narrow the archetype would resolve these issues, though the potential downsides outside of implementation complexity are unclear.

@Ukendio Ukendio self-assigned this Dec 22, 2023
@Ukendio Ukendio added the wontfix This will not be worked on label Dec 22, 2023
@Ukendio
Copy link
Contributor

Ukendio commented Dec 22, 2023

I have put the wontfix label as I am kind of blocked on working on this until we fix our iterator to be more modular in #85

@Ukendio
Copy link
Contributor

Ukendio commented Dec 22, 2023

I have made a possible solution for this, I will put it up when aforementioned issue is resolved.

@LastTalon LastTalon added blocked Another issue is preventing this and removed wontfix This will not be worked on labels Dec 29, 2023
@LastTalon
Copy link
Contributor

This isn't what the wontfix label is for. I've added the appropriate blocked label.

@Ukendio
Copy link
Contributor

Ukendio commented Dec 30, 2023

Didn't know we had a blocked label :O

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked Another issue is preventing this
Projects
None yet
Development

No branches or pull requests

3 participants