Gameplay Ability System in Unreal Engine

Jul 10, 2024

Lecture Notes: Gameplay Ability System in Unreal Engine

Introduction

  • Gameplay Ability System: System for efficiently creating gameplay abilities, primarily using Blueprints

Initial Setup

  • Enable Plugins:
    • Go to Plugins > Enable Gameplay Abilities
    • Ensure Gameplay Tags are enabled (default setting)
    • Restart Unreal Editor after enabling settings
  • C++ Requirement:
    • Some setups and complex calculations require C++
    • The system is primarily designed for use with Blueprints
  • Project Setup:
    • If the project is Blueprint-only, create a new C++ class via Tools
    • Consider reviewing C++ basics (recommendation: first 4-5 videos from C++ Basics course)

Setting Up the Ability System

Creating the C++ Component

  • Setup Environment: Open project in Visual Studio/ Visual Studio Code
  • Navigating the Source Directory: Locate the project.build.cs script
  • Modifying Dependency Modules:
    • Public and Private Dependency Modules
    • Add dependencies: GameplayAbilities, GameplayTags, GameplayTasks
    • Enable Live Coding or rebuild the project

Adding Ability System Component

Modifying Character Class (Header File)

  • Include Headers:
    • AbilitySystemComponent.h
    • AbilitySystemInterface.h
  • Add to Protected Section:
    • Define property UAbilitySystemComponent* AbilitySystemComponent;
    • Use UProperty macro to set attributes