itch.io is community of indie game creators and players

Devlogs

Devlog: Hero Classes and Special Abilities - Ivan Shyika

Return to Divinity
A downloadable game for Windows

Hi! Ivan is here, our Team Leader, Project Manager, and Senior Developer.

In this devlog, I want to describe how I designed the Hero class and ability system for our game, creating clarity and gaining flexibility through taking advantage of modularity and clear separation of concerns.

Technical Design

Let's look at what the various components of this system are, how they are organized, and why such a setup is beneficial to us.

Architecture

Benefits of the architecture

  1. Having Abilities as independent objects allows great flexibility as an ability is not tied to a specific Hero Class. Should we want to modify Heroes' abilities, all we need to do is change the ability that the hero references (rather than write an entirely new HeroClass that differs only in the implementation of a special ability). Better yet, it can be done even in the middle of the game, say, if you want to buy a new ability from a Trader.
  2. Having a system that handles ability casting as an independent component gives us several benefits:
    1. Separation of concerns and clear code: the Hero does not "worry" about all the logistics of casting an ability; they merely request ability activation, and whether the request can be fulfilled is determined by the component;
    2. Reusability: AbilityComponent is a component that can, by definition, be attached to any other actor. It gives us the option of granting enemies their own special abilities should we choose to do so later in the development cycle. In that case, the only question we would need to solve is how the AI decides it is a good time to activate the ability. Simply put, if we want to grant special abilities to more than only Heroes, we won't have to worry about the logistics behind ability casting, only about the AI determining when to cast it.

Function

Now, with the architecture set up and the function of each part clarified, using the system becomes straightforward. Let's look at two examples: inheriting Hero Class information, and casting an ability. 

Hero inheriting Hero Class stats

Casting an ability

Now, what happens when a Hero receives a command to cast their special ability?


Conclusion

We can now conveniently describe an entire squad with only the Hero Classes that comprise it, and we have a modular ability system that makes it easy to reuse and expand the feature of special abilities. Enjoy a short demo video below!

Thank you for your attention.

Best,
Ivan Shyika
Team Leader, Project Manager, and Senior Developer of Good Faith Team

Download Return to Divinity
Leave a comment