虚幻4编译手记
虚幻4的源文件组织码相对与虚幻3个人感觉清楚了很多,明显是良心准备过的。编译非常简单,基本都是自动化一键生成的,去git下两个依赖文件(有个可选项,我没下),解压与源代码文件融合,运行根目录下的GenerateProjectFiles.bat文件1分钟以内就生成了一个sln解决方案文件,打开选择development Editor,直接build UE4即可,不需要其他的任何设置。编译时间会持续15到40分钟。编译完成后,直接调试就可以打开编辑器。
可选项:GenerateProjectFiles.bat默认会生成所有检测到SDK的平台的构建项目,使用-CurrentPlatform来仅生成当前平台的构建项目。
重要的一点:每次更新源代码后都要运行GenerateProjectFiles.bat,否则可能会无法编译。如果自己改动了模块(比如增删源文件),也要重新运行GenerateProjectFiles.bat。官方不推荐手动更改项目文件。也可以使用UnrealVS来重新生成项目当前加载项目的项目文件。
如果只是想使用学习UE4的话,推荐还是使用官方编译好的编辑器,以防止出现一些无解的问题。
记录几个我在windows上构建时遇到的几个小细节。
1、依赖包的正确融合
2、保持磁盘空间在15G以上
3、生成完成后如果在编译DefaultDeferredDecalMaterial时候自动退出,注销系统再启动即可。(具体原因不是很清楚,可能是因为某些程序被长期占用的缘故。)
但是需要注意的是:
使用Development Editor编译出来的编辑器在我的电脑上经常出现打包问题,因该是从来没有打包成功过,而且打包过程相当缓慢。最后打包失败似乎还是因为编译DefaultDeferredDecalMaterial失败。
没有仔细读过官方文档,具体问题原因还不知道,希望知道答案的人赐教。
log如下:
Log file open, 03/22/14 11:27:34
LogInit:Display: Running engine without a game
LogInit: Version: 4.0.1-0+UE4
LogInit: Compiled (64-bit): Mar 22 2014 05:19:06
LogInit: Build Configuration: Development
LogInit: Branch Name: UE4
LogInit: Command line:
LogInit: Base directory: D:/UnrealEngine4/Engine/Binaries/Win64/
[2014.03.22-23.27.34:166][ 0]LogTaskGraph: Started task graph with 3 named threads and 4 total threads.
[2014.03.22-23.27.34:243][ 0]LogOnline:Warning: No default platform service specified for OnlineSubsystem
[2014.03.22-23.27.34:425][ 0]LogInit: Presizing for 0 objects not considered by GC, pre-allocating 0 bytes.
[2014.03.22-23.27.34:629][ 0]LogInit: Object subsystem initialized
[2014.03.22-23.27.34:710][ 0]LogInit: Selected Device Profile: [Windows]
[2014.03.22-23.27.34:721][ 0]LogInit: Applying CVar settings loaded from the selected device profile: [Windows]
[2014.03.22-23.27.34:813][ 0]LogInit: Computer: WUBUGUI-PC
[2014.03.22-23.27.34:813][ 0]LogInit: User: wubugui
[2014.03.22-23.27.34:816][ 0]LogInit: CPU Page size=4096, Cores=4
[2014.03.22-23.27.34:816][ 0]LogInit: High frequency timer resolution =2.046191 MHz
[2014.03.22-23.27.34:816][ 0]LogInit: Memory total: Physical=7.9GB (8GB approx) Pagefile=8184.1GB Virtual=8192.0GB
[2014.03.22-23.27.34:915][ 0]LogD3D11RHI: Found D3D11 adapter 0: Intel(R) HD Graphics 4000 (Feature Level 11_0)
[2014.03.22-23.27.34:915][ 0]LogD3D11RHI: Adapter has 2094MB of dedicated video memory, 0MB of dedicated system memory, and 3777MB of shared system memory
[2014.03.22-23.27.34:956][ 0]LogRHI: Texture pool is 1361 MB (70% of 1945 MB)
[2014.03.22-23.27.34:978][ 0]LogD3D11RHI: Async texture creation enabled
[2014.03.22-23.27.36:101][ 0]LogContentStreaming: Texture pool size is 0.000000MB
[2014.03.22-23.27.36:327][ 0]LogInit: WinSock: version 1.1 (2.2), MaxSocks=32767, MaxUdp=65467
[2014.03.22-23.27.39:854][ 0]LogTargetPlatformManager:Display: Building Assets For Windows
[2014.03.22-23.27.40:131][ 0]LogTargetPlatformManager:Display: Building Assets For Windows
[2014.03.22-23.27.40:226][ 0]LogDerivedDataCache:Display: Max Cache Size: 512 MB[2014.03.22-23.27.40:226][ 0]LogDerivedDataCache:Warning: Could not find memory cache ../../../Engine/DerivedDataCache/Boot.ddc.
[2014.03.22-23.27.40:226][ 0]LogDerivedDataCache:Warning: Could not load Boot cache: ../../../Engine/DerivedDataCache/Boot.ddc
[2014.03.22-23.27.40:226][ 0]LogDerivedDataCache: FDerivedDataBackendGraph: Pak pak cache file ../../../Engine/DerivedDataCache/DDC.ddp not found, will not use a pak cache.
[2014.03.22-23.27.40:226][ 0]LogDerivedDataCache: Unable to find inner node Pak for hierarchical cache Hierarchy.
[2014.03.22-23.27.40:226][ 0]LogDerivedDataCache: FDerivedDataBackendGraph: EnginePak pak cache file ../../../Engine/DerivedDataCache/DDC.ddp not found, will not use a pak cache.
[2014.03.22-23.27.40:226][ 0]LogDerivedDataCache: Unable to find inner node EnginePak for hierarchical cache Hierarchy.
[2014.03.22-23.27.40:238][ 0]LogDerivedDataCache: Using Local data cache path ../../../Engine/DerivedDataCache: Writable
[2014.03.22-23.27.45:492][ 0]LogDerivedDataCache:Warning: Fail to write to //epicgames.net/root/UE4DDC, derived data cache to this directory will be read only.
[2014.03.22-23.27.45:493][ 0]LogDerivedDataCache:Warning: Shared data cache path was not usable, will not use it.
[2014.03.22-23.27.45:493][ 0]LogDerivedDataCache: Unable to find inner node Shared for hierarchical cache Hierarchy.
[2014.03.22-23.27.55:507][ 0]LogTexture:Display: c(匉4? Bad (BGRA8)
[2014.03.22-23.27.55:536][ 0]LogTexture:Display: c(匉4? Bkgnd (AutoDXT)
[2014.03.22-23.27.55:572][ 0]LogTexture:Display: c(匉4? BkgndHi (AutoDXT)
[2014.03.22-23.27.55:970][ 0]LogMeshUtilities: No automatic mesh reduction module available
[2014.03.22-23.27.55:970][ 0]LogMeshUtilities: No automatic mesh merging module available
[2014.03.22-23.27.55:971][ 0]LogStaticMesh: c(匉YQ<EditorCube...
[2014.03.22-23.27.56:044][ 0]LogStaticMesh: Built static mesh [126.306877ms] /Engine/EditorMeshes/EditorCube.EditorCube
[2014.03.22-23.27.56:243][ 0]LogStaticMesh: c(匉YQ<EditorSphere...
[2014.03.22-23.27.56:383][ 0]LogStaticMesh: Built static mesh [140.656464ms] /Engine/EditorMeshes/EditorSphere.EditorSphere
[2014.03.22-23.27.56:473][ 0]LogStaticMesh: c(匉YQ<EditorPlane...
[2014.03.22-23.27.56:474][ 0]LogStaticMesh: Built static mesh [0.686642ms] /Engine/EditorMeshes/EditorPlane.EditorPlane
[2014.03.22-23.27.56:506][ 0]LogStaticMesh: c(匉YQ<EditorCylinder...
[2014.03.22-23.27.56:520][ 0]LogStaticMesh: Built static mesh [13.810538ms] /Engine/EditorMeshes/EditorCylinder.EditorCylinder
[2014.03.22-23.27.56:612][ 0]LogTexture:Display: c(匉4? Texture2D_28 (AutoDXT)
[2014.03.22-23.27.56:733][ 0]LogTexture:Display: c(匉4? Default (BGRA8)
[2014.03.22-23.27.57:195][ 0]LogTexture:Display: c(匉4? T_Default_Material_Grid_M (AutoDXT)
[2014.03.22-23.27.57:563][ 0]LogTexture:Display: c(匉4? T_Default_Material_Grid_N (BC5)
[2014.03.22-23.27.57:678][ 0]LogTexture:Display: c(匉4? DefaultDiffuse (AutoDXT)
[2014.03.22-23.27.59:443][ 0]LogMaterial: Missing cached shader map for material WorldGridMaterial, compiling.
[2014.03.22-23.28.54:361][ 0]LogMaterial: Missing cached shader map for material DefaultDeferredDecalMaterial, compiling.
[2014.03.22-23.28.54:967][ 0]LogShaderCompilers:Warning: warning: Unknown encoding: zh_CN[2014.03.22-23.28.54:967][ 0]LogWindows:Error: appError called: Failed to compile default material /Engine/EngineMaterials/DefaultDeferredDecalMaterial.DefaultDeferredDecalMaterial!
[2014.03.22-23.28.54:967][ 0]LogWindows:Error: Windows GetLastError: 蚛煂 (0)
[2014.03.22-23.29.58:660][ 0]LogWindows: === Critical error: ===