evaera / matter

A modern ECS library for Roblox.
https://eryn.io/matter/
MIT License
144 stars 34 forks source link

Without should narrow archetypes #91

Open memorycode opened 8 months ago

memorycode commented 8 months ago

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:

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

Ukendio commented 8 months ago

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 commented 8 months ago

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

LastTalon commented 8 months ago

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

Ukendio commented 8 months ago

Didn't know we had a blocked label :O