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

Adding and removing multiple components from an entity. #129

Open
Anders429 opened this issue Oct 30, 2022 · 1 comment
Open

Adding and removing multiple components from an entity. #129

Anders429 opened this issue Oct 30, 2022 · 1 comment
Labels
A - Storage Area: Storage inside a World. C - Enhancement Category: New feature or request. P - Low Priority: Not particularly urgent. V - Major Breaking Change Versioning: Requires a major bump according to semver.

Comments

@Anders429
Copy link
Owner

Currently, Entry::add() and Entry::remove() only support removing one component at a time. This means that the entity will have to be moved to a new archetype with every change if multiple changes are desired.

To account for this, Entry::add() and Entry::remove() should be modified to take multiple components. Additionally, a new method called Entry::add_remove() could be introduced which both adds and removes components at the same time.

@Anders429 Anders429 added C - Enhancement Category: New feature or request. P - Low Priority: Not particularly urgent. A - Storage Area: Storage inside a World. V - Major Breaking Change Versioning: Requires a major bump according to semver. labels Oct 30, 2022
@Anders429
Copy link
Owner Author

I've thought about this for a bit now, and I think the best way to implement this would be to also introduce a Components trait, along with components!() and Components!() macros. This makes more sense semantically than reusing the existing entity!() and Entity!() macros, since we're not directly creating an entity, just a set of components.

On that same note, it would probably make sense to combine these in the future. Technically, when a new entity is added to a World with World::insert(), it isn't really an "entity" before it is actually added, at which point it is given an entity::Identifier. Just defining something with entity!() doesn't actually make it an entity. It may make sense to combine entity!() and entities!() into this new components!() macro (and same for the type macros). This is work that can be done in the future, and won't be tracked here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A - Storage Area: Storage inside a World. C - Enhancement Category: New feature or request. P - Low Priority: Not particularly urgent. V - Major Breaking Change Versioning: Requires a major bump according to semver.
Projects
None yet
Development

No branches or pull requests

1 participant