-
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
Expose entity locations #303
base: master
Are you sure you want to change the base?
Conversation
1ccf805
to
3c862ac
Compare
Enables efficient random access of archetypes. Commits us to a dense, contiguous table of archetypes, but gives downstream more flexibility.
3c862ac
to
46998ed
Compare
46998ed
to
7386c5b
Compare
I think exposing that entities are organized into archetypes is already done so that part ( As for exposing the slice, I suspect that storing the archetypes in a slice will always remain the sweet spot for fast component access even if additional index structures are added on top. Maybe you could add some language as to how long the returned |
Yeah; only new leak there is that
Yeah, that makes sense. There is still the possibility of interposing some structure like |
I suspect that if you have that many archetypes that you want to slab-allocate them, you are probably better off with an ECS that is not archetype-based. :-) |
Column-major serialization is desirable for compressibility and efficient processing. hecs provides APIs sufficient to allow column-major serialization of the entire world by walking its archetypes, but is less helpful when only a small subset of entities should be serialized at a time. This requirement arises e.g. in large streaming worlds such as hypermine, where entities will be serialized when their enclosing volume is unloaded to conserve memory.
I'm interested in feedback on the approach taken here, since it constrains future evolution somewhat. One less constraining (and less breaking) alternative would be to expose a
fn get_archetype(&self, index: u32) -> &Archetype
onWorld
rather than exposing the entire slice, for example.