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

Queryable Entity relations #231

Merged
merged 12 commits into from
Apr 29, 2023
Merged

Queryable Entity relations #231

merged 12 commits into from
Apr 29, 2023

Conversation

mlange-42
Copy link
Owner

@mlange-42 mlange-42 commented Apr 28, 2023

Implements entity relations that split up archetypes for faster queries by relation.

Each entity can have one relation. Multiple relation component types, however, are possible.

Defining relations:

type TestRelation struct {
	ecs.Relation
}

Relations can be queries like this:

world := ecs.NewWorld()
relID := ecs.ComponentID[TestRelation](&world)

target := world.NewEntity()

filter := ecs.RelationFilter{
    Filter: ecs.All(relID),
    Target: target,
}
query := world.Query(&filter)

for query.Next() {
   / ...
}

Fixes #190

TODO

@mlange-42 mlange-42 added enhancement New feature or request performance Performance-related stuff labels Apr 28, 2023
@mlange-42 mlange-42 self-assigned this Apr 28, 2023
Repository owner deleted a comment from coveralls Apr 28, 2023
@mlange-42 mlange-42 marked this pull request as ready for review April 29, 2023 16:33
@mlange-42 mlange-42 changed the title Entity relations Queryable Entity relations Apr 29, 2023
@mlange-42 mlange-42 merged commit 8b13271 into main Apr 29, 2023
@mlange-42 mlange-42 deleted the entity-relations branch April 29, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Performance-related stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entity relationships à la Flecs?
1 participant