-
Notifications
You must be signed in to change notification settings - Fork 85
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
RFC: Entity ID, a component like you and me #234
Comments
I'd be happy to have this; I agree it would make the API more pleasantly uniform.
I think this could be addressed by making the actual component type private, and exposing it only via a special
This could be mitigated by passing the |
I do wonder whether those additional bytes are worth it though to avoid the indirection via |
This does sound rather elegant! In rs-ecs I just ended up asserting the type ID against One thing I am still mulling about though is whether this could be circumvented via |
Good point! I have to imagine that maintaining a non-fragmented copy would be better as far as iteration is concerned, and I don't imagine it would significantly increase costs elsewhere. The extra 4 bytes per entity strikes me as a very marginal cost, since entities will typically have considerably more data than that anyway, so I suppose I favor your original concept there, especially given the greater simplicity.
I don't think the current API allows users to do much with a Another approach would be to use the public |
Indeed! I think this could be quite the paper cut and I also like the increased uniformity of accessing I will try to prepare a PR implementing this: storing the complete |
Sounds good; thanks! |
I have been trying this on and off for some time now, but I have to admit that I am struggling to make it work. The problem is keeping the various sets of I think all acceleration structure should use the unadorned bundles so that I would expect to only fix up the sets of Due to the complications of figuring this out, I fear that maintainability would suffer under the proposal and I am not sure that this would be worth it. Will keep trying... |
Can you elaborate on the difficulty there? Off the cuff I'd think you could get away with adding |
One complication is that adding |
Currently, entity ID are stored separately from other components and are yielded by queries unconditionally. An alternative design point would be to store entity ID like other components, i.e. add
Entity
as the only component of the initial archetype created athecs/src/world.rs
Line 1205 in 4840f93
This would enable user code to decide whether queries return the entity ID or not by including them in or omitting them from their query specifications like
and reliably remove the look-up of the generation in the query iterator at
hecs/src/query.rs
Line 756 in 4840f93
I think the main trade-offs here are the implicitness of making sure entity ID are consistent and safe from manipulation via user code and the increased storage requirements as storing
Entity
as a component requires 8 bytes versus 4 bytes for storing the ID without the generation out of band athecs/src/archetype.rs
Line 31 in 4840f93
The text was updated successfully, but these errors were encountered: