-
-
Notifications
You must be signed in to change notification settings - Fork 148
Implement World.Copy #292
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
Implement World.Copy #292
Conversation
ba0549c to
66ef719
Compare
|
Thanks! And whats the difference to: |
It seems that PR is intended to duplicate certain entities within the same world, resulting in additional entities. This PR, on the other hand, aims to create a copy of the entire world, resulting in the same world without extra entities. Do you also want me to add a benchmark, like the other PR includes? |
66ef719 to
1378f54
Compare
|
Thanks to the tests I found out Copy was destructive for the source Archetype. Given this is supposed to happen and Copy usages are widespread, I opted for adding an optional parameter to indicate when we don't want to do that, so the world Copy is not destructive for the source. |
|
Ran some small benchmarks, skipping empty archetypes is a significant improvement it seems. This was done for 5 archetypes, when one of them is empty. If you see value on this, I could make them part of the PR. |
It's not wrapped in preprocessor directives because it's only called manually, so it shouldn't affect performance for projects not using it.
The intention of this is making a deep copy, that contains no references to the original in any way. If it could be done faster or there is some state still being referenced instead of copied that I'm missing, I'm accepting feedback.