SparseSet is a data structure only used with the Entity Component system. Quick synopsis: the ECS acts as a central store for all the objects for the engine. Entities are just integers that act as weak references. The SparseSet is the structure for holding all that data contiguously. It is totally implemented like garbage and I am ashamed of it. Instead of acting like a nice, cohesive data structure, it is implemented across four different classes (Core/Structures/... and Composition/Entity/SparseEntitySet/...). The ECS system makes use of special indexing that makes it hard to have a single data structure and then use that special indexing. I decided to do the worst possible thing at the time and inherit from the structure, requiring the Abstract variants of the class to maximally reuse code. The final resting place should be in Core/Structures/..., you should be proud of it, and it shouldn't be anything like the eyesore I made.
[x] Rename to something that makes sense. Its not a set, its a map because it has keys IntrusiveSparseMap.
[x] One class to rule them all SparseMap.h/.cpp
[x] Entity specific indexing and functionality. Insert design choice here.
[x] ECS still works as intended. Inside the ECS system, modify the use of the IntrusiveSparseMap class as needed.
SparseSet is a data structure only used with the Entity Component system. Quick synopsis: the ECS acts as a central store for all the objects for the engine. Entities are just integers that act as weak references. The SparseSet is the structure for holding all that data contiguously. It is totally implemented like garbage and I am ashamed of it. Instead of acting like a nice, cohesive data structure, it is implemented across four different classes (
Core/Structures/...
andComposition/Entity/SparseEntitySet/...
). The ECS system makes use of special indexing that makes it hard to have a single data structure and then use that special indexing. I decided to do the worst possible thing at the time and inherit from the structure, requiring theAbstract
variants of the class to maximally reuse code. The final resting place should be inCore/Structures/...
, you should be proud of it, and it shouldn't be anything like the eyesore I made.IntrusiveSparseMap
.SparseMap.h/.cpp
IntrusiveSparseMap
class as needed.