Getting Started with Component Architecture: DI?

Posted by ashes999 on Game Development See other posts from Game Development or by ashes999
Published on 2012-10-01T10:23:39Z Indexed on 2012/10/01 15:54 UTC
Read the original article Hit count: 205

Filed under:

I just moved away from MVC towards something more component-architecture-like. I have no concept of messages yet (it's rough prototype code), objects just get internal properties and values of other classes for now.

That issue aside, it seems like this is turning into an aspect-oriented-programming challenge. I've noticed that all entities with, for example, a position component will have similar properties (get/set X/Y/Z, rotation, velocity).

Is it a common practice, and/or good idea, to push these behind an interface and use dependency injection to inject a generic class (eg. PositionComponent) which already has all the boiler-plate code?

(I'm sure the answer will affect the model I use for message/passing)

© Game Development or respective owner

Related posts about component-based