Creating advanced skills using scripting
When scripting in something like lua compared to programming in c++ it becomes really important to reuse a lot of your code and keep the complexity low, with this in mind and the fact that building units with different parts usually gets quite complicated. We solved this by creating a single system that would allow units to be made out of parts but also gain everything else from the parts and not just graphically.
The core idea of the units that you control is that they consists of different parts (attachments) and these parts also give the unit it’s skills.
Using this base system we can actually create all kinds of different gameplay elements like the one below.
Here we have added a completely new skill to the unit by adding a hidden attachment that has the Dash functionality, then when the skill has been used or deselected we just remove the attachment and we do not have access to the skill anymore.
So by using our base attachment system we created a temporary skill system without creating too much additional code, which becomes really important when scripting..
This is the scenario for using dash and this is also why it becomes a bit more advanced than a normal move or attack skill.
Doing this without some kind of backend system becomes really tricky Below you can see the dash in action, it will also damage the unit at the end of the charge. Using the same principle described above we can also create things like stances by adding an attachment that starts the stance when attached and then when removed it also removes the stance. Something like a heal/repair skill can also be created by having an attachment that heals during the time it is attached and then when destroyed you get no more life. Another benefit of all this is that the attachment also can support it’s own particles and any extra rendering needed for a skill, for example the blue rings behind the dashing unit above are controlled by the dash attachment object. Thanks for reading though and dont forget to follow us here on IndieDB if you want the latest blogposts!