Creating Abilities


The Problem: Abilities are abstract ideas

This past week was probably the most challenging week of development. I spent it working on creating and implementing our game's ability system. This was challenging because abilities are abstract and you can't really make a lot of assumptions about them. So the challenge was figuring out a way for an ability to communicate its information to where it is needed. We wanted our abilities tied to weapons and I didn't want abilities to directly communicate with weapons, the player, or the attributes, so to figure out a system that allows for these restraints I needed to break down abilities to their most simple functionality.


The Solution: Cause and Effect

My thought process went something like this:

What is an Ability? An action that causes an Effect.

What is an Effect? They change the attributes of what they are applied to.

What is an Attribute? It is a piece of information that describes a property or characteristic of something.

A simple example of an Ability could be an attack. The attack causes an Effect which in this case is damage. That damage is then applied to the Health Attribute of something. Once I figured this out, coming up with how it all works together wasn't too difficult.

So, I created an abstract base class for the ability. The most important part of the ability is the Effect, which is a struct that has an array of Modifiers. A Modifier is also a struct that just has an enum value to determine which Attribute it modifies and a modifier value that is a percentage of how much the attribute will be modified. I didn't want an Ability's Effect to be limited to modifying a single attribute so that is why I added an array of modifiers to it. To communicate the information of the ability and its effect I used interfaces so that I can communicate with the player and anywhere else I need to without

This clip demonstrates a Lifesteal ability that allows the player to heal themselves by 35% of the damage that they apply to the enemy:

Get Lucifer's Hordes

Leave a comment

Log in with itch.io to leave a comment.