-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Stable Memory Location for Components #625
Comments
Before replying, is it a problem if I turn this issue in a GH discussion? It seems to me better suited for that kind of tools. |
No, of course not. Feel free. |
Nvm. Apparently, the convert button disappeared in the meantime. 🤷♂️
Let's discuss this here until we can convert the issue to a discussion again. |
Yes. Maybe we also need a way to re-organize such a pool. Assuming the pool lives for a long time, with lots of references added / removed, fragmentation may occur and degrade performance. Alternatively we could just create a new pool and re-add everything that is still alive. Either way, such re-organization would be triggered by the user during a maintenance phase, invalidating all references. |
Assuming that the pool is paged and therefore additions aren't a problem, deletions can leave holes here and there and you can invoke a method to fill them at the end of a tick. |
I'm working on some changes that should make it possible to have stable references. The idea is to use some unused bits in the pool and introduce a sort of component version. EnTT won't update it out-of-the-box because there are many uses for that. However, it can be used to to track reference invalidation and therefore to address this issue. |
Short update. There will be probably two tools that solve slightly different problems. |
Update: |
I've still to write the documentation but branch |
Great to hear. I'll update my scene graph example once it's in master. |
Landed on |
Looks good. I've just updated my scene graph example. https://github.com/W4RH4WK/EnTT-SceneGraph/blob/master/entt_scene.cpp#L155-L176 |
Great. Does it work as expected? Pagination and tombstones should make components fully stable. |
I haven't done thorough testing, but it looks good so far. Thanks. I'll let you know if anything comes up. |
Some time ago we discussed the feature of having stable memory locations for certain components on Gitter. The discussion sprung from the idea of combining a scene graph with entt. In my proof-of-concept implementation I used
std::unique_ptr
to guarantee correct memory access. However, this creates another indirection which could be avoided by having entt not relocate certain components.https://github.com/W4RH4WK/EnTT-SceneGraph/blob/46b9acb85422c8ca2d4d59e0b65985ea4b798a72/entt_scene.cpp#L154
Since I could not find an issue / discussion related to it, I decided to open this one to keep track of it.
The text was updated successfully, but these errors were encountered: