When should one use Game Components? What are they used for, what is the design pattern around them?
Which is better:
-
Having a background component, a player component, a spaceship component and various instances of an enemy component, each one responsible for updating and drawing itself;
-
Having all of the above inside the gameplay screen class, which manages everything.
Speaking of gameplay screen, the game state management example didn’t seem very modular. Is it better to structure things like in the example, where we program entire screens at once instead of reusable bits and pieces, or to use game components to achieve maximum modularity?
From MSDN:
Talking of the example, it is good practice to seperate your components into seperate classes. This will make it a lot easier to manage as your project gets bigger.
Here is another link with more information about the GameComponent and how/when to use them.