Zay-ES and ES in general: identical components, subcomponents?

I am contemplating on a matter of having multiple instances of a thing on a game entity and how to implement it withing an ES. For example, imagine a space game where you can build your own ship design, like you can put a number of engines on the ship. It can be 1 or 100 similar or different engines, with their models and thrust emitters positioned differently, each one affecting the ship in its own way and so on. What would be the most idiomatic way within an ES to approach such a problem?

I assume that we cannot have more than one instance of a component on an enitity, so, in this case, all engines have to be represented via a single component? If so, then it seems that the inner structure of such components can get rather complex, does not that somewhat contradict the idea of ES that components are simple and systems do all the work?

You can have virtually infinite number of component instances, that’s for sure, I have checked it.

But then how do you distinguish between them when you get them from an entity? And isn’t that again against the ES paradigm?

First of all, it depends on how big the differences between your engines are. If they’re just in parameters (like thrust level) - you just set those in your one single type of component. And then your system process them.

I would say for each Engine create a new Entity with a component:

 EntityId parent;
1 Like

For 100 different types of engines (if they’re all completely different, not just in their parameters like position or thrust) you will need 100 logical descriptions of their influence anyway, using ES or not.

… in the distance, a wild pspeed starts to stir …


In your description, engines aren’t components, they are entities. Those entities may be attached to the ship, the might be in inventory, or they might be rolling around in space on their own… but they are definitely not components.

Think if it kind of like entities are nouns and components are adjectives. If you are describing something (hitpoints, damage, name, power, etc.) then those are components. But actual things are entities.