• Register
Post news RSS Devpost - Advanced Skills

Read through a short work in progress update on how we are going about creating the advanced skills using scripting in our engine!

Posted by on

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.

  1. Select a unit
  2. Use the dash ability on the unit
  3. Now we have a temporary ability that needs to be able to do pathfinding and wait for user input
  4. Depending on if we picked a valid path and had enough points to use the dash we continue, if not we just remove the attachment
  5. Use the custom movement skill that the dash attachment supplied
  6. Wait until it finished
  7. Signal completion and remove the attachment

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!

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.