Is there a tutorial for integrating engine source into your game solution?

I’m trying to get the engine source integrated into my game but I keep hitting issues with it. I’ve followed the Building Engine from Source guide and was able to successfully build the engine in the standalone UE5.sln but I cannot get it to work within my game solution. I get weird include errors that don’t occur when building standalone which indicates that there’s something going wrong in project generation.

Is there a guide somewhere that steps through this process? Everything I’ve been able to find are just regurgitated versions of the engine source guide. I’ve not found anything specifically talking about combining everything all together.

What’s this even mean?

You cannot integrate engine parts into a game and release it, it’s against the terms in most cases - you would be releasing a version of the engine (which I think you can if you really want to do so, with special permissions - but why?)

You can release stuff you build from the engine which you run locally.

Said engine (which you run locally) can either be the cookie cut trash epic releases or a version with fixes you make and build from source.

So what exactly are you attempting? Elaborate - and also some errors wouldnt hurt.

I’m going to explain what I actually want below, but it’s somewhat irrelevant to what I’m asking. The issue is that if I set my uproject engine version to point at my locally built engine source, I can no longer build my game source because it fails while building the engine source.

I have a directory named C:\UE5\MyGame. Inside of that directory is my uproject and all of my game source code. Within that directory, I have C:\UE5\MyGame\Engine. This directory contains the engine source code. This engine source has been registered to UnrealVersionSelector and my uproject has been updated to point to this source and I have regenerated the project files. When I open MyGame.sln in VS and build (either Build Solution or just building the game project) the compile fails. The exact failure depends on how I’m building but it fails either way.

The reason why someone would want to do this (among others) is so that you can make divergences to the engine specific to the game project.

Edit: Oh, and for a specific error, I get an include failure for LC_Hook.h when compiling Engine\Source\Developer\Windows\LiveCoding\Private\External\LC_Commands.h. There are a few others in some IOS file or something like that. I’m going from memory as I don’t want to have to re-set things up and wait the hour for the compile error to happen again.

It’s probably just a misunderstanding. They likely took your meaning to be that you wanted to integrate engine code into a non-Unreal game project.

You might look at Setting up an Unreal Engine Studio the Epic Way. It’s more geared towards source control than the issues that you’re having but it might still have some good details.

Specifically, the section on Project Folder Structure. The way you currently describe your folder structure isn’t an expected setup. There are two configurations that are intended. “Native” and “Foreign”. In a foreign setup, you’d have the source in a location “somewhere” and use the UnrealVersionSelector. In a native setup you don’t use the version selection and your game directory (uproject/source) is in a subdirectory of the Engine. The game then uses the engine that it’s a subdirectory of without being told what engine to use.

Your setup is a really weird hybrid of both and it’s possible it’s contributing to your build problems. I can only say that I first built my projects from source using the same page you originally linked to. At work we use a native configuration and at home I use a foreign one, so I’ve used both successfully.

I’m not sure you can use the MyGame.sln to build the game if you haven’t built the engine yet. With the native config, the UE5.sln contains the game project and you can build & run from there. But it’s a little confusing because UBT builds the project, not anything to do with the solution.

1 Like

Thanks. This is exactly what I was looking for. :slight_smile:

One thing you have to check is the length of the file path.

Seems likely you’ll have files that get blocked out by windows with the structure you have. Usually, I name the initial folder with a single character to avoid issues alltogether…

It’s not guaranteed to be the issue, but its something you ought to keep in mind anyway.

Also, I prefer this structure:

C:/X < master client folder

C:/X/E/ < custom engine for this

C:/X/P/ < Project folder for the project

When I need more projects (for the same client) I just go with other random letters.

This generally works without issues, unless you make issues by adding 300 nested sub directories into the project :winking_face_with_tongue: