Design Patterns: Abstract Factory
The Abstract Factory pattern is defined as "A pattern which provides an interface for creating families of related or dependant objects without specifying their concrete classes." This is a pattern I'm currently making use of in one of the games I'm developing, Galactica 2180 , which is based on the old Battlestar Galactica TV show from the 1970's. Part of the game involves creating spaceships for each of the different factions in the game. It is in this regard that I'm making use of the Abstract Factory pattern. The game makes use of several engine objects to handle game dynamics: combat, diplomacy, production, etc. The production engine is responsible for queueing object requests by the different factions, such as spaceships, ground vehicles, and so on. But because each faction has their own types of these objects, a generic approach was needed. In this example, we will focus strictly on spaceship creation. For starters, I created an interface to be