richardbiely / gaia-ecs

A simple and powerful entity component system (ECS) written in C++17
MIT License
80 stars 3 forks source link

Cleanup chunk clean system #16

Open richardbiely opened 1 year ago

richardbiely commented 1 year ago

When the last entity on chunk is deleted, its lifetime countdown starts. Once the counter reaches zero (currently deduced by one every world::update()) the chunk is added to the removal list. This list is updated from the Chunk class while the world manages the state. However, all state data is stored in the Chunk (ChunkHeader) that doesn't even need to know.

This might need a cleanup. Lifetime data should probably move to where the lifetime is managed and the way the list is updated should probably also be changed form a hard-coded list to some sort of observer the world can register to.

On the other hand, chunk storage is basically for free because all the information is encoded within the header and is very small.

Nevertheless, evaluate.