sproingie,
Thanks for the feedback. I think the managers fit a nice role in that it frees classes from having to meddle too much with certain types of objects… provides a simple interface. In my current game I created a manager for all the major classes (TurretManager, RoundManager, ProjectileManager, ImageManager, ScreenManager). Their roles are specific to the objects they are managing. In some cases acting as a pure factory or builder, facade, dependency injection, data model, or just being a static holder of the active object (TurretManager has a reference to the active Turret). What I like about this is that I do not have to decide if I need a facade here, or builder there, then have builders and factories, and context classes. But I like to get feedback and hear criticism.
Here are the public methods to the most involved manager, ProjectileManager… used primarily by, but not limited to, the Turret classes who has to use Projectiles extensively.
ProjectileManager:
//singleton
public static ProjectileManager getInstance()
//factory method to retrieve projectiles from a specific ProjectileType
public List<Projectile> getProjectiles(ProjectileType pt)
//The turret does not decide which ProjectileTypes are chosen, so he gets them from this manager
public ProjectileType[] getActiveProjectileTypes() {
//When a round starts the projectiles need to be notified and also need to be upgraded to last saved state under certain circumstance
public void startRound(ProjectileType[] projectileTypes, boolean retrieveProjectileState) {
//At the end of a round, if the user wins, the projectiles need to have their upgrades saved to the user's profile
public void saveUpgradesToProfile(ProjectileType[] projectileTypes) {
//A projectile registers all their upgradable abilities to this manager because they need to be fetched later on
public UpgradableAbility registerUpgradableAbility(Class pClass, UpgradableAbility ability) {
//fetches all registered upgradable abilities, used mainly by the upgrade screen where a user can upgrade their projectiles
public List<UpgradableAbility> getUpgradableAbilities(Class pClass) {
In this case I would say ProjectileManager is a facade (startRound), factory (getProjectiles), data model (registerUpgradableAbilities). Dividing this work up into various other classes was causing the code smell. For example, The UpgradeScreen needs to know about all the registered upgradable abilities. Passing this information from the Projectiles all the way to one of the Screens would be messy without some static source where to retrieve them from.
thanks
jose