Indra-db / Flecs-Rust

a Rust API for Flecs : a fast entity component system (ECS)
MIT License
188 stars 11 forks source link

trait query #188

Open michael-dm opened 1 month ago

michael-dm commented 1 month ago

A super nice feature this library could have is trait query. Similar to: https://github.com/JoJoJet/bevy-trait-query

I'm not fully grasping ecs internals but it seems that flecs Components beeing entities, it should be much easier than Bevy to implement. (storing which trait is implememented on the Component)

Indra-db commented 1 month ago

there was some interest before from @andrewgazelka and @james-j-obrien and at my work for this, but it's on a low priority at the moment.

why would it be much easier to implement that components are entities?

michael-dm commented 1 month ago

This was a bold claim, but I understand that it allows to add tags on the Component entity to denotes which traits it implements. Making it easy to then build a query that matches any component implementing a specific trait.

I think this is what alice_i_cecile refered to here: https://discord.com/channels/691052431525675048/1293664836764434524/1293684733154168913

Indra-db commented 1 month ago

I asked in rust community: https://discord.com/channels/273534239310479360/1120124565591425034/1295772082226860104

might give it some prototype time in the near future, will see, thanks for the link

feel free to start a PR as well, I'd be down on working on this together

andrewgazelka commented 1 month ago

vy-trait-query

Yea definitely cool to have. I by no means need this, but I'm sure will make my life easier in some areas :)