Search code examples
game-enginestrategy-pattern

Component Model vs Strategy Pattern in Game Design


What is the difference between Component Pattern and the Strategy Pattern in reference to Game Design?


Solution

  • You are comparing apples and oranges here - actually it might be more correct to say you are comparing an engine and petrol here.

    The Component pattern is essentially just saying you should componentise complex systems (in game design you might have the physics, graphics, sound components etc - ie they are all sub-systems.

    Strategy is a way of plugging in different implementations, at run time.

    So - rather than saying the difference between them it might make more sense to say that the strategy pattern could be used to load the appropriate components at run time - stretching it a bit here but maybe you want to switch to a different rendering algorithm when you hit the water for example.