Replies: 2 comments 2 replies
-
I think this is better suited for a discussion. Converting it. |
Beta Was this translation helpful? Give feedback.
-
No, EnTT uses a specialization of the
Uhm 🤔 it depends of what you mean. The library derives from the plain sparse set and adds yet another packed array on top of it. See here and the
You're mixing apples and pears. Recycling an identifier is something that entity storage does. Component storage types aren't interested in recycling any identifiers. So, yeah,
Components: nowhere. If the i-th position contains a tombstone in the sparse set, then the memory chunk to store the component is empty in the storage class. Uninitialized memory, available for next reuse.
The tombstone is in the packed array. Again, you're confusing the entity storage with the component one. |
Beta Was this translation helpful? Give feedback.
-
I recently discovered this library and read a series of blogs by the author, I learn a lot from it, This is invaluable to a programmer.
But I also had some confusing about Sparse Set.
As far as I understand, sparse set is used in entt by:
entt::storage<void>
used in the registry to store entities?I also read that an
entt::null
entity is an entity whose identifier part is invalid, This is used in a sparse array of a component pool's sparse set to indicate that this entity does not have this component (avoid to test dense array ), But if the identifier part is occupied byentt::null
, how to implement the implicit linked list for identifier recycling?And
entt::tombstone
is a version part invalid that is used to ensure pointer stability in dense arrays of sparse sets of component pools, But if it is stored in the dense array, where are the components stored? Ifentt::tombstone
is not stored in a dense array, but in a sparse array, then its identifier part originally indicates which entity is the tombstone, and now the position in the sparse array has already indicated this? And there is still no place left for the implicit linked list (the identifier part should storeentt::null
)? However, if stored in a sparse array, iterating over a dense array will not be able to distinguish and skip invalid tombstone components?Beta Was this translation helpful? Give feedback.
All reactions