benreid24 / BLIB

Small organized collection of common code I have accumulated over the years that has amassed into a proper 2d game engine
1 stars 0 forks source link

Make ECS component pools dynamically sized #157

Closed benreid24 closed 1 year ago

benreid24 commented 1 year ago

Allow the pool vector to expand. Will have to replace/refactor IdAllocator for index generation. Will need new event type to update views when pools are resized. Create new PersistantHandle and PersistantHandleSet classes to allow for long-term handles to be safely held.

One consideration: How to make resizing threadsafe? It's possible a thread with a pointer to a component could have that pointer invalidated by another thread triggering a resize. Possible solution: Only allow interaction through locked visitor methods. Would probably want to add methods to cover single entities as well, in addition to the methods for iterating over entire pools/views.