Closed ayebear closed 9 years ago
Update: Removing the extra layer of indirection will cause the component handles to need to be updated. They currently work by storing their component ID, which has the potential to change with this method. It may just be easier to improve PackedArray and keep the extra layer of indirection.
I'll keep this open until a better solution is found, or if the PackedArray improvements (#3) are good enough.
The current implementation of PackedArray ensures each new element created has a unique ID. This has the benefit of keeping around handles (like Entity instances) for long periods of time, and once the ID has become invalidated, it will never become valid again. This is very important for storing entities, and the performance is good enough for entities.
However, the component IDs themselves stored in component sets inside of entities don't benefit from unique IDs. These are only used internally, never by the user, so there is no chance of old IDs hanging around. So, this could benefit from a faster PackedArray implementation. Or, even better: