构建 ThirdPersonMP 示例项目
本文介绍如何使用 Unreal ThirdPersonMP 示例作为模板项目,成功构建一个与 PlayFab Multiplayer 兼容的 Unreal 项目。本指南将提供后续步骤所需的所有构建配置,用于测试和验证您的 Unreal 项目。本页没有特殊的 GSDK 步骤,只涵盖对本示例有用的一组特定 Unreal 构建说明。目标
- 构建 “Development Editor”
- 构建游戏客户端
- 构建 “Development Server”
- 构建发布服务器
要求
- 下载 Visual Studio。社区版 是免费的。
- 必需的工作负载:.NET desktop development 和 Desktop development with C++
- 下载 Unreal Engine 源代码。有关说明,请参阅 Downloading Unreal Engine Source code (external)。
- 已完成的 Unreal 项目,并已安装和配置 PlayFab Unreal GSDK
- 了解 Unreal Build Configuration 选项
说明
GSDK 设置 指南先前描述了”切换 Unreal Engine 版本”和”生成 Visual Studio 项目文件”的步骤。还有一份关于各种编译选项的 Unreal 指南,您应该查阅。Development Editor
Development editor 应该是您首先构建的内容。为此,找到您的{ProjectName}.uproject 文件,右键单击并选择”Generate Visual Studio project files”(您可能已在上一指南中完成此操作,如果是这样,可跳过此步骤)。完成后,您可以在 Visual Studio 中打开 {ProjectName}.sln。
Visual Studio 加载后,将配置更改为 “Development Server”。Solution Configuration 下拉菜单有时难以阅读,但可以在工具栏自定义选项中调整大小。现在开始构建。第一次执行此操作可能需要几小时,但您可能在上一指南中已经完成。对于小型项目,重复构建应相当快。完成后,您可以运行/调试项目 Solution/Games/ThirdPersonMP,这将启动 Development Editor。
构建 Shipping Client
运行 Development Editor。在开发编辑器窗口中,按以下顺序选择这些选项:- File -> Package Project -> Build Target -> ThirdPersonMP(或您的项目名称)
- File -> Package Project -> Build Configuration -> Development
- File -> Package Project -> Windows (64-bit)
- (这将打开一个弹出窗口要求您选择位置——请务必记住此位置)
- 第一次以此配置进行打包可能需要一段时间
- 即使您已构建过 Development Editor,第一次 shipping client 构建也可能需要长达数小时
- 对于 ThirdPersonMP 这样的简单项目,重复构建会快得多
- 打开您选择的客户端位置,找到 ThirdPersonMP.exe
构建 Development Server
- 关闭 Development Editor(Unreal 不再运行,只有 Visual Studio 应处于打开状态)
- Toolbars -> Configuration -> “Development Server”
- Build/Rebuild Solution
- 第一次以此配置进行打包可能需要一段时间
- 即使您已构建过 Development Editor,第一次 development server 构建也可能需要长达数小时
- 对于 ThirdPersonMP 这样的简单项目,重复构建会快得多
- 使用资源管理器找到 {projectLocation}\Binaries\Win64\ThirdPersonMPServer.exe
构建 Shipping Server
运行 Development Editor。在开发编辑器窗口中,按以下顺序选择这些选项:- File -> Package Project -> Build Target -> ThirdPersonMPServer(或您的项目名称)+Server
- File -> Package Project -> Build Configuration -> Development
- File -> Package Project -> Windows (64-bit)
- (这将打开一个弹出窗口要求您选择位置——请务必记住此位置)
- 第一次以此配置进行打包可能需要一段时间
- 即使您已构建过 Development Editor,第一次 shipping server 构建也可能需要长达数小时
- 对于 ThirdPersonMP 这样的简单项目,重复构建会快得多
- 打开您选择的服务器位置,找到 ThirdPersonMPServer.exe
