Friday 21 June 2013

To automate or not to automate

This post will be about a very simple thing to implement, but which can save a lot of time - data automation.
   
    The biggest hurdle to a game like Last of the Warlock Kings is the sheer amount of 'stuff' you need to put into the game.  When you combine this with the data driven approach (a necessity when you want to make the game very mod friendly) you quickly find yourself making a ton of data files, all of which share a lot of the same content.

    The first and most obvious approach to cutting down my workload is 'boiler plating'.  The term boiler plate refers to a default template data file, which serves as the starting point for all data files of that type.  For example, each character in the game has a data file that defines a lot of aspects from how they interact with the world, to the types of equipment they start with.  By making a template file that contains the default values for all the possible values for character files, I save a lot of typing.  Even better, I have all the possible values in the file form the start, so I'm less likely to forget any components.
   
    The second and biggest time saving method is in-game automation of data generation.  This is all about spotting areas of the game where certain aspects are repeated a lot and can be automated.
   
    As an example, the spells in LOTWK are powered by spell stone items that the characters must keep in their inventory to be able to use individual spells.  This means each spell not only needs a data file about the spell itself, but also data files about the spell stones items - a different one for each spell.  This is inefficient because the spell stone items only have a couple of variables that different between spells:  the name of the spell and the icon used for the inventory screens.
   
    This is a prime candidate for automation, which is just what I did.  Instead of making item info files for spell stones, I made a boiler-plate file, which the game reads then modifies the two variables based on information in the spell data file.  It then creates the spell stone item data in the game automatically without the need to load external files.  This means that whenever I make a new spell, I only have to make one data file - the spell data.  The spell stone item is automatically generated whenever the game runs.  It took me all of ten minutes to code up the automation, and will save me hours of tedious data file creation.
   
    This same automation has been applied in several other places, and will save me countless hours of work, allowing me to focus on the interesting stuff, and of course on making the game the best it can be.

No comments:

Post a Comment