【UE】GAS 概述

Gameplay Ability System,游戏能力系统,简称 GAS。

GAS 包含以下部分

Ability System Component, Gameplay Ability, Gameplay Effect, Gameplay AttributeSet, Gameplay Cue, Gameplay Tag, Ability Task。

其中 tag, event, task 是 ue 自带的,与 GAS 其他部分深度集成。

在 GAS 当中,Gameplay Ability,简称 GA。项目注释:

Abilities define custom gameplay logic that can be activated by players or external game logic

能力定义的是 可以被玩家/外部游戏逻辑 激活的 游戏逻辑。

所以 GA 本身是指一段逻辑,而非效果 Gameplay Effect。

常见的,玩家可以释放技能造成伤害。玩家激活技能逻辑,该逻辑会调用相关的 Gameplay Effect。

而 Gameplay Effect,简称 GE, 在 GAS 中定义如下:

The GameplayEffect definition. This is the data asset defined in the editor that drives everything. This is only blueprintable to allow for templating gameplay effects. Gameplay effects should NOT contain blueprint graphs.

游戏玩法效果定义。这是在编辑器中定义的、驱动一切的数据包。它仅支持蓝图化,以便为游戏玩法效果创建模板。游戏玩法效果不应包含蓝图图表。

可以知道 GE 是数据资产,所以不应该去写复杂逻辑。复杂逻辑应由 GA 承接。

那 GE 具体修改什么呢?修改的是 游戏属性 和 Tag。

修改游戏属性容易理解,那 tag 是什么意思呢?

tag 在 GAS 中的定位是 状态标记,标记当前对象处于什么状态。而 GA 深度集成 tag, 可以根据tag 作为释放/阻碍条件,也可以作为 GE 生效的前置条件。

所以我们再来看 GE, 所以可以发现 GE 本质是修改状态。

AttributeSet, 属性集,简称 AS, 在 GAS 中定义如下:

Defines the set of all GameplayAttributes for your game. Games should subclass this and add FGameplayAttributeData properties to represent attributes like health, damage, etc. AttributeSets are added to the actors as subobjects, and then registered with the AbilitySystemComponent. It often desired to have several sets per project that inherit from each other. You could make a base health set, then have a player set that inherits from it and adds more attributes

定义游戏中所有游戏性属性的集合。游戏应继承此类并添加FGameplayAttributeData属性,以表示生命值、伤害值等属性。属性集作为子对象添加到 actors 中,然后注册到能力系统组件。通常希望每个项目有多个相互继承的集合。你可以创建一个基础生命值集合,然后让玩家集合继承它并添加更多属性。

Ability System Component, 能力系统组件,简称 ASC.

The core ActorComponent for interfacing with the GameplayAbilities System

ASC 是和 GAS 交互的入口,每个 actor 如果使用 GAS, 都需要由 ASC。

Gameplay Cue, 游戏提示,简称 GC。 // 这一块我了解较少

执行非游戏性相关的事情,比如音效,粒子特效,震屏等。

Ability Task,表示为Ability中的一个任务。

AbilityTasks are small, self contained operations that can be performed while executing an ability. They are latent/asynchronous is nature. They will generally follow the pattern of 'start something and wait until it is finished or interrupted.

能力任务是小型的、独立的操作,可在执行某项能力时进行。它们本质上是潜在的/异步的。它们通常遵循"启动某事物,然后等待其完成或被中断"的模式。

在 GA 中,如果不调用 Ability Task,那就代表着是一帧完成的逻辑。而一些技能动画播放,很明显一帧无法满足,于是需要 Ability Task 进行动画播放的异步操作。

这是调用流程图

GAS 核心似乎就是ASC, GA,GE, AS,Tag 这一套协作关系。


写帖子真是一个很好的梳理知识点的方式。我以为我了解 GAS, 实则不然,今天算是把 GAS 的框架理清楚了。

相关推荐
dong1326978 小时前
UE5动画(上)
ue5
吴梓穆8 小时前
UE5 c++打印日志
开发语言·c++·ue5
吴梓穆8 小时前
UE5 C++ 绘制图形调试宏
开发语言·c++·ue5
chudonghao1 天前
[UE学习笔记][基于源码] 理解 Gameplay
c++·笔记·学习·ue5
爱搞虚幻的阿恺1 天前
RPG游戏开发【加餐】实现游戏小地图的简单方法
游戏·ue5·游戏引擎·虚幻
平行云PVT3 天前
数字孪生信创云渲染技术解析:从混合信创到全国产化架构
linux·unity·云原生·ue5·图形渲染·webgl·gpu算力
Дерек的学习记录4 天前
Unreal Engine 5:前置知识和入门基础
学习·ue5
GentooEmacs5 天前
unreal中渲染地球 通用静态磁层场线
ue5·数字孪生·太阳系·unrealengine·太空·地球磁场
思麟呀6 天前
UE蓝图初步
ue5