|
|
|
|
|
by geneotech
1094 days ago
|
|
Thank you! The approach you describe is indeed the "final form" of a brutally data-oriented ECS, but my method is a bit simpler - e.g. if the game has: struct player {
components::transform transform;
components::health health;
}; struct box {
components::transform transform;
components::physics physics;
}; Then my ECS simply holds a std::vector<player> and a std::vector<box> rather than having a vector per each type of component. I also use the integer identifiers like you describe but with a twist - there is one more indirection involved so that deleting from the vectors does not invalidate existing indices pointing to vector elements. It's still exactly O(1). See the section on the Memory pool in the game repo's README. |
|