component Initialization in component-based game architectures
- by liortal
I'm develping a 2d game (in XNA) and i've gone slightly towards a component-based approach, where i have a main game object (container) that holds different components.
When implementing the needed functionality as components, i'm now faced with an issue -- who should initialize components?
Are components usually passed in initialized into an entity, or some other entity initialized them?
In my current design, i have an issue where the component, when created, requires knowledge regarding an attached entity, however these 2 events may not happen at the same time (component construction, attaching to a game entity).
I am looking for a standard approach or examples of implementations that work, that overcome this issue or present a clear way to resolve it