惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
T
Tenable Blog
博客园_首页
S
Securelist
Spread Privacy
Spread Privacy
Google Online Security Blog
Google Online Security Blog
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
U
Unit 42
L
LINUX DO - 热门话题
量子位
T
Threat Research - Cisco Blogs
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
Martin Fowler
Martin Fowler
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Security Latest
Security Latest
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
V2EX - 技术
V2EX - 技术
T
Tailwind CSS Blog
月光博客
月光博客
Recent Announcements
Recent Announcements
G
Google Developers Blog
F
Full Disclosure
W
WeLiveSecurity
宝玉的分享
宝玉的分享
腾讯CDC
G
GRAHAM CLULEY
Vercel News
Vercel News
Simon Willison's Weblog
Simon Willison's Weblog
美团技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security

博客园 - sun_dust_shadow

(翻译) 延迟补偿方法的协议设计与优化 Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization (翻译) Dota2 Random Distribution Dota2中的随机分布 (读书笔记)平衡掌控者 [瞄准辅助] 实现一种柔和平滑的瞄准辅助 (个人思考)实现游戏GAS系统中的Tag (翻译) Efficiency Tips on Switching Spaces and Transformation Matrices in Unity (翻译) V Rising's Animation Layering in Unity (翻译 unity2020.1) Understanding the managed heap (UnityEditor Tool) 语音控制unity editor暂停和播放 (翻译 ue gas) Gameplay Ability 总结 Overwatch Gameplay Architecture and Netcode 守望先锋的游戏架构与网络代码 (翻译 ) Source Multiplayer Networking Source引擎的多人网路系统 (翻译 gafferongames) Networked Physics in Virtual Reality VR中的网络物理 Topdown游戏中Input朝向的转化 (翻译 gafferongames) Client Server Connection 客户端服务器连接 (翻译 gafferongames)Reliable Ordered Messages 可靠有序消息 (翻译 gafferongames) Sending Large Blocks of Data 发送大块数据 (翻译 gafferongames) Packet Fragmentation and Reassembly 数据包分片与重组 游戏中Shotgun(喷子)发射子弹的实现
(个人思考)游戏技能的实现
sun_dust_shadow · 2025-10-19 · via 博客园 - sun_dust_shadow

游戏技能实现的三种方式:

1.类似UE中GAS的方式,统一为Ability,并且不处理任何数据逻辑。

https://github.com/No78Vino/gameplay-ability-system-for-unity

2.类似双影其境那种, 简单直观,每个Ability都是独立处理响应、行为。

3.一个SkillController方式。 SkillController驱动所有Skill的更新,Skill+Buff系统去处理战斗内每个Entity的行为。

其实类似第1中方式。不过没有这么明确的限定“属性”一定要在GAS中的GameEffect中进行处理

主要目标:本文讨论第3种的实现方式的实现思路。本文并没有讨论“属性”的实现,没有讨论editor实现。

第一步:有哪些内容需要实现?

1.触发器

一个triggerCondition可以触发 triggerActionList

一个Skill可以有多个triggerConditionList

2.每个skill的状态和具体逻辑,和触发后的逻辑;

skill的Active状态,skill在Active状态下内部逻辑

3.每个skill之间的关系。

比如当active skillA的时候 会禁用skillB。

比如有active skillA的时候,不能active skillB

4.多个skill绑定ownerEntity

第二步:怎么实现

so : ScriptableObject的缩写

我们定义了一个SkillContainer的So,里面包含了所有信息。

 public class SkillContainer
    {
        Trigger trigger;
        ISkill skill;
        TagAggregator TagAggregator;
    }

1. 一个triggerCondition只是condition,并不关心触发后的triggerActionList是什么。我们使用组合的方式

1.1 triggerCondition是一个so

1.2 triggerActionList的element是so (eventData)。

像一些CommonAction由指定CommonActionSystem去监听执行,比如常见的消耗、发射单发子弹行为。

像一些特殊的Action由当前skill.cs去执行。比如 每隔1s生成一颗环绕的旋转球

    class Trigger
    {
        TriggerCondition condition;
        TriggerActionList actionList;
    }

在实现skill流程后,通过配置去映射流程的实现, 并且,配置去“配”一些通用的功能。 

2.skill的话需要定义

2.1

interface ISkill
{
bool Active { get; set; }
bool TryActivate();
void Deactivate();
void Tick();
}

2.2 trigger的action直接监听1.2中的 triggerActionEventData

2.3  针对快节奏的项目,而非大世界的项目。我觉得直接把所有skill看作permanentSkill就行了,如果不需要了,直接Deactive。

如果是战斗内new的skill,也没有问题。

最多在Deactive的时候,把可能的“大数据”给clear或者returnPool。

这样比较简单直接

3.skill之间的关系

当整体skill流程完成后,通过skill内的tag数据去做“流程内”的细节处理。

比如在TryActive的函数内,需要检测这个skill和owner active skillList之间的关系。

4.我们使用entity+component的方式,而不是面向对象的方式实现。那么我们定义system和component:

class SkillListComponent: Component
{
  List
<SkillContainer>
}

同时, SkillSystem去Update这个SkillListComponent

    class SkillControllerSystem
    {

        Tick()
        {
            foreach (var entity in queryEntity)
            {
                var skillContainerList= entity.getComponent<SkillListComponent>().SkillList;
                foreach (var skillContainer in skillContainerList)
                {
                    if (skillContainer.skill.Active)
                    {
                        if (CheckTriggerCondition)
                        {
                            TriggerAction()
                        }
                        skillContainer.skill.Tick()
                    }
                }
            }
          
        }
    }