Files
nexus/wiki/concepts/GAS.md
2026-05-03 05:42:12 +08:00

1.6 KiB
Raw Blame History

title, type, tags, sources, last_updated
title type tags sources last_updated
GAS (Gameplay Ability System) concept
unreal-engine
gameplay
abilities
networking
unreal-multiplayer-architect
unreal-systems-engineer
2026-05-30

Aliases

  • Gameplay Ability System
  • 游戏能力系统
  • GAS

定义

GAS 是 UE5 的模块化能力框架提供技能、属性、效果GameplayEffect的标准化实现内置网络预测和复制支持。

核心组件

Ability (UGameplayAbility)

  • 可激活的游戏能力(技能、攻击、法术)
  • 支持本地和预测激活

AttributeSet (UAttributeSet)

  • 管理角色属性(生命值、魔法值、攻击力等)
  • 属性自动复制

GameplayEffect (UGameplayEffect)

  • 属性的修改效果buff、debuff、伤害、治疗
  • 可配置持续时间、周期、堆叠

AbilitySystemComponent (UAbilitySystemComponent)

  • 能力系统的核心组件
  • 管理 Ability 和 AttributeSet 的生命周期

网络预测

GAS 内置 FPredictionKey 支持:

  • 客户端预测能力激活
  • 服务器确认或回滚
  • 支持 PredictionKey::NewManagedNetGUID()

双初始化路径

// 服务器路径
void AMyCharacter::PossessedBy(AController* NewController) {
    AbilitySystemComponent->InitAbilityActorInfo(GetPlayerState(), this);
}

// 客户端路径
void AMyCharacter::OnRep_PlayerState() {
    AbilitySystemComponent->InitAbilityActorInfo(GetPlayerState(), this);
}

相关概念