Skip to content

Configuration Templates

Claudio Bonesana edited this page Apr 14, 2021 · 1 revision

Each configuration file is a template for a component of the game. In addition, a configuration file can be a template itself for another configuration file.

Let's make this a little more clear with some practical examples.

Generic Templates

In the figure folder we have the generic configuration file figure.template.yaml. This is generic for two reasons: it does not define a template for a figure, but it defines a generic template for all figures. This means that all the figures defined in the figure folder will have the same values defined in the figure.template.yaml file, unless they will overwrite them.

This happens where there is a file that defines a template type, like in te folders figures/figure.template.yaml and weapons/weapons.template.yaml. If there is not such definition, then only the copy templates will happen.

Copy Templates

A copy template is just a reference to another existing template. The mechanism will copy everything from another configuration file before apply the modifications.

This is easy to understand by looking in the maps folder. The configuration file GameBoard.yaml defines the board of the tabletop game. This board is the same in all scenarios from the tabletop game. The only differences between are the position of the mobile obstacles. It is then used as a template for the other maps.

To do so in the GameBoardJunction.yaml we use the tag template to specify that the configuration need to be applied above the board defined in the other files.

Consider that this mechanism is active on all folders.

Remarks

The template mechanism is not to be confused with the basics configuration files that are present in the status and terrains folders. These are just collections of components required by the game.

This mechanism is totally not mandatory. It is completely valid to copy-and-paste the same content from another configuration file and this has no impact on the performance of the game since the configuration files are all read once at the beginning of the execution.

Clone this wiki locally