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) -> &ArchetypeonWorldrather than exposing the entire slice, for example.