Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for all possible query conflicts in initialization #1384

Closed
wants to merge 1 commit into from
Closed

Check for all possible query conflicts in initialization #1384

wants to merge 1 commit into from

Conversation

MDeiml
Copy link
Contributor

@MDeiml MDeiml commented Feb 2, 2021

Fixes #1320.

This should panic whenever a system is created that could possibly cause a conflict with some archetype. It does this by first checking if there are any conflicting accesses at all (basically test if any of the used types overlap) and then testing the conflicting queries with all possible combinations of components. This way the check should be relatively fast most of the time and get into exponential runtime only when necessary. Also this check is only performed once at startup, so performance is not too essential.

Some things that maybe should be changed:

  • I'm currently reusing the code (and variables) in SystemState::check_access in initialize and update. Maybe it would be better to split the two cases.
  • I'm also reusing the code in QueryAccess::get_access_filtered. This allows the method to be called with a real archetype or just a combination of components

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Feb 17, 2021
Base automatically changed from master to main February 19, 2021 20:44
@cart
Copy link
Member

cart commented Mar 3, 2021

This was a good idea, but I'm closing in favor of the FilteredAccess impl in #1525 (which is a smaller impl and uses bitsets)

@cart cart closed this Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Less permissive component conflict allowance in system queries
3 participants