Open DeirhX opened 3 years ago
(unless there is a contract to always run it on a single thread, it would seem advantageous to me to wrap all manipulation with free_entityids inside a real lock to allow one to obtain a new entity id at any time. But again, maybe none of that is actually needed)
I see incremental_locks taken upon entity enumeration and they are checked by assert on create and destroy_entity in order to detect accidental attempts to modify the entity collection while enumerating. Would you consider real support of parallel entity creation from multiple threads or is it an anti-pattern that can be easily worked around using existing tools?
One can surely easily just store the entity data intended for creation and pass it to the thread responsible for entity spawning but is it just as easy if you intend to create a parent and a child entity (with their components linked, e.g. local transform and parent's world transform) without having the option of knowing the id of parent entity since you didn't wait for its creation?
Feel free to correct my possibly insufficient grasp of ECS if there is a better way to do it. I would use temporary ids here and relink after creation but figure there can be a better way :)