It has occurred to me that individual parts of a Ship (i.e. guns, sensor packs, thrusters) should be their own entities. In that case, I would have to specify some sort of ownership, which leads me to two questions: 1) are entities (referenced by global identifier) valid data to store in a component, and 2) can one entity have more than one of the same type of component?
For example, assuming the answer to my first question is yes, Entity 1, which represents Ship A, has two Gun components, Gun A and Gun B. Gun A stores a reference to Entity 2, which represents the actual gun in the game, and Gun B stores a reference to Entity 3, which represents the other actual gun in the game. Is this a valid setup, and if not, how would this situation be properly implemented?
More generally, what type of data can Components store? can it be OOP data like an ArrayList? If so, the data would have functionality but the Component itself wouldn't. Or is data limited to immutable types? limited to 'numbers'?
|