UE4游戏开发基础命令
在個人的Unrealengine賬戶中關(guān)聯(lián)自己的GitHub賬戶成功之后,就可以訪問UE4引擎的源碼了。
git clone -b release https://github.com/EpicGames/UnrealEngine.git克隆成功后,執(zhí)行Setup.bat拉取并安裝外部依賴文件(第三方庫、資源包、示例工程等),最后調(diào)用UnrealVersionSelector添加引擎到注冊表并在資源管理器中添加引擎快捷菜單功能
"%EngineDir%\Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe" /register若需要設置代理可以傳入相應參數(shù)來執(zhí)行Setup.bat腳本?// Setup.bat會調(diào)用Engine\Binaries\DotNET\GitDependencies.exe工具來獲取依賴文件
Setup.bat --proxy="http://10.125.224.93:8082" --force --exclude=Win32注:如果是UE4.22版本,需要安裝.net?framework?4.6.2,安裝完后在控制面板卸載列表中會有如下軟件列表:
執(zhí)行GenerateProjectFiles.bat生成UE4相關(guān)工程,生成的vs工程文件在Engine\Intermediate\ProjectFiles目錄中
雙擊UE4.sln,開始編譯相關(guān)工具和引擎? // 編譯的中間文件生成在EngineSource\Engine\Intermediate\Build目錄中
?
編譯UnrealBuildTool
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe" "%EngineDir%\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj" /t:build /p:Configuration=Development;Platform=AnyCPU;TargetFrameworkVersion=v4.5?
編譯引擎工具
"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" ShaderCompileWorker Win64 Development -waitmutex -FromMsBuild -DEPLOY"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" UnrealLightmass Win64 Development -waitmutex -FromMsBuild -DEPLOY"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" UnrealIdentifierRegister Win64 Development -waitmutex -FromMsBuild -DEPLOY"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" UnrealVersionSelector Win64 Development -waitmutex -FromMsBuild -DEPLOY?
使用UnrealVersionSelector添加引擎到注冊表并在資源管理器上下文菜單中添加引擎快捷功能
"%EngineDir%\Engine\Binaries\DotNET\UnrealVersionSelector.exe" /register1. 對uproject文件進行右鍵菜單注冊
2. 注冊uproject文件所用的引擎路徑
?
編譯引擎和項目
編譯Development版本的UE4引擎??// 會在%EngineDir%\Binaries\Win64和%EngineDir%\Plugins\*\···\*\Binaries\Win64目錄中生成引擎UE4Editor.exe、核心dll模塊和引擎插件dll
"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" UE4Editor Win64 Development -waitmutex -FromMsBuild -DEPLOY生成項目MyGame的vs項目工程文件? // 工程文件會生成到"%GameDir%\Intermediate\ProjectFiles"目錄中
"%EngineDir%\Engine\Binaries\Win64\UnrealVersionSelector.exe" /projectfiles "%GameDir%\MyGame.uproject"編譯項目MyGame項目的Development版本? // 會在%GameDir%\Binaries\Win64和%GameDir%\Plugins\*\···\*\Binaries\Win64目錄中生成項目dll和項目插件dll
"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" MyGameEditor Win64 Development "%GameDir%\MyGame.uproject" -waitmutex -FromMsBuild -DEPLOY編譯單個c/cpp文件
"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" MyGameEditor Win64 Development "%GameDir%\MyGame.uproject" -singlefile="%GameDir%\Source\MyGame\MyGameCharacter.cpp" -WaitMutex -FromMsBuild -DEPLOY編譯單個模塊
"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" -Module=MyGame Win64 Development -TargetType=Editor -Project="%GameDir%\MyGame.uproject" -canskiplink "%GameDir%\MyGame.uproject"編譯單個引擎模塊
"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" -Module=Engine Win64 Development -TargetType=Editor -Project="%GameDir%\MyGame.uproject" -canskiplink -nosharedpch "%GameDir%\MyGame.uproject"?
編譯多個模塊?
"%EngineDir%\Engine\Binaries\DotNET\UnrealBuildTool.exe" -Module=MyCommon -Module=MyGame Win64 Development -TargetType=Editor -Project="%GameDir%\MyGame.uproject" -canskiplink "%GameDir%\MyGame.uproject"??
一些技巧
(1)去掉UE4和游戲工程的所有Depends(工程右鍵菜單 -- Build Dependencies -- Project Dependencies ...),手動編譯各個工程,防止修改一個工程后,引發(fā)依賴該工程發(fā)生重編譯
(2)編譯時不要用滿所有cpu的核,否則計算機會非常卡,基本無法進行其他工作
? ?在BuildConfiguration.xml中進行配置,將MaxProcessorCount設置成7(我本機是8核cpu)
<?xml version="1.0" encoding="utf-8" ?><Configuration xmlns="https://www.unrealengine.com/BuildConfiguration"><ParallelExecutor><MaxProcessorCount>7</MaxProcessorCount></ParallelExecutor></Configuration>??BuildConfiguration.xml會按照下面路徑的順序來進行查找來加載? ?更多信息詳見:Build Configuration
? ① 引擎工程:Engine/Saved/UnrealBuildTool/BuildConfiguration.xml
? ② <User Folder>/AppData/Roaming/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
? ③ <My Documents>/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml
(3)從vs直接運行或調(diào)試運行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啟動游戲并聯(lián)網(wǎng)加入本地ds
"%EngineDir%/Engine/Binaries/Win64/UE4Editor.exe" "%GameDir%\MyGame.uproject" 127.0.0.1 -game -skipcompile?
版本打包
① win64 -- Development版本包? 會輸出到%Win64Dir%\WindowsNoEditor目錄中
%EngineDir%\Engine\Build\BatchFiles\RunUAT.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目錄中? ? windows下安裝Android構(gòu)建環(huán)境
%EngineDir%\Engine\Build\BatchFiles\RunUAT.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%\Engine\Build\BatchFiles\Clean.bat" UE4Editor Win64 Development -waitmutex清理Development版本的MyGame項目
"%EngineDir%\Engine\Build\BatchFiles\Clean.bat" MyGameEditor Win64 Development "%GameDir%\MyGame.uproject" -waitmutex為MyGame項目的TestMap_Main地圖構(gòu)建光照
"%EngineDir%\Engine\Build\BatchFiles\RunUAT.bat" RebuildLightmaps -project=%GameDir%\MyGame.uproject -MapsToRebuildLightMaps=TestMap_Main?
找不到XINPUT1_3.dll
安裝引擎目錄下Engine\Extras\Redist\en-us\UE4PrereqSetup_x64.exe
?
關(guān)于解決方案的Configuration
?
1. Debug 游戲模塊和引擎模塊均開啟調(diào)試模式
2. DebugGame? 游戲模塊開啟調(diào)試模式,引擎模板開啟優(yōu)化
3. Development? 游戲模塊和引擎模塊均開啟優(yōu)化
4. Shipping 發(fā)行版本(會去掉所有編輯器功能、stat統(tǒng)計以及GM命令等)游戲模塊和引擎模塊均開啟優(yōu)化
5. 帶Editor表示為編輯器版本(含有很多編輯器相關(guān)的功能)
6. 帶Client表示為客戶端版本
7. 帶Server表示為服務器版本
?
轉(zhuǎn)載于:https://www.cnblogs.com/kekec/p/8684068.html
總結(jié)
以上是生活随笔為你收集整理的UE4游戏开发基础命令的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: nodejs(6)express学习
- 下一篇: LOJ-10096(强连通+bfs)