Search code examples
xnadrawablegamecomponent

XNA Components: should all game entities extend GameComponent or DrawableGameComponent?


I'm a newbie trying to build a primitive component based engine for a simple 2D game and I'm wondering if everything from a "human" to a "crate" should extend one of the two. I can see advantages to having the Update and Draw called, but it seems like a lot of extra baggage for every single entity to carry around. Any thoughts would be appreciated.

On a different note, I can also see that a manager-type class, such as a particle engine should certainly extend DrawableGameComponent.


Solution

  • Personally, I don't use either of the game component classes. Game engines are highly specialised and you can't possibly have a single component-based design that will work for them all.

    How difficult would it be to write your own base class that has Update & Draw methods? Not very... there's really nothing magic about XNA GameComponents. If they fit your purpose, fine, if they don't, it's really not the end of the world!