mercredi 16 août 2017

Spring Framework - Design pattern to create a rules engine for game

I have listed a crude example of a problem I am facing below. I am looking for a design pattern or a way to use spring framework that will allow me to have a set of rules or instructions based on game difficulty level. I would have them in a spring configuration and use profiles but the problem is that they need to be defined at runtime. Any help is appreciated.

The problem becomes that I just keep passing this context object below:

public class Game {


private MapMaker mapmaker;

@Autowired
public(MapMaker mapmaker){
   this.mapmaker = mapmaker;
}

public void createGame(DifficulyLevel level){

        Boss myBoss = getBoss(difficultyLevel);   

        BossWeapon = getBossWeapon(difficultyLevel);

        MapInstructions mapInstructions = getMapConstructionInstructions(diffcultyLevel); 

        mapmaker.makemap(mapInstructions);

}

}

Aucun commentaire:

Enregistrer un commentaire