在上一篇文章之后我进行了进一步测试,下面是结果。
测试结果
测试配置:
i7-8700 3.2Ghz 12线程
16GB内存
WDC PC SN730 SDBQNTY-256G-1001 固态硬盘
ST1000DM003-1SB102 机械硬盘
服务器配置:
Inter Xeon Silver 4114 2.2GHz (2处理器)40线程
64GB内存
引擎版本4.27.0 Release
网络:百兆网络
在上一篇文章之后我进行了进一步测试,下面是结果。
测试配置:
i7-8700 3.2Ghz 12线程
16GB内存
WDC PC SN730 SDBQNTY-256G-1001 固态硬盘
ST1000DM003-1SB102 机械硬盘
服务器配置:
Inter Xeon Silver 4114 2.2GHz (2处理器)40线程
64GB内存
引擎版本4.27.0 Release
网络:百兆网络
如果你有多台电脑或者服务器就可以使用FastBuild提高编译速度。虽然最后测试法线,i7-7700+一台几年前的e5 40核心服务器依然比不过今年买的枪神5笔记本。
如果你完全按照 https://zhuanlan.zhihu.com/p/158400394 的教程来操作,那你就被坑了。目前Fastbuild的最新版本与UE是不兼容的。很可能会出现寻找的目录与FastBuild创建的目录不一致的问题。以下是本人的log:
已启动生成…
1>------ 已启动生成: 项目: UE4, 配置: Development_Editor x64 ------
1>Building UE4Editor and ShaderCompileWorker...
1>Using Visual Studio 2019 14.29.30136 toolchain (D:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133) and Windows 10.0.19041.0 SDK (D:\Windows Kits\10).
1>Detected build type as Windows from 'D:\UnrealEngine\UnrealEngine4.27\Engine\Build\Windows\cl-filter\cl-filter.exe' using search term 'Windows'
1>Using path : {D:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC/Redist/MSVC\14.29.30133} for vccorlib_.dll (MSVC redist)...
1> ...Add an entry for MsvcCRTRedistVersion in BuildConfiguration.xml to specify a version number
1>FBuild Command Line Arguments: '-monitor -summary -dist -cacheread -ide -clean -config "D:\UnrealEngine\UnrealEngine4.27\Engine\Intermediate\Build\fbuild.bff" -nostoponerror
1>BFF file 'D:\UnrealEngine\UnrealEngine4.27\Engine\Intermediate\Build\fbuild.bff' has changed (reparsing will occur).
1>Using brokerage folder
1>No workers found in '\\DESKTOP-QI1GP15\FastBuildBroker\main\20.windows\'
1>No workers available - Distributed compilation disabled
上述问题是因为当前使用的FastBuild协议版本与UE4所需的不同造成的,所以你需要使用EPIC定制的FastBuild。本人使用Win10与UnrelEngine4.27.0源码版目前正确的操作步骤如下:
Engine\Extras\ThirdPartyNotUE\FASTBuild\Win64\下的FastBuild。指定一个不含用中文路径的目录。FBuild的文件夹,并将3个文件复制进去。这一步是可选步骤,是为了兼容FBDashboard.exe。你可以去FastBuild官网下载,并且指定目录下。(只需要复制FBDashboard.exe,放在FBuild外面)\\DESKTOP-QI1GP15\FastBuildBroker;Path变量添加FBuild.exe所在目录,之后在CMD中输入FBuild,运行后提示Failed to open BFF 'fbuild.bff'就代表添加成功了。Engine\Saved\UnrealBuildTool\BuildConfiguration.xml添加bAllowFASTBuild配置为true。比如这样:
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<bAllowFASTBuild>true</bAllowFASTBuild>
</BuildConfiguration>
</Configuration>
你很可能会遇到无法打开共享或是网络发现的功能,下面我分享以下解决方法。测试系统:win10、win2012 r2。
江湖小辈教程中使用FastBuild源码版是为了做测试以及通过修改源代码来实现通过Ip来代替计算机名来寻找共享。如果你想使用最新版本就需要修改FastBuild源码中的distributed protocol version。本人没有试过,但应该是这样没错。
对于团队来说添加DCC、Shader编译也许必须的,所以还可能修改UBT代码。但记住在修改完UBT代码后,需要重新编译UBT。
调试UBT的话,需要在UBT工程上右键-属性-调试页面中,将配置设为Debug,之后添加命行参数,之后在Debug模式下就可以命中断点了。编译UE4源码命令行如下:
UE4Editor Win64 Development -Quiet -WaitMutex -FromMsBuild
是一个名为BuildConfiguration.xml的xml文件,用于控制编译。除了可以在项目Config/UnrealBuildTool中添加外。UBT还会从以下位置(Windows系统)的XML配置文件读取设置:
除了上文中说到的bAllowFASTBuild外,因为本人使用附带git信息的引擎源码,编译时UBT会先去读取git信息,但因为源码git信息量太大,非常浪费时间。这里可以添加
<SourceFileWorkingSet>
<Provider>None</Provider>
<RepositoryPath></RepositoryPath>
<GitPath></GitPath>
</SourceFileWorkingSet>
起到让UBT禁用“使用 ‘git status’ 来确定AdaptiveUnityBuild。下面介绍一下其他参数,完整参数请去官方文档参考。
我在查看了AnswerHUB看到有人分享了自己的配置:
查阅代码之后发现,这些配置选项要去看 BuildConfigProperties.INT.udn 里的参数,ProcessorCountMultiplier 是在 ParallelExecutor 下的,所以改成以下配置:
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<ParallelExecutor>
<ProcessorCountMultiplier>7</ProcessorCountMultiplier>
<MaxProcessorCount>7</MaxProcessorCount>
<bStopCompilationAfterErrors>true</bStopCompilationAfterErrors>
</ParallelExecutor>
</Configuration>
目前我使用的完整配置:
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<ProcessorCountMultiplier>7</ProcessorCountMultiplier>
<MaxParallelActions>7</MaxParallelActions>
<bAllowParallelExecutor>true</bAllowParallelExecutor>
</BuildConfiguration>
<SNDBS>
<ProcessorCountMultiplier>4</ProcessorCountMultiplier>
<MaxProcessorCount>4</MaxProcessorCount>
</SNDBS>
<ParallelExecutor>
<ProcessorCountMultiplier>7</ProcessorCountMultiplier>
<MaxProcessorCount>7</MaxProcessorCount>
<bStopCompilationAfterErrors>true</bStopCompilationAfterErrors>
</ParallelExecutor>
</Configuration>