[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-luxkun--ReGoap":3,"tool-luxkun--ReGoap":62},[4,18,26,36,46,54],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",159636,2,"2026-04-17T23:33:34",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":42,"last_commit_at":43,"category_tags":44,"status":17},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[13,45],"插件",{"id":47,"name":48,"github_repo":49,"description_zh":50,"stars":51,"difficulty_score":32,"last_commit_at":52,"category_tags":53,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":55,"name":56,"github_repo":57,"description_zh":58,"stars":59,"difficulty_score":32,"last_commit_at":60,"category_tags":61,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,13,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":76,"owner_location":76,"owner_email":77,"owner_twitter":76,"owner_website":78,"owner_url":79,"languages":80,"stars":89,"forks":90,"last_commit_at":91,"license":92,"difficulty_score":32,"env_os":93,"env_gpu":94,"env_ram":94,"env_deps":95,"category_tags":101,"github_topics":102,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":107,"updated_at":108,"faqs":109,"releases":139},8698,"luxkun\u002FReGoap","ReGoap","Generic C# GOAP (Goal Oriented Action Planning) library with Unity3d examples","ReGoap 是一个通用的 C# 目标导向行动规划（GOAP）库，专为游戏开发设计，并提供了丰富的 Unity3D 示例与辅助类。它旨在解决游戏中非玩家角色（NPC）的行为决策难题，让 AI 能够根据当前环境状态，自动推演出一系列合理的动作序列以达成特定目标，从而摆脱传统有限状态机在复杂逻辑下难以维护的困境。\n\n该工具非常适合游戏开发者、AI 程序员以及希望提升 NPC 智能表现的设计师使用。无论是制作策略游戏中的单位调度，还是角色扮演游戏中敌人的战术反应，ReGoap 都能提供灵活的支持。其核心亮点在于高度的通用性：虽然内置了 Unity 集成方案，但若移除相关文件夹，它可无缝运行于任何支持 C# 的游戏引擎或项目中。\n\nReGoap 将世界抽象为“状态”，将行为定义为带有“前置条件”和“执行效果”的动作。通过传感器实时感知环境，AI 代理能动态规划出如“靠近敌人”、“装备武器”或“发动攻击”等连贯行为链。这种架构不仅让行为逻辑更加清晰易懂，还极大地增强了角色的自适应能力，是构建高智能游戏 AI 的得力助手。","# ReGoap\nGeneric C# GOAP (Goal Oriented Action Planning) library with Unity3d examples and helpers classes.\n\nThis library is very generic, if you don't include the Unity folder you can use it in any game engine.\n\n1. [Get Started, fast version](#get-started-fast-version)\n2. [Get Started, long version](#get-started-long-version)\n    1. [Explaining GOAP](#explaining-goap)\n    2. [How to use ReGoap in Unity3D](#how-to-use-regoap-in-unity3d)\n        1. [How to implement your own ReGoapAction](#how-to-implement-your-own-regoapaction)\n        2. [How to implement your own ReGoapGoal](#how-to-implement-your-own-regoapgoal)\n        3. [How to implement your own ReGoapSensor](#how-to-implement-your-own-regoapsensor)\n3. [Debugging](#debugging)\n4. [Pull Requests](#pull-requests)\n\n---\n\n## Get Started, fast version\nStart by checking out the [Unity FSM example here](https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Ftree\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample).\n\nThis example uses the ReGoap library in Unity with a simple FSM (Finite State Machine) to handle the macro behaviours (in most games three FSM states should suffice: idle, goto, animate).\n\nTo use it create a new Unity project, open the shell, go to the Assets directory and clone the whole repository in there:\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap.git\n```\n(in windows you can do the same with command line or any git client, also you can just click on \"Clone or Download\" and then \"Download ZIP\")\n\nAlso you can just download the last release's unity package, which probably won't have latest changes, [here](https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Freleases\u002F) or on the [unity asset store](https:\u002F\u002Fwww.assetstore.unity3d.com\u002Fen\u002F#!\u002Fcontent\u002F77376).\n\n---\n\n## Get Started, long version\n### Explaining GOAP\n(if you just want to use the library and want an explained example skip to **[How to use ReGoap](#how-to-use-regoap-in-unity3d)**)\n\nBefore explaining how to use this library in your game let me explain how does a Goap system work, starting with a quote of [Jeff Orkin](http:\u002F\u002Falumni.media.mit.edu\u002F~jorkin\u002Fgoap.html)\n```\nGoal-Oriented Action Planning (aka GOAP, rhymes with soap) refers to a simplfied STRIPS-like planning architecture specifically designed for real-time control of autonomous character behavior in games.\n```\nBasically all it does is find a plan (a list of actions) that will fulfill the choosen goal's objectives.\n\nThe main concept you need to understand are: [States](#state), [Action](#action), [Goal](#goal), [Memory](#memory) and [Sensors](#sensor)\n\n#### State\nis a definition of the world, in this library they are handled as a Dictionary of string to object (Dictionary\u003Cstring, object>).\n\nCheck out ReGoapState class in this file: https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FCore\u002FReGoapState.cs\n\nExample: *'isAt': 'enemy', 'isWarned': true, 'hasWeapon': true*\n\n\n#### Action\ncan be defined as a list of preconditions and effects, these are the actions that the Agent (AI pawn, will be called Agent from now on) can do.\n\nThe preconditions are the requirement that the Action requires to be ran, described as a State, the effects, as the name implies, are the effects of the Action, as well described as a State.\n\nExamples: \n\n* *'Open door': [pre: {'nearDoor': true, 'doorUnlocked': true}, effects: {'doorOpened': true}]*\n* *'Close combat attack': [pre: {'weaponEquipped': true, 'isAt': 'enemy'}, effects: {'hurtEnemy' true}]*\n* *'Go to enemy': [pre: {'enemyInLoS': true, 'canMove': true}, effects: {'isAt': 'enemy'}]*\n* *'Equip weapon': [pre: {'hasWeapon': true}, effects: {'weaponEquipped': true}]*\n* *'Patrol': [pre: {'canMove': true}, effects: {'isPatrolling': true}]*\n\n*IMPORTANT*: false preconditions are NOT supported\n*IMPORTANT*: the action effects aren't written in the memory when the action is done, this is a wanted behaviour because in most of the games you will want to set these variables from the memory or from the sensors.\nIf you want you can override Exit in your ReGoapAction and set the effects to the memory, example following.\n\n\n#### Goal\ncan be defined as a list of requisites, described as a State, this is basically what the Agent should do.\n\nExamples:\n\n* *'Kill Enemy': {'hurtEnemy': true}*\n* *'Patrol': {'isPatrolling': true}*\n\n\n#### Memory\nis the memory of the Agent, everything the Agent knows and feel should be inserted here. A memory also can have many sensors, in this library, which are a memory helper. Basically the job of the Memory is to create and keep updated a 'World' State.\n\n#### Sensor\nis a memory helper, it should handle a specific scope.\n\nExample: \n* *EyeSensor (check if an enemy is in line of sight)*\n* *EarsSensor (check if an enemy has been heard, you could make a single EnemySensor which has EyeSensor and EarsSensor of course)*\n\n\nNow you should understand what is a GOAP library for and what you should use it for, if still having questions or want to know more about this field I advise you to read Jeff Orkin's papers here: http:\u002F\u002Falumni.media.mit.edu\u002F~jorkin\u002F\n\n### How to use ReGoap in Unity3D\n1. Clone this repository in your Unity project.\nCommand line:\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap.git\n```\n2. Create a GameObject for your Agent\n3. Add a ReGoapAgent component, choose a name (you must create your own class that inherit ReGoapAgent, or implements IReGoapAgent)\n4. Add a ReGoapMemory component, choose a name (you must create your own class that inherit ReGoapMemory, or implements IReGoapMemory)\n5. [optional | repeat as needed] Add your own sensor class that inherit ReGoapSensor or implements IReGoapSensor\n6. [repeat as needed] Add your own class that inherit ReGoapAction or implements IReGoapAction (choose wisely what preconditions and effects should this action have) and implement the action logic by overriding the Run function, this function will be called by the ReGoapAgent.\n7. [repeat as needed] Add your own class that inherit ReGoapGoal or implements IReGoapGoal (choose wisely what goal state the goal has)\n8. Add ONE ReGoapPlannerManager (you must create your own class that inherit ReGoapPlannerManager) to any GameObject (not the agent!), this will handle all the planning.\n9. Play the game :-)\n\nWhat's more? nothing really, the library will handle all the planning, choose the actions to complete a goal and run the first one until it's done, then the second one and so on, all you need to do is implement your own actions and goals.\n\nIn the next paragraphs I'll explain how to create your own classes (but for most of behaviours all you need to implement is GoapAction and GoapGoal).\n\n#### How to implement your own ReGoapAction\nCheck out the actions in this example: https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Ftree\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample\u002FActions\n\nCheck out ReGoapAction implementation, to see what functions you can override: https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FReGoapAction.cs\n\nYou must implement your own ReGoapAction by implementing IReGoapAction interface or inheriting ReGoapAction.\nChoose wisely the generic types, they must be the same across all the classes of the agent. \nUsually string, object is the most generic, also int\u002Fenum, object is as well generic but lighter.\n\nFor a simple implementation all you have to do is this:\n```C#\npublic class MyGoapAction : ReGoapAction\u003Cstring, object>\n{\n    protected override void Awake()\n    {\n        base.Awake();\n        preconditions.Set(\"myPrecondition\", myValue);\n        effects.Set(\"myEffects\", myValue);\n    }\n    public override void Run(IReGoapAction\u003Cstring, object> previous, IReGoapAction\u003Cstring, object> next, ReGoapState\u003Cstring, object> settings, ReGoapState\u003Cstring, object> goalState, Action\u003CIReGoapAction\u003Cstring, object>> done, Action\u003CIReGoapAction\u003Cstring, object>> fail)\n    {\n        base.Run(previous, next, goalState, done, fail);\n        \u002F\u002F do your own game logic here\n        \u002F\u002F when done, in this function or outside this function, call the done or fail callback, automatically saved to doneCallback and failCallback by ReGoapAction\n        doneCallback(this); \u002F\u002F this will tell the ReGoapAgent that the action is succerfully done and go ahead in the action plan\n        \u002F\u002F if the action has failed then run failCallback(this), the ReGoapAgent will automatically invalidate the whole plan and ask the ReGoapPlannerManager to create a new plan\n    }\n}\n```\n\nAs written before the ReGoapAction does not, by default, write the effects on the memory, but the memory should check out if the effects are effectively done, if for any reason you want to set the effects at the end of the action you can add this code to your ReGoapAction implementation:\n```C#\n    public override void Exit(IReGoapAction\u003Cstring, object> next)\n    {\n        base.Exit(next);\n\n        var worldState = agent.GetMemory().GetWorldState();\n        foreach (var pair in effects) {\n            worldState.Set(pair.Key, pair.Value);\n        }\n    }\n```\n\nYou can also have preconditions and effects that are dynamically changed based on the next action's preconditions\u002Feffects, for example this how you can handle a GoTo action in your agent.\n\nCheck out FSMExample to see how to do this:\nhttps:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample\u002FActions\u002FGenericGoToAction.cs\n\n#### How to implement your own ReGoapGoal\nThis is less tricky, most of the goal will only override the Awake function to add your own goal state (objectives).\n\nAnyway check out ReGoapGoal, like everything you have to implement your own class from scratch by implementing IReGoapGoal interface or inheriting ReGoapGoal: https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FReGoapGoal.cs\n\nAlso check out the goals in this example: https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Ftree\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample\u002FGoals\n\n```C#\npublic class MyGoapGoal : ReGoapGoal\u003Cstring, object>\n{\n    protected override void Awake()\n    {\n        base.Awake();\n        goal.Set(\"myRequirement\", myValue);\n    }\n}\n```\n\n*Note*: make sure to use ReGoapGoalAdvanced if you want to automatically warn the agent that a goal is\u002Fis not available.\n\n#### How to implement your own GoapSensor\nCheck out GoapSensor basic class here: https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FGoapSensor.cs\n\nCheck out examples here: https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Ftree\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample\u002FSensors\n\nAs always you have to implement your own class by inheriting ReGoapSensor or implementing IReGoapSensor interface.\n\n```C#\npublic class MySensor : ReGoapSensor\u003Cstring, object>\n{\n    void FixedUpdate()\n    {\n        var worldState = memory.GetWorldState();\n        worldState.Set(\"mySensorValue\", myValue); \u002F\u002F like always myValue can be anything... it's a GoapState :)\n    }\n}\n```\n\n*Note*: make sure to use ReGoapMemoryAdvanced when working with sensors, since the basic class does not check and update sensors. \n\n---\n\n## Debugging\nTo debug your own agent you can, of course, debug on your own, with your favourite editor.\n\nBut ReGoap has a very userful debugger for agents in Unity (https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FEditor\u002FReGoapNodeEditor.cs and https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FEditor\u002FReGoapNodeBaseEditor.cs).\n\nTo use it just click on the Unity's menu **Window** and then **ReGoap Debugger**, an Unity Window will open, this is the agent debugger.\n\nNow if you click on any agent in your scene (while playing, works only on running agents) the window will automatically update letting you know the agent's \"thoughts\" (current world state, choosen goal and current plan, possibile goals, possible actions, what can be done and what not, try it!).\n\n---\n\n## Pull Requests\nAny pull request is appreciated, just make sure to check Unity Tests (menu **Window** -> **Editor Tests Runner** -> **Run All**) before committing and to keep the same style of code.\n","# ReGoap\n通用的 C# GOAP（目标导向行动规划）库，附带 Unity3D 示例和辅助类。\n\n该库非常通用；如果不包含 Unity 文件夹，您可以在任何游戏引擎中使用它。\n\n1. [快速入门](#get-started-fast-version)\n2. [详细入门](#get-started-long-version)\n    1. [GOAP 简介](#explaining-goap)\n    2. [如何在 Unity3D 中使用 ReGoap](#how-to-use-regoap-in-unity3d)\n        1. [如何实现自定义 ReGoapAction](#how-to-implement-your-own-regoapaction)\n        2. [如何实现自定义 ReGoapGoal](#how-to-implement-your-own-regoapgoal)\n        3. [如何实现自定义 ReGoapSensor](#how-to-implement-your-own-regoapsensor)\n3. [调试](#debugging)\n4. [拉取请求](#pull-requests)\n\n---\n\n## 快速入门\n首先查看[这里的 Unity FSM 示例](https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Ftree\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample)。\n\n此示例在 Unity 中使用 ReGoap 库，并结合一个简单的有限状态机（FSM）来处理宏观行为逻辑（大多数游戏中，三个 FSM 状态就足够了：空闲、移动到目标、播放动画）。\n\n要使用它，请创建一个新的 Unity 项目，打开项目文件夹，进入 Assets 目录，并将整个仓库克隆到该目录中：\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap.git\n```\n（在 Windows 上，您也可以通过命令行或任何 Git 客户端完成相同的操作，或者直接点击“克隆或下载”然后选择“下载 ZIP 文件”）\n\n此外，您也可以直接下载最新版本的 Unity 包，不过其中可能不包含最新的更改，下载链接为[这里](https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Freleases\u002F)，或在[Unity 资源商店](https:\u002F\u002Fwww.assetstore.unity3d.com\u002Fen\u002F#!\u002Fcontent\u002F77376)获取。\n\n---\n\n## 详细入门\n### GOAP 简介\n（如果您只想使用该库并希望先了解示例，请跳至 **[如何使用 ReGoap](#how-to-use-regoap-in-unity3d)**）\n\n在介绍如何在您的游戏中使用此库之前，让我先解释一下 GOAP 系统的工作原理。引用 Jeff Orkin 的话：\n```\n目标导向行动规划（简称 GOAP，与 soap 押韵）是一种简化的 STRIPS 类规划架构，专为游戏中自主角色行为的实时控制而设计。\n```\n\n简单来说，它的作用就是找到一个行动计划（一系列动作），以实现所选目标的要求。\n\n您需要理解的主要概念包括：[状态](#state)、[动作](#action)、[目标](#goal)、[记忆](#memory) 和 [传感器](#sensor)。\n\n#### 状态\n是世界的一种描述，在本库中，状态被表示为字符串到对象的字典（Dictionary\u003Cstring, object>）。\n\n请参阅此文件中的 ReGoapState 类：https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FCore\u002FReGoapState.cs\n\n示例：*'isAt': 'enemy', 'isWarned': true, 'hasWeapon': true*\n\n#### 动作\n可以定义为一组前提条件和效果，这些就是智能体（AI 角色，以下简称“智能体”）可以执行的动作。\n\n前提条件是指执行该动作所需的条件，用状态来描述；而效果则是动作产生的结果，同样用状态来描述。\n\n示例：\n\n* *‘开门’：[前提：{'nearDoor': true, 'doorUnlocked': true}，效果：{'doorOpened': true}]*\n* *‘近战攻击’：[前提：{'weaponEquipped': true, 'isAt': 'enemy'}，效果：{'hurtEnemy' true}]*\n* *‘前往敌人’：[前提：{'enemyInLoS': true, 'canMove': true}，效果：{'isAt': 'enemy'}]*\n* *‘装备武器’：[前提：{'hasWeapon': true}，效果：{'weaponEquipped': true}]*\n* *‘巡逻’：[前提：{'canMove': true}，效果：{'isPatrolling': true}]*\n\n*重要提示*：不支持假的前提条件。\n*重要提示*：动作完成后，其效果不会自动写入记忆中。这是有意为之的行为，因为在大多数游戏中，您通常会希望通过记忆或传感器来设置这些变量。如果您需要，可以在自定义的 ReGoapAction 中重写 Exit 方法，手动将效果写入记忆中，具体示例如下。\n\n#### 目标\n可以定义为一组要求，用状态来描述，这基本上就是智能体应该完成的任务。\n\n示例：\n\n* *‘击杀敌人’：{'hurtEnemy': true}*\n* *‘巡逻’：{'isPatrolling': true}*\n\n#### 记忆\n是智能体的记忆，智能体所知道和感知的一切都应存储在这里。记忆还可以包含多个传感器，这些传感器在本库中作为记忆的辅助工具。记忆的主要职责是构建并持续更新“世界”状态。\n\n#### 传感器\n是记忆的辅助工具，负责处理特定范围内的信息。\n\n示例：\n* *视线传感器（检测是否有敌人在视野内）*\n* *听觉传感器（检测是否听到敌人的声音，当然您也可以创建一个综合的敌人传感器，同时包含视线传感器和听觉传感器）*\n\n现在您应该已经了解了 GOAP 库的作用以及适用场景。如果您仍有疑问或想进一步深入了解这一领域，建议阅读 Jeff Orkin 的相关论文：http:\u002F\u002Falumni.media.mit.edu\u002F~jorkin\u002F\n\n### 如何在 Unity3D 中使用 ReGoap\n1. 在你的 Unity 项目中克隆此仓库。\n命令行：\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap.git\n```\n2. 为你的智能体创建一个 GameObject。\n3. 添加一个 ReGoapAgent 组件，并为其命名（你需要创建一个继承自 ReGoapAgent 或实现 IReGoapAgent 接口的类）。\n4. 添加一个 ReGoapMemory 组件，并为其命名（你需要创建一个继承自 ReGoapMemory 或实现 IReGoapMemory 接口的类）。\n5. [可选 | 根据需要重复] 添加你自己的传感器类，该类应继承 ReGoapSensor 或实现 IReGoapSensor 接口。\n6. [根据需要重复] 添加你自己的类，该类应继承 ReGoapAction 或实现 IReGoapAction 接口（请谨慎选择该行动应具备的前提条件和效果），并通过重写 Run 函数来实现行动逻辑。此函数将由 ReGoapAgent 调用。\n7. [根据需要重复] 添加你自己的类，该类应继承 ReGoapGoal 或实现 IReGoapGoal 接口（请明智地选择目标状态）。\n8. 在任意 GameObject 上（不要放在智能体上！）添加一个 ReGoapPlannerManager（你需要创建一个继承自 ReGoapPlannerManager 的类），它将负责所有的规划工作。\n9. 开始游戏吧 :-)\n\n还有什么呢？其实没什么了，这个库会自动处理所有规划任务：选择完成目标的动作，并依次执行第一个、第二个……直到完成。你只需要实现自己的动作和目标即可。\n\n在接下来的段落中，我将解释如何创建自己的类（但对于大多数行为来说，你只需实现 GoapAction 和 GoapGoal 即可）。\n\n#### 如何实现自己的 ReGoapAction\n请查看此示例中的动作：https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Ftree\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample\u002FActions\n\n查看 ReGoapAction 的实现，了解你可以重写的函数：https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FReGoapAction.cs\n\n你需要通过实现 IReGoapAction 接口或继承 ReGoapAction 来实现自己的 ReGoapAction。请明智地选择泛型类型，它们必须在整个智能体的所有类中保持一致。通常情况下，string, object 是最通用的类型；而 int\u002Fenum, object 虽然同样通用，但更为轻量。\n\n对于简单的实现，你只需这样做：\n```C#\npublic class MyGoapAction : ReGoapAction\u003Cstring, object>\n{\n    protected override void Awake()\n    {\n        base.Awake();\n        preconditions.Set(\"myPrecondition\", myValue);\n        effects.Set(\"myEffects\", myValue);\n    }\n    public override void Run(IReGoapAction\u003Cstring, object> previous, IReGoapAction\u003Cstring, object> next, ReGoapState\u003Cstring, object> settings, ReGoapState\u003Cstring, object> goalState, Action\u003CIReGoapAction\u003Cstring, object>> done, Action\u003CIReGoapAction\u003Cstring, object>> fail)\n    {\n        base.Run(previous, next, goalState, done, fail);\n        \u002F\u002F 在这里编写你自己的游戏逻辑\n        \u002F\u002F 当完成时，无论是在本函数内还是外部，调用 done 或 fail 回调函数，这些回调函数会被 ReGoapAction 自动保存为 doneCallback 和 failCallback。\n        doneCallback(this); \u002F\u002F 这将通知 ReGoapAgent 该行动已成功完成，并继续执行行动计划\n        \u002F\u002F 如果行动失败，则调用 failCallback(this)，ReGoapAgent 会自动使整个计划失效，并请求 ReGoapPlannerManager 重新制定计划。\n    }\n}\n```\n\n如前所述，ReGoapAction 默认不会将效果写入内存，但内存系统需要检查效果是否确实已完成。如果你希望在行动结束时设置效果，可以在你的 ReGoapAction 实现中添加以下代码：\n```C#\n    public override void Exit(IReGoapAction\u003Cstring, object> next)\n    {\n        base.Exit(next);\n\n        var worldState = agent.GetMemory().GetWorldState();\n        foreach (var pair in effects) {\n            worldState.Set(pair.Key, pair.Value);\n        }\n    }\n```\n\n你还可以让前提条件和效果根据下一个行动的前提条件\u002F效果动态变化。例如，这就是你在智能体中处理 GoTo 行动的方式。\n\n请查看 FSMExample 以了解如何操作：https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample\u002FActions\u002FGenericGoToAction.cs\n\n#### 如何实现自己的 ReGoapGoal\n这相对简单，大多数目标只需重写 Awake 函数，以添加你自己的目标状态（目标）。\n\n无论如何，请查看 ReGoapGoal 的定义：与所有其他类一样，你需要从头开始实现自己的类，方法是实现 IReGoapGoal 接口或继承 ReGoapGoal：https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FReGoapGoal.cs\n\n同时，请查看此示例中的目标：https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Ftree\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample\u002FGoals\n\n```C#\npublic class MyGoapGoal : ReGoapGoal\u003Cstring, object>\n{\n    protected override void Awake()\n    {\n        base.Awake();\n        goal.Set(\"myRequirement\", myValue);\n    }\n}\n```\n\n*注意*：如果你希望智能体能够自动感知目标是否可用，请务必使用 ReGoapGoalAdvanced。\n\n#### 如何实现自己的 GoapSensor\n请在此处查看 GoapSensor 的基础类：https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FGoapSensor.cs\n\n更多示例请参阅：https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Ftree\u002Fmaster\u002FReGoap\u002FUnity\u002FFSMExample\u002FSensors\n\n与往常一样，你需要通过继承 ReGoapSensor 或实现 IReGoapSensor 接口来实现自己的传感器类。\n\n```C#\npublic class MySensor : ReGoapSensor\u003Cstring, object>\n{\n    void FixedUpdate()\n    {\n        var worldState = memory.GetWorldState();\n        worldState.Set(\"mySensorValue\", myValue); \u002F\u002F 同样，myValue 可以是任何值……毕竟这是 GoapState :)\n    }\n}\n```\n\n*注意*：在使用传感器时，请务必使用 ReGoapMemoryAdvanced，因为基础类不会自动检查和更新传感器数据。\n\n---\n\n## 调试\n当然，你可以使用自己喜欢的编辑器对智能体进行调试。\n\n不过，ReGoap 提供了一个非常实用的 Unity 智能体调试工具（https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FEditor\u002FReGoapNodeEditor.cs 和 https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fblob\u002Fmaster\u002FReGoap\u002FUnity\u002FEditor\u002FReGoapNodeBaseEditor.cs）。要使用它，只需点击 Unity 菜单中的 **Window**，然后选择 **ReGoap Debugger**，一个 Unity 窗口将会打开，这就是智能体调试器。\n\n现在，当你在场景中点击任意智能体（仅在运行时有效）时，窗口会自动更新，显示智能体的“思考”内容（当前世界状态、所选目标和当前计划、可能的目标、可能的动作、可以做什么以及不能做什么——快试试吧！）。\n\n---\n\n## 拉取请求\n我们欢迎任何拉取请求，但在提交之前，请务必运行 Unity 测试（菜单 **Window** -> **Editor Tests Runner** -> **Run All**），并保持一致的代码风格。","# ReGoap 快速上手指南\n\nReGoap 是一个通用的 C# GOAP（目标导向行动规划）库，专为游戏 AI 设计。虽然它提供了 Unity3D 的示例和辅助类，但核心库是引擎无关的，可适用于任何支持 C# 的游戏引擎。\n\n## 环境准备\n\n*   **系统要求**：支持 .NET Standard 或 .NET Framework 的环境。\n*   **前置依赖**：\n    *   **游戏引擎**：推荐使用 **Unity3D**（官方提供了完整的示例和编辑器调试工具）。若使用其他引擎，仅需引用核心库代码。\n    *   **版本控制**：安装 Git（用于克隆仓库）。\n    *   **语言版本**：确保项目支持 C# 泛型及字典操作。\n\n## 安装步骤\n\n### 方式一：通过 Git 克隆（推荐，获取最新代码）\n\n1.  打开终端或命令行工具。\n2.  进入你的 Unity 项目 `Assets` 目录（或其他希望存放库的目录）。\n3.  执行以下命令克隆整个仓库：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap.git\n```\n\n> **提示**：如果你只需要核心库而不需要 Unity 特定功能，可以只复制 `ReGoap\u002FCore` 文件夹到你的项目中。\n\n### 方式二：下载发布包\n\n*   **GitHub Releases**：访问 [ReGoap Releases](https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Freleases\u002F) 下载最新的 Unity Package。\n*   **Unity Asset Store**：在 Unity 资源商店搜索 \"ReGoap\" 或直接访问页面下载（版本可能略滞后于 GitHub）。\n\n## 基本使用\n\n以下是在 Unity3D 中构建一个简单 AI 代理（Agent）的最小化流程。\n\n### 1. 场景设置\n\n1.  在场景中创建一个空的 GameObject，命名为 `Agent`。\n2.  为 `Agent` 添加自定义的脚本组件（需继承自库中的基类）：\n    *   **ReGoapAgent**：AI 的核心控制器。\n    *   **ReGoapMemory**：存储世界状态（World State）。\n    *   *(可选)* **ReGoapSensor**：用于实时更新记忆（如感知敌人）。\n3.  在场景中任意位置创建一个空 GameObject，命名为 `PlannerManager`。\n4.  为其添加自定义脚本组件 **ReGoapPlannerManager**（全场景只需一个，负责统筹规划）。\n\n### 2. 代码实现示例\n\n你需要创建三个核心类来定义 AI 的行为逻辑。以下是基于 `string, object` 泛型的最简实现：\n\n#### A. 定义动作 (ReGoapAction)\n\n动作包含“前提条件”（Preconditions）和“效果”（Effects）。\n\n```C#\nusing ReGoap.Core;\nusing ReGoap.Unity;\n\npublic class MoveToEnemyAction : ReGoapAction\u003Cstring, object>\n{\n    protected override void Awake()\n    {\n        base.Awake();\n        \u002F\u002F 设置前提：必须能看到敌人且可以移动\n        preconditions.Set(\"enemyInLoS\", true);\n        preconditions.Set(\"canMove\", true);\n        \n        \u002F\u002F 设置效果：执行后位于敌人处\n        effects.Set(\"isAt\", \"enemy\");\n    }\n\n    public override void Run(IReGoapAction\u003Cstring, object> previous, IReGoapAction\u003Cstring, object> next, \n        ReGoapState\u003Cstring, object> settings, ReGoapState\u003Cstring, object> goalState, \n        Action\u003CIReGoapAction\u003Cstring, object>> done, Action\u003CIReGoapAction\u003Cstring, object>> fail)\n    {\n        base.Run(previous, next, goalState, done, fail);\n        \n        \u002F\u002F --- 在此处编写具体的游戏逻辑 (如调用寻路系统) ---\n        \u002F\u002F 模拟移动过程...\n        \n        \u002F\u002F 逻辑完成后，必须调用回调通知规划器\n        doneCallback(this); \n    }\n}\n```\n\n#### B. 定义目标 (ReGoapGoal)\n\n目标是 AI 想要达到的世界状态。\n\n```C#\nusing ReGoap.Core;\nusing ReGoap.Unity;\n\npublic class AttackEnemyGoal : ReGoapGoal\u003Cstring, object>\n{\n    protected override void Awake()\n    {\n        base.Awake();\n        \u002F\u002F 目标状态：已经伤害到敌人\n        goal.Set(\"hurtEnemy\", true);\n    }\n}\n```\n\n#### C. 定义传感器 (ReGoapSensor) - 可选但推荐\n\n传感器负责持续更新内存中的世界状态。\n\n```C#\nusing ReGoap.Core;\nusing ReGoap.Unity;\n\npublic class VisionSensor : ReGoapSensor\u003Cstring, object>\n{\n    void FixedUpdate()\n    {\n        var worldState = memory.GetWorldState();\n        \u002F\u002F 检测逻辑：假设有一个方法能判断是否看到敌人\n        bool seesEnemy = CheckLineOfSight(); \n        worldState.Set(\"enemyInLoS\", seesEnemy);\n    }\n    \n    private bool CheckLineOfSight() { \u002F* 实现检测逻辑 *\u002F return false; }\n}\n```\n\n### 3. 运行与调试\n\n1.  将上述脚本挂载到对应的 GameObject 上。\n2.  点击 Unity 编辑器顶部的 **Window** -> **ReGoap Debugger** 打开调试窗口。\n3.  进入 Play 模式，选中场景中的 `Agent`。\n4.  在调试窗口中，你可以实时查看 AI 的“思维过程”：当前世界状态、选定的目标、生成的行动计划以及可用的动作列表。\n\n> **注意**：默认情况下，动作执行完毕后不会自动将“效果”写入内存。如果需要自动写入，请在你的 Action 类中重写 `Exit` 方法并将 effects 应用到 `agent.GetMemory().GetWorldState()`。","在开发一款潜行策略游戏时，开发者需要让敌方 NPC 根据玩家动态行为（如是否被发现、是否有武器）自主规划巡逻、警戒或攻击等行为。\n\n### 没有 ReGoap 时\n- **逻辑硬编码严重**：开发者需用大量嵌套的 `if-else` 或状态机手动编写每种情境下的行为跳转，代码臃肿且难以维护。\n- **行为缺乏灵活性**：若玩家突然扔掉武器逃跑，NPC 往往无法动态调整战术，只能机械执行预设脚本，显得呆板。\n- **扩展成本极高**：每新增一种交互动作（如“呼叫支援”），都需要重新梳理所有状态流转逻辑，极易引发连锁 Bug。\n- **调试困难**：当 NPC 做出错误决策时，难以追溯是哪一段条件判断导致了逻辑死锁或无效循环。\n\n### 使用 ReGoap 后\n- **声明式规划替代硬编码**：只需定义动作的“前置条件”（如需持有武器）和“效果”（如敌人受伤），ReGoap 自动计算达成目标的最佳行动序列。\n- **动态适应战场变化**：当玩家状态改变（如从“有武器”变为“无武器”），系统会实时重新规划路径，让 NPC 自然切换为“近身搏斗”或“报警”。\n- **低成本扩展行为库**：新增“呼叫支援”动作仅需配置其前后置状态，无需修改现有逻辑，系统自动将其纳入可选策略池。\n- **可视化调试支持**：利用内置的调试工具，开发者可直观查看当前世界状态与规划路径，快速定位决策异常原因。\n\nReGoap 将复杂的 AI 决策转化为可配置的数据驱动模型，让游戏角色真正具备“思考”能力而非机械反应。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fluxkun_ReGoap_ff5c12f7.png","luxkun","Luciano Ferraro","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fluxkun_f12690e2.jpg",null,"luciano.ferraro@gmail.com","https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fluciano-ferraro-9046997a\u002F","https:\u002F\u002Fgithub.com\u002Fluxkun",[81,85],{"name":82,"color":83,"percentage":84},"C#","#178600",99.6,{"name":86,"color":87,"percentage":88},"Batchfile","#C1F12E",0.4,1098,153,"2026-04-06T17:00:20","Apache-2.0","Windows, macOS, Linux","未说明",{"notes":96,"python":97,"dependencies":98},"该工具是一个通用的 C# GOAP（目标导向行动规划）库，主要设计用于 Unity3D 引擎，但也可用于其他游戏引擎。运行需要安装 Unity3D 和 Git（用于克隆仓库）。不涉及 Python 环境、GPU 加速或特定的显存\u002FCUDA 版本要求。内存需求取决于具体的游戏项目规模，库本身无特殊高内存要求。","不适用 (基于 C#)",[99,100],"Unity3D",".NET Framework \u002F Mono",[14,13,15],[103,104,105,106],"unity","goap","ai","gamedev","2026-03-27T02:49:30.150509","2026-04-18T09:20:12.321500",[110,115,120,125,130,135],{"id":111,"question_zh":112,"answer_zh":113,"source_url":114},38958,"如何在 Unity 中解决导入 ReGoap 后出现的 'CompilerErrorCollection' 编译错误？","该错误通常是因为 .NET 框架版本不兼容导致的。解决方法是进入 Unity 的 Player Settings，将 Scripting Backend 更改为 IL2CPP，并将 API Compatibility Level 设置为 .NET Framework（或尝试切换到 .NET 4.0）。避免使用默认的 .NET 2.0 配置，这通常能解决命名空间缺失的问题。","https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fissues\u002F29",{"id":116,"question_zh":117,"answer_zh":118,"source_url":119},38959,"在使用多线程规划时，为什么某些 AI 代理无法执行动作？有哪些限制？","ReGoap 的多线程功能要求实现代码必须是线程安全的。在使用多线程时，严禁在动作类的方法（如预计算、GetPreconditions、GetEffects、CheckProceduralCondition、GetCost）中调用任何 Unity API（例如 GetComponent），也不能修改类的字段状态。如果需要在这些方法中使用数据，请确保数据是只读的或在主线程中预先计算好。如果不确定，建议将线程数设置为 1 以排查是否为线程安全问题。","https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fissues\u002F13",{"id":121,"question_zh":122,"answer_zh":123,"source_url":124},38960,"如果一个动作（如射击玩家）失败了或者目标未达成，如何让规划器重新评估并生成新计划？","需要在动作的 Run 方法中正确报告失败状态。不要假设动作会自动重试。你应该在动作逻辑中加入检测（例如检查玩家是否还活着），如果条件不满足，必须显式调用失败回调（fail callback）。此外，建议将复杂行为拆分为多个动作（例如“移动到射程内”和“射击”），并利用前置条件（如 \"nearPlayer\"）来区分不同状态，这样规划器可以根据世界状态的变化自动选择新的路径。","https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fissues\u002F37",{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},38961,"如何为涉及空间移动的动作（如 GoTo）实现基于距离的动态成本计算？","目前的架构中，GetCost 函数可能无法直接获取完整的上下文。为了实现基于距离的成本估算，建议修改 GetCost 的签名，使其不仅接收下一个动作，还能接收当前的 ReGoapState（节点状态）。通过传入的状态，移动动作可以访问累积效应中的位置信息（如 \"isAtPosition\"），从而计算出从当前位置到目标位置的实际距离成本。这需要用户自定义修改核心代码，将父节点的状态传递给成本计算函数。","https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fissues\u002F7",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},38962,"是否需要为每个世界资源（如每棵树、每个工作台）创建独立的动作实例？如何优化？","不一定需要为每个资源克隆动作实例。虽然示例中使用了单例或简单管理，但你可以通过动态设置动作的前置条件和效果来实现全局动作池。关键在于正确初始化动作的默认效果（Default Effects），即使动作尚未执行，也要明确其潜在的位置效应（如 isAtPosition），以便规划器识别该动作能满足特定的空间条件。可以使用可空类型（如 Vector3?）来优化内存，但需权衡性能开销。","https:\u002F\u002Fgithub.com\u002Fluxkun\u002FReGoap\u002Fissues\u002F3",{"id":136,"question_zh":137,"answer_zh":138,"source_url":134},38963,"为什么规划器有时会生成错误的计划，比如在不需要移动时省略 GoTo 动作？","这通常是因为动作的效果（Effects）没有正确重置或定义。如果前一个动作（如制作物品）没有明确清除或更新位置状态（isAtPosition），规划器可能会错误地认为代理仍然处于所需位置，从而跳过必要的移动步骤。解决方法是在动作的效果中显式处理位置状态，或者修改核心逻辑，确保每个动作的前置条件都被完整地添加到目标状态中进行反向搜索，强制规划器在位置不匹配时插入移动动作。",[140,145,150,155,160],{"id":141,"version":142,"summary_zh":143,"released_at":144},314901,"0.3.0","本版本与 0.2.0 不兼容，升级将导致您当前的项目无法正常运行。  \n- 添加了一个公开值，用于禁用或启用目标可达成时向规划器发送自动通知；  \n- 重构了 GoAP 动作，使其始终使用相同的结构“GoapActionStackData”；  \n- 修改了算法分支逻辑，以支持每个动作展开多个分支，ReGoapTests.TestDynamicAction 中提供了实现；  \n- 分支逻辑现通过 GetSettings 方法完成，该方法现在会返回一个动作；  \n- 将规划器设置中的最大迭代次数和最大扩展节点数的默认值均提高十倍；  \n- 移除了动作内部未使用的 GetGenericValues 方法；  \n- 移除了高级 GoAP 代理中的 Validate active action 方法；  \n- 新增了一个针对每个动作可有多重分支的动态动作测试，并附带相应的基准测试；  \n- 将示例 Unity 项目更新至最新版本的 Unity；  \n- 使用新的重构对示例 Unity 项目进行了更新。","2018-02-11T16:11:26",{"id":146,"version":147,"summary_zh":148,"released_at":149},314902,"0.2","- 将整个库泛型化（使状态值成为泛型，之前是 \u003Cstring, object>）\n- 修复了多处内存分配问题\n- 一些小的修复","2017-04-04T14:40:50",{"id":151,"version":152,"summary_zh":153,"released_at":154},314903,"0.1.2","0.1.2\n- 修复 Unity 状态机示例\n- 各种小修复\n\n0.1.1\n- 更新了内部搜索算法\n- 移除了对虚假前置条件的支持\n","2017-02-21T00:11:12",{"id":156,"version":157,"summary_zh":158,"released_at":159},314904,"0.1","新增了通用动作（请查看 FSMExample）和目标。\n成本和优先级现在为浮点数类型。\n","2016-12-22T23:27:10",{"id":161,"version":162,"summary_zh":163,"released_at":164},314905,"0","包含整个库、Unity 和通用版本，以及 Unity3D 的 FSM 示例。","2016-12-01T11:28:31"]