matter
matter copied to clipboard
Without should narrow archetypes
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.
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
I have made a possible solution for this, I will put it up when aforementioned issue is resolved.
This isn't what the wontfix label is for. I've added the appropriate blocked label.
Didn't know we had a blocked label :O