Factory

Introduction

The term “Factories” comes from the factory design pattern. Factories are objects which can create new instances of certain types of Entities. Factories have two main benefits:

  1. They can be automatically associated with a PositionedObjectList so when you instantiate an object you don’t have to manually add it to a PositionedObjectList.
  2. They can pool Entities which can greatly reduce allocated memory for Entities which are created and destroyed frequently.