Setting Up Units
In this tutorial we will be teaching you how to set up a new unit within the Unreal Editor of our project using our Entity Component system. This system reduces repetition and avoids hardcoded values, all for ease of use in designing and testing.
Relevant classes
The system is divided into blocks:
1. Entity: Describes a unit, building or any other game object. It defines what it is, how it looks, how much health it has, but not what it can do.
- Relevant subclass for this tutorial - RTSUnitConfig
2. Ability: Abilities that could be utilized via the in-game bottom right Palantir menu for buildings or units and clicked by the player. Describes what logic entity can do. We utilize the GAS system for this, so refer to the UE GAS documentation for further details.
3. Weapon: Describes what an entity can do in simple attacks. A unit can have many weapons, so you can create separate weapons assets and use them in different Entity Configs.
- Responsible data class - RTSWeapon.
4. OnHit: Most weapons use common logic for attacks, so they don't need an extra logic module. But some weapons may have additional effects like poison or setting the enemy on fire. Like with abilities, we have two classes:
- Responsible data class - RTSOnHitConfig.
- Responsible logic class - RTSOnHit.
The OnHit module is like a warhead that could be attached to any weapon, and it will do some logic whenever a unit attacks.
From all classes listed above, you may make a custom inherited data asset if it is a data class or blueprint if it is a logic class. Using all those blocks, you can create a fully customizable game unit.