概述
在个人的Unrealengine账户中关联自己的GitHub账户成功之后,就可以访问UE4引擎的源码了。
git clone -b release https://github.com/EpicGames/UnrealEngine.git
克隆成功后,执行Setup.bat拉取并安装外部依赖文件(第三方库、资源包、示例工程等),最后调用UnrealVersionSelector添加引擎到注册表并在资源管理器中添加引擎快捷菜单功能
"%EngineDir%EngineBinariesWin64UnrealVersionSelector-Win64-Shipping.exe" /register
若需要设置代理可以传入相应参数来执行Setup.bat脚本 // Setup.bat会调用EngineBinariesDotNETGitDependencies.exe工具来获取依赖文件
Setup.bat --proxy="http://10.125.224.93:8082" --force --exclude=Win32
执行GenerateProjectFiles.bat生成UE4相关工程,生成的vs工程文件在EngineIntermediateProjectFiles目录中
双击UE4.sln,开始编译相关工具和引擎 // 编译的中间文件生成在EngineSourceEngineIntermediateBuild目录中
编译UnrealBuildTool
"C:WindowsMicrosoft.NETFramework64v4.0.30319msbuild.exe" "%EngineDir%EngineSourceProgramsUnrealBuildToolUnrealBuildTool.csproj" /t:build /p:Configuration=Development;Platform=AnyCPU;TargetFrameworkVersion=v4.5
编译引擎工具
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" ShaderCompileWorker Win64 Development -waitmutex -FromMsBuild -DEPLOY
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" UnrealLightmass Win64 Development -waitmutex -FromMsBuild -DEPLOY
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" UnrealIdentifierRegister Win64 Development -waitmutex -FromMsBuild -DEPLOY
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" UnrealVersionSelector Win64 Development -waitmutex -FromMsBuild -DEPLOY
使用UnrealVersionSelector添加引擎到注册表并在资源管理器上下文菜单中添加引擎快捷功能
"%EngineDir%EngineBinariesDotNETUnrealVersionSelector.exe" /register
1. 对uproject文件进行右键菜单注册
2. 注册uproject文件所用的引擎路径
编译引擎和项目
编译Development版本的UE4引擎 // 会在%EngineDir%BinariesWin64和%EngineDir%Plugins*···*BinariesWin64目录中生成引擎UE4Editor.exe、核心dll模块和引擎插件dll
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" UE4Editor Win64 Development -waitmutex -FromMsBuild -DEPLOY
生成项目MyGame的vs项目工程文件 // 工程文件会生成到"%GameDir%IntermediateProjectFiles"目录中
"%EngineDir%EngineBinariesWin64UnrealVersionSelector.exe" /projectfiles "%GameDir%MyGame.uproject"
编译项目MyGame项目的Development版本 // 会在%GameDir%BinariesWin64和%GameDir%Plugins*···*BinariesWin64目录中生成项目dll和项目插件dll
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" MyGameEditor Win64 Development "%GameDir%MyGame.uproject" -waitmutex -FromMsBuild -DEPLOY
编译单个c/cpp文件
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" MyGameEditor Win64 Development "%GameDir%MyGame.uproject" -singlefile="%GameDir%SourceMyGameMyGameCharacter.cpp" -WaitMutex -FromMsBuild -DEPLOY
编译单个模块
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" -Module=MyGame Win64 Development -TargetType=Editor -Project="%GameDir%MyGame.uproject" -canskiplink "%GameDir%MyGame.uproject"
编译单个引擎模块
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" -Module=Engine Win64 Development -TargetType=Editor -Project="%GameDir%MyGame.uproject" -canskiplink -nosharedpch "%GameDir%MyGame.uproject"
编译多个模块
"%EngineDir%EngineBinariesDotNETUnrealBuildTool.exe" -Module=MyCommon -Module=MyGame Win64 Development -TargetType=Editor -Project="%GameDir%MyGame.uproject" -canskiplink "%GameDir%MyGame.uproject"
一些技巧
(1)去掉UE4和游戏工程的所有Depends(工程右键菜单 -- Build Dependencies -- Project Dependencies ...),手动编译各个工程,防止修改一个工程后,引发依赖该工程发生重编译
(2)编译时不要用满所有cpu的核,否则计算机会非常卡,基本无法进行其他工作
在BuildConfiguration.xml中进行配置,将MaxProcessorCount设置成7(我本机是8核cpu)
7
BuildConfiguration.xml会按照下面路径的顺序来进行查找来加载 更多信息详见:Build Configuration
① 引擎工程:Engine/Saved/UnrealBuildTool/BuildConfiguration.xml
② /AppData/Roaming/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
③ /Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
(3)从vs直接运行或调试运行UE时,不要进行任何编译行为
运行引擎和项目
启动引擎编辑器
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe" -skipcompile
启动项目编辑器
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe" "%GameDir%MyGame.uproject" -skipcompile
单机启动游戏单机
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe" "%GameDir%MyGame.uproject" TestMap_Main -game -skipcompile
启动本地ds
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe" "%GameDir%MyGame.uproject" TestMap_Main -game -server -log -skipcompile
启动游戏并联网加入本地ds
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe" "%GameDir%MyGame.uproject" 127.0.0.1 -game -skipcompile
版本打包
① win64 -- Development版本包 会输出到%Win64Dir%WindowsNoEditor目录中
%EngineDir%EngineBuildBatchFilesRunUAT.bat -ScriptsForProject=%GameDir%MyGame.uproject BuildCookRun -project=%GameDir%MyGame.uproject -targetplatform=Win64 -clientconfig=Development -ue4exe=UE4Editor-Cmd.exe -noP4 -iterate -cook -pak -package -stage -archive -archivedirectory=%Win64Dir% -nocompileeditor -prereqs -nodebuginfo -build -CrashReporter -utf8output -compressed
② Android -- Debug版本包 会输出到%ApkDir%Android_ETC2目录中
%EngineDir%EngineBuildBatchFilesRunUAT.bat -ScriptsForProject=%GameDir%MyGame.uproject BuildCookRun -nocompileeditor -nop4 -iterate -project=%GameDir%MyGame.uproject -cook -stage -archive -archivedirectory=%ApkDir% -package -clientconfig=Debug -ue4exe=UE4Editor-Cmd.exe -compressed -pak -prereqs -nodebuginfo -targetplatform=Android -cookflavor=ETC2 -build -distribution -utf8output -compile
③ iOS -- Debug版本包 会输出到${IpaDir}/IOS目录中 注:设置DefaultGame.ini中[/Script/UnrealEd.ProjectPackagingSettings]标签下的BuildConfiguration=PPBC_Debug
${%EngineDir%}/Engine/Build/BatchFiles/RunUAT.sh -ScriptsForProject=${GameDir}/MyGame.uproject BuildCookRun -nocompileeditor -nop4 -project=${GameDir}/MyGame.uproject -cook -stage -archive -archivedirectory=${IpaDir} -package -clientconfig=Debug -ue4exe=UE4Editor -compressed -pak -prereqs -nodebuginfo -targetplatform=IOS -build -manifests -CrashReporter -utf8output -compile
④ Linux ds -- Debug版本包 会输出到${LinuxDir}目录中
${%EngineDir%}/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -project=${GameDir}/MyGame.uproject -build -cook -pak -stage -archive -archivedirectory=${LinuxDir} -package -serverconfig=Debug -server -noclient -targetplatform=Linux -ue4exe=UE4Editor -prereqs -nop4 -utf8output
其他
清理Development版本的UE4引擎
"%EngineDir%EngineBuildBatchFilesClean.bat" UE4Editor Win64 Development -waitmutex
清理Development版本的MyGame项目
"%EngineDir%EngineBuildBatchFilesClean.bat" MyGameEditor Win64 Development "%GameDir%MyGame.uproject" -waitmutex
为MyGame项目的TestMap_Main地图构建光照
"%EngineDir%EngineBuildBatchFilesRunUAT.bat" RebuildLightmaps -project=%GameDir%MyGame.uproject -MapsToRebuildLightMaps=TestMap_Main
关于解决方案的Configuration
1. Debug 游戏模块和引擎模块均开启调试模式
2. DebugGame 游戏模块开启调试模式,引擎模板开启优化
3. Development 游戏模块和引擎模块均开启优化
4. Shipping 发行版本(会去掉所有编辑器功能、stat统计以及GM命令等)游戏模块和引擎模块均开启优化
5. 带Editor表示为编辑器版本(含有很多编辑器相关的功能)
6. 带Client表示为客户端版本
7. 带Server表示为服务器版本
最后
以上就是乐观香菇为你收集整理的dot ue4_UE4游戏开发基础命令的全部内容,希望文章能够帮你解决dot ue4_UE4游戏开发基础命令所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复