component Initialization in component-based game architectures

Posted by liortal on Game Development See other posts from Game Development or by liortal
Published on 2012-11-20T20:09:09Z Indexed on 2012/11/21 5:23 UTC
Read the original article Hit count: 480

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

© Game Development or respective owner

Related posts about XNA

Related posts about component-based