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

Add Apecs.Experimental.Children module #132

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

jship
Copy link
Collaborator

@jship jship commented Feb 21, 2024

This PR adds Apecs.Experimental.Children to support one-to-many relationships. A "parent" entity may have multiple values of a particular component type. This is like how in apecs-physics an entity with a Body component value may have many collision Shape component values (where each Shape value is owned by another distinct entity), but general-purpose so that we can build this kind of relationship for any component types.

There is an example that demonstrates usage and is likely a good starting point to get a feel for what the interface is like.

I'm not totally sure this functionality belongs in the main apecs library, though I feel the internals are fiddly enough that it'd be nice saving others from reimplementing similar behavior. I'm finding the functionality useful in my projects, but I could also see the code being pushed into a new library if that's preferred.

Copy link
Owner

@jonascarpay jonascarpay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent, thank you for including tests and an example. I'd be happy to include this.

It took me a while to figure out where to look for the exact functionality that this provides, and why I'd be interested in using this module. Please move the synopsis to the top, include

  • Concretely, what you get by using this module instead of just including a parent field in your component data type. In other words, highlight the ChildList and the functionality that it provides.
  • one or more (very brief) example use-cases
  • and then the link to the example

Copy link
Owner

@jonascarpay jonascarpay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! Sorry for slow responses

@jonascarpay jonascarpay merged commit 00385ff into jonascarpay:master Mar 14, 2024
19 checks passed
@jship jship deleted the children branch March 15, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants