Keep in mind, if we did go this way it would be MASSIVELY invasive to the existing system, and not something I’d want to tackle any time soon even if it did look like a good idea. This would be tantamount to a total redesign and reimplementation of all affected code, though it could proceed incrementally.
This is a great example, just briefly it might look like this:
Creatures, terrain, furniture, and vehicle segments would all have coordinate components, which means they would have entries in a coordinate tracking container that has a reference to the entity.
To retrieve the entities at some coordinate, you’d retrieve components from the grid, which would probably be a 3d array of lists of entity ids, now you have a list of entity id’s to operate on. You’d then iterate over that list, retrieving some other component of each entity to evaluate, for example if you’re evaluating a projectile moving through the square, you’d retrieve the “ballistics” component of each entity to evaluate whether the projectile hit that entity, if one results in a hit, you’d retrieve other components if that entity to apply the effects of the projectile impact, up to and including destroying the entity.
Likewise when drawing, the renderer would retrieve IDs at some coordinates, then use that to retrieve “sprite” components, which would contain both glyphs or sprites to render as well as metadata like render order.
In both cases, the code didn’t care whether the data it was handling was from a furniture, item, creature, or vehicle entity, just that it had the components it cared about.
These examples make me think you’re thinking of composition, faceting, and related OOP concepts. ECS is not OOP. It took me a while (days of reading) to figure out what this meant. It does have some of the features of building objects out of components, but it goes much further than that.
Surprising aspects of ECS:
There is no entity object.
Components do not own code.
Systems are not OOP either, they’re just code.
Components mostly live in arrays or lists, and actually live there, not references to them.