SyncEntityPool Proposal #13576
Labels
A-ECS
Entities, components, systems, and events
A-Tasks
Tools for parallel and async work
C-Feature
A new feature, making something new possible
X-Controversial
There is active debate or serious implications around merging this PR
What problem does this solve or what need does it fill?
I use worlds as scratch-space in my async tasks. This is a powerful pattern that gives you the flexibility of the ecs, while working on a single chunk of work with exclusive world access.
I take snapshots of the world occasionally. After finishing all my work in my async task I merge the scratch-world back into the main world via
I need to reserve entities ahead of time in the main_world (and in the scratch world) so the address spaces match. This isn't an issue when you can figure out how many entities you need ahead of time
Because I'm using the world as scratch-space there is a certain number of entities I can't account for ahead of time. If I write a scene to my main world there is a chance I will override an unrelated entity that is being used for something else.
What solution would you like?
I should be able to reserve a pool of entities. This pool of entities can give out EntityHandle's that allow you to temporarily borrow the entity and store some information on the world. When you drop the handle - the entity is reclaimed by the pool.
For simplicity sake it's fine for my use case if the pool isn't grow-able.
Sample API Attempt
What alternative(s) have you considered?
This seems kind of similar to the
AsyncEntityPool
that @cart showed off a little while back for assets as entities. This is slightly different since the goal is to make something that makes it easier to work with exclusive world access and synchronize address spaces across worlds when you don't know how many entities you will need ahead of time.Additional context
The text was updated successfully, but these errors were encountered: