The prop-config files

Our aim is to put as much as possible game parameters in config files. These prop-files will tell the Evolution application which gameobjects the game will use and which rules are to be applied.

Because we didn't want to write too much engine code to parse and interprete the prop-files, we opted to provide a way of dynamically loading class files where the prop-files were not flexibile enough.

In code this resulted in XxxxKnowledgeCatalog's and SimpleXxxx classes.

For example we use an ActionKnowledgeCatalog which parses the actions prop-file and so knows which types of actions will be used in the game and how they behave. When a certain type of action has to be created, the ActionKnowledgeCatalog's factory method public Action instantiate(String actionName) will provide a software object to represent the action. Now there are two cases: if the action can be completely specified in the prop-file then we use a SimpleAction object, if the prop-file did not allow to define the behavior of the action completely, a class file will be loaded which implements certain template methods to add the extra behaviour.

The game engine will decide to use a SimpleXxxx class when it can not find a dynamic loadable class.

To parse and interprete the prop-files we will be working with KnowledgeCatalog's. We have several of them:

The files

The filenames used are just defaults. By the creation of a new World the main configuration file must be passed as an argument to the constructor. In the main file the names of the other files are listed.

An example of extending the game

Suppose we want to add magic food fields to the game, these fields only appear on BabyForest and contain MagicFood. A human can transform this MagicFood into the world resource Food by the action CastingSpells.

So we need to add the action CastingSpells. This is done by editing actions.prop as follows:

Actions = ... CastingSpells

CastingSpells.usesResources = Food(2)
CastingSpells.usesLandResources = MagicFood(10)
CastingSpells.producesResources = Food(20)
CastingSpells.lands = BabyForest
CastingSpells.influencedBy = Happiness
    

Next we need to add the landresource MagicFood and make sure BabyForest will contain MagicFood. We make it so that BabyForest only has 50% probability of containing MagicFood and that there will be a random amount between 0 and 125. This is done by editing lands.prop:

LandResources = ... MagicFood
LandResources.MagicFood.probability = 0.5

BabyForest.contains = MagicFood
BabyForest.MagicFood.min = 0
BabyForest.Magicfood.max = 125
    

The only thing left now is to make some images:

If the action has to be shown in the icon bar of the gui and if you want an icon next to the menu item CastingSpells then you have to make 2 extra gui icons, but these are optional.

Because these extensions can be completely defined in the prop-files, no code has to be written.