Replies: 1 comment 10 replies
-
What do you mean exactly? Currently, it just wraps to 0. It's pretty well defined.
There is a difference between an invalid entitiy and an entity with an updated version though. That is more or less the reason for which the version exists.
As it is (with shared pointers and whatnot), it looks technically unfeasible and a huge step back.+
Entity identifiers are fully customizable already. Moreover, I'm working to make the entity storage a proper storage which also is all in all similar to that of a random component |
Beta Was this translation helpful? Give feedback.
-
I am interested in an entity implementation that handles version overflow and maxing out entity ids more robustly.
As noted in #761, long running applications that continuously delete and create entities can run into issues with the version number associated with an entity overflowing and incorrectly causing destroyed entities to be reported as valid. The behavior when the entity ID overflows is also undefined.
Here is a potential way of eliminating the version overflow issue. For simplicity, I have described it using shared pointers for the entities, but this could be adapted to an implementation that stores the underlying data in a compact representation, using similar techniques to what is done for the registry vector. The code is just meant to give an idea of the approach and isn't intended as an actual implementation.
This implementation matches what entt does already, except that it separates the storage of the entity value from the allocation in the registry's vector, which eliminates the need for versions and issues associated with versions overflowing.
With this approach, version numbers are not needed anymore. Just one value (already reserved as null in entt) needs to be reserved to indicate that an entity is invalid. So more bits are freed up for the ID, which could help eliminate reaching the simultaneous entity ID limit as well.
Any thoughts on this approach and how feasible it would be to include in entt? Would it be possible to abstract the entity type used by the registry to accommodate this approach in addition to the existing behavior?
I would be interested in hearing about other suggestions for improving robustness as well.
Beta Was this translation helpful? Give feedback.
All reactions