What Entity Component Systems Can Teach Us About Ego, Identity, and Emptiness
This article is written with the aid of the free version of Google Gemini AI 3.1 Flash-Lite standard mode
If you’ve developed games, you’ll probably know what ECS(Entity Component System) is, so I’m not going to elaborate its details. Instead, I’ll just use the following oversimplified pseudo-codes that trades optimizations for simplicity:
EntityManager { const createdEntity = components => { const entity = _createdEntity(); ComponentManager.attachAll(components, entity); return entity; }, destroy = entity => { ComponentManager.detachAll(entity); // Can become splice with the index found by binary search this._entities.= this._entities.filter(e => e !== entity); // // this._deletedEntities is ascendingly sorted so it’s impossible to already have entity this._deletedEntities.push(entity); this._deletedEntities.sort((a, b) => a - b); // This can be optimized into splice with the index found by binary search }, _createdEntity = () => { const deletedEntity_ = this._deletedEntities.shift(); // Reuses the deleted UUID to prevent any UUID being too large...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE