ecsx-framework / ECSx

An Entity-Component-System framework for Elixir
GNU General Public License v3.0
210 stars 10 forks source link

Idea: Query System #86

Closed Binsect closed 6 months ago

Binsect commented 6 months ago

In game development practice, it may be necessary to query the system. Mixed query and filter components.

APB9785 commented 6 months ago

Hi Binsect. Simple querying of Component values is already implemented via search/1, at_least/1, at_most/1, and between/2. If you are needing to make more complex queries, give it a second thought - you might have somewhere diverged from Entity-Component-System (ECS) philosophy. Part of the philosophy is that game logic is split into many Systems, where each System only has one small responsibility. Your System might be attempting to take on too much responsibility, and would be better split into several smaller systems, each operating on a different subset of the Component data.

Closing this issue but if you'd like to share your specific use-case(s), feel free to leave more comments/code and I'll take a look ASAP.