Prevent instantiation of base class with no pure virtual methods

Started by
19 comments, last by Quasimojo 10 years, 10 months ago


In my component system I also used to have entityId and typeId. However, after some refactoring I did, I realized I didn't need them at all anymore! Any code that is operating on a Component already knows what type it is (or doesn't care), and knows which entity it came from. So I ended up removing them (saving 8 bytes per component). This will really depend on your particular implementation though (I see more reason for requiring entityId than typeId).

I think I see how that would work. You wouldn't typically need to traverse all components of a given type by type id, when you could accomplish the same through the component's respective system.

With regard to serializing the entity, my first thought would be that all relevant systems would need to be queried for the given entity. Is there a more efficient way to go about it?

This topic is closed to new replies.

Advertisement