SuperAPI AI 工具集

unreal-development

编程与开发

查看项目

更新于 10-15 09:46

技能介绍

用途

Unreal Development 是一个 Unreal Engine 集成技能,面向 AI 辅助的游戏创作、编辑器自动化与项目管理。它提供与 Unreal Engine 项目交互的能力,涵盖 C++ 开发、Blueprint 视觉脚本、Actor 管理与构建自动化。在可用时,它借助 Unreal MCP 生态实现与编辑器的直接集成。

主要能力

项目管理

  • 创建与配置 Unreal 项目
  • 管理项目设置(Project Settings、DefaultEngine.ini 等)
  • 配置插件依赖
  • 为代码组织设置模块结构

C++ 开发

  • 生成带正确 UCLASS 宏的 Actor 与 Component 类
  • 创建支持反射的 UObject 子类
  • 实现接口(UInterface)
  • 编写自定义 Editor 模块
  • 使用 Automation Framework 生成单元测试

Blueprint 视觉脚本

  • 根据规格生成 Blueprint 类
  • 创建 Blueprint 函数库
  • 设计 Blueprint 接口
  • 构建可复用的 Blueprint 宏
  • 生成纯数据 Blueprint

Actor 与组件系统

  • 以程序化方式创建和修改 Actor
  • 设计组件层级
  • 实现 tick 与生命周期管理
  • 为多人游戏设置 Actor 复制

关卡设计

  • 创建和修改关卡
  • 放置 Actor 并配置属性
  • 设置关卡流送
  • 配置 World Partition 设置

构建系统

  • 为多平台配置构建设置
  • 使用 BuildGraph 创建构建脚本
  • 设置 CI/CD 流水线
  • 管理平台特定配置

使用方式

前置条件

  • Unreal Engine 5.0 或更高版本(推荐)
  • Visual Studio 2022,含 C++ 游戏开发工作负载
  • .NET 6.0 SDK(用于工具链)

MCP 服务器(推荐)

为实现与 Unreal Editor 的直接集成,可配置 MCP 服务器:

{
  "mcpServers": {
    "unreal": {
      "command": "python",
      "args": ["-m", "unreal_mcp"],
      "env": {
        "UNREAL_PROJECT_PATH": "/path/to/project.uproject"
      }
    }
  }
}

备选 MCP 服务器:

  • UnrealMCP (kvick-games) — 基于 TCP 服务器,使用 JSON 命令
  • unreal-mcp (chongdashu) — 自然语言控制
  • Unreal_mcp (ChiR24) — C++ Automation Bridge

可用 MCP 工具(通过 unreal-mcp)

工具 说明
unreal_spawn_actor 在关卡中生成 Actor
unreal_modify_actor 修改 Actor 属性
unreal_create_blueprint 生成 Blueprint 类
unreal_compile 触发热重载/编译
unreal_build 为目标平台构建
unreal_run_automation 执行自动化测试
unreal_query_level 获取关卡结构
unreal_python_exec 执行 Unreal Python 命令

配置示例

{
  "mcpServers": {
    "unreal": {
      "command": "python",
      "args": ["-m", "unreal_mcp"],
      "env": {
        "UNREAL_PROJECT_PATH": "C:/Projects/MyGame/MyGame.uproject",
        "UNREAL_ENGINE_PATH": "C:/Program Files/Epic Games/UE_5.3"
      }
    }
  }
}

与 Babysitter SDK 集成

可通过 defineTask 定义任务,将技能调用封装为任务:

const unrealActorTask = defineTask({
  name: 'unreal-actor-generation',
  description: 'Generate Unreal Engine Actor class',

  inputs: {
    actorType: { type: 'string', required: true }, // Character, Pawn, Actor
    className: { type: 'string', required: true },
    components: { type: 'array', required: true },
    outputPath: { type: 'string', required: true }
  },

  outputs: {
    headerPath: { type: 'string' },
    sourcePath: { type: 'string' },
    success: { type: 'boolean' }
  },

  async run(inputs, taskCtx) {
    return {
      kind: 'skill',
      title: `Generate Unreal Actor: ${inputs.className}`,
      skill: {
        name: 'unreal-development',
        context: {
          operation: 'generate_actor',
          actorType: inputs.actorType,
          className: inputs.className,
          components: inputs.components,
          outputPath: inputs.outputPath
        }
      },
      io: {
        inputJsonPath: `tasks/${taskCtx.effectId}/input.json`,
        outputJsonPath: `tasks/${taskCtx.effectId}/result.json`
      }
    };
  }
});

适用场景

  • 以程序化方式生成 Unreal 的 Actor、Component、UObject 与接口类
  • 根据规格生成 Blueprint 类、函数库、接口与宏
  • 在关卡中生成、修改 Actor 并查询关卡结构
  • 配置多平台构建、BuildGraph 脚本与 CI/CD 流水线
  • 通过 MCP 工具触发编译、构建与自动化测试
  • 在 Babysitter SDK 中定义并运行 Unreal 相关任务

最佳实践

  • UCLASS 宏:始终使用合适的说明符(BlueprintType、Blueprintable 等)
  • 属性说明符:正确使用 EditAnywhere/VisibleAnywhere 与 BlueprintReadWrite/BlueprintReadOnly
  • 复制:使用 UPROPERTY(Replicated) 标记需要复制的属性
  • 内存管理:使用 TObjectPtr 表示对象指针,避免裸指针
  • 模块:将代码组织为逻辑模块,并保持清晰的依赖关系
  • Tick 优化:仅在必要时启用 tick,周期性任务使用 Timers

平台注意事项

平台 关键考虑
PC 完整功能支持,shader model 5+
主机 内存预算、认证要求
移动端 简化渲染、热管理
VR 帧率要求、晕动症预防

限制

资料中未提供该技能的收费、价格、具体效果或完整使用步骤等信息,暂未提供。