I’d like to distribute custom-built editor binaries to our team through perforce. We’re already used to a workflow where non-programmers get the latest source from perforce and recompile from inside the editor (we have fast computers but remote and sometimes slow internet connections, so build time is preferable to sync time for changes to the game project which are frequent). We’ve been using engine builds from the launcher up until this point and this has been working well, but I’d like to start incorporating some custom engine changes.
I’ve added the UE4 source to our perforce depot and can build locally fine with engine changes, and now I’m attempting to add those engine binaries to perforce for the rest of the team to use (for infrequent editor changes, the sync time is preferable to the build time/complexity to us). I’m doing the build locally with the BuildEditorAndTool BuildGraph script (“Copy to Staging Directory” target), and when I copy those binaries into a freshly synced test copy of the depot, I can open the editor successfully with our changes. When I try to open our game project though and accept the dialog asking to rebuild game binaries, I get the error: “Engine modules are out of date, and cannot be compiled while the engine is running. Please build through your IDE.” Looking at build logs it seems that triggering a rebuild of the game project is also attempting to rebuild the entire engine.
My best guess is this is a versioning issue, so I’ve confirmed that the BuildEditorAndTool script is successfully updating Build.version & MetaData.cs with the current p4 changelist (and marking it as a licensee and promoted build, which seems correct from what I’ve read), and that all of the .module and .version files in my test directory have matching changelist info. I’ve read the docs on versioning and distributing the editor (and the very helpful response at https://answers.unrealengine.com/questions/517755/view.html ), but I’m not sure what else to try. Are there any other versioning details I’m missing? Is it expected that building game project binaries for the first time would also require building editor binaries to match?
(I’m open to using UGS in the future, but it’s not something I was planning on setting up now for our small team. If that would solve my problem I’m open to that route, but since I’m using the same build graph script recommended for UGS use, I’m not certain it would solve my issue either.)
I was able to get this to work by using the “Installed Build” BuildGraph script instead, modifying the script at Engine/Build/InstalledEngineBuild.xml. This does two important things:
Creates an empty text file at Engine/Build/InstalledBuild.txt, which indicates to UnrealBuildTool that the engine binaries don’t need to be recompiled (this was the primary fix to my question above). Programmers can then delete this text file if they’re making engine changes locally.
Copies all relevant binary and intermediate files to a LocalBuilds folder (from this I take only the Binaries, Build, Intermediate and Plugins folders, exclude the .pdb files, and zip them up to submit to perforce; total zip size is 1.7 GB)
This gives me the workflow we were looking for; for first time setup, team members sync the game and engine source from perforce (I believe the engine files are around 1-2 GB), unzip the built binaries zip (only for non-programmers, programmers can just build these), run Setup.bat to download other binary files from Epic (images, language files, etc.), then run GenerateProjectFiles to create the .sln. Steps 2-4 can be automated with some simple .bat files so non-programmers on the team can get set up quickly.
A few other thoughts/gotchas:
Building the .p4ignore is important; you want to include all files from the Unreal source git repo, but not include any of the files downloaded through Setup.bat (if you’re worried about perforce space & sync time as we were)
Add to the ignore file anything that goes into the built binaries zip file (including the InstalledBuilt.txt file, otherwise non-programmers may check this in and mess up other workflows)
Zipping the built engine binaries can be automated and added to the InstalledEngineBuild.xml, see BuildEditorAndTool.xml for an example and use InstalledEngineFilters.xml to exclude files/folders. This makes updating the engine binaries easy for programmers, since it’s then just one script to run and a single zip to check into perforce.
The BuildEditorAndTool script I was initially using didn’t include all necessary files in the Intermediate folder (e.g. it didn’t include *.generated.h files, which are not necessary if you are distributing game and engine binaries together to team members, but are if team members need to compile game binaries themselves with pre-built engine binaries)
Using this workflow we’re no longer updating versioning info as described in my initial question; if we start changing any data layouts in the Editor, I believe we’ll have to revisit the versioning question