After reading a lot about entity/component based engines. I feel like there is no real definition for this kind of engine. Reading this thread: Implementing features in an Entity System and the linked article made me think a lot.
I did not feel that comfortable using System concept so I'll write something else, inspired by this pattern. I'd like to know if you think it's a good way to organize game code and what improvements can be made.
Regarding a more strict implementation of entity/component based engine, is my solution viable? Do I risk getting stuck at any point due to the lack of flexibility of this implementation (or anything else)?
My engine, as for entity/component patterns has entities and components, no systems since the game logic is handled by components. Also, I think the main difference is the fact that my engine will use inherence and OOP concepts in general, I mean, I don't try to minimize them.
- Entity: an entity is an abstract class. It holds his position, width and height, scale and a list of linked components. The current implementation can be found here (java). Every frame, the entity will be updated (i.e all the components linked to this entity will be updated), and rendered, if a render component is specified.
- Component: like for entity, a component is an abstract class that must be extended to create new components. The behavior of an entity is created through his components collection. The component implementation can be found here. Components are updated when the owning entity is updated or for only one specific component (render component), rendered. Here is an example of a logic component (i.e not a renderable component, a component that's updated each frame) in charge of listening for keyboard events and a render component in charge of display a plain sprite (i.e not animated).