Relationship between UE4 and MyGame projects

Hello, everyone!

I’m trying to wrap my mind around how the projects interact (more specifically, how the UE4 project interacts with my custom MyGame project).

Here’s what I do:

  • Set MyGame as the startup project in VS 2013 Community Edition
  • Set build configuration to Development Editor (and platform to Win64)
  • Start debugging using the following command line (it added the variables on its own): “$(SolutionDir)$(ProjectName).uproject” -game

It builds for a while, and then the game finally launches. What I’ve noticed is that in VS, it says “Process: UE4Editor.exe”, not “MyGameEditor.exe” as I would have expected. What’s more, when I go to MyGame/Binaries/Win64, there’s no .exe file in there, just a .dll.

So here are my questions: Why is this? Why hasn’t it made an executable in my game’s Binaries folder, and why does it use the engine?

Another question that might be related is: I’ve looked at my solution explorer, and for some reason I have 39 projects there. I’ve seen a few screenshots of other people’s solution explorers, and it’s typically only contained their game project(s). Mine looks something like this, and I have no idea why:

[Solution root]
. . Engine
. . . . UE4
. . Games
. . . . MyGame
. . Programs
. . . . <All other projects in engine, it seems>

Any help will be much appreciated :slight_smile:

Hello ThomassKasene,

Okay I’m not a Epic Dev but I’ve been using UE4 from launch. A bit of terminology to keep things straight. UE4 basically has 3 high level screens. The Editor launcher which is kind of like your master hub for all the games you are building. From the Editor Launcher you can create a new game or select one you have already built and launch that game’s editor. Finally you have the game itself. There are two methods to using UE4. You can build it from source if you plan on making fundamental alterations directly to the game engine or plan on contributing to the development and improvements of the foundational Game engine itself. Or you can use the installer if you plan on just building a game and/or adding new tools for your game(s).

I maybe wrong on this… but It sounds like you have setup the engine from source rather than the installer, which maybe why you are seeing the 39 project files that make up the UE4 Engine and editor. I believe there is a configuration value that you can set to not display the UE4 directories when you are working on your game.

Okay as for the relationship… Again I am not a dev but my observations follow. For both the Source Built editor and the installed editor you can use C++. You install or create the editor in the directory you choose. Then when you create a new game, it is created in it’s own separate directory (usually under your documents folder). All source code and game assets are kept in this separate folder (if you are used to UDK this is quite different from what you are used to). In General UE4 utilizes and compiles to dlls (or other types of code libararies) it calls editor or game modules. Now every project has one or more editor and game module that it loads when you launch that game’s editor. The Editor modules allows the editor to load up the code you have written and work with it directly in the editor so you can create blueprints and instantiate custom actors or pretty much do ANY thing you want even TO the editor itself (just for that game). A Game Module is used by your game to run the custom code you have written to play the game. From your point of view as a developer you write one code base and UE4 handles the rest.

So why doe sit say UE4Editor.exe? If you are building from source as I suspect it is because you are building the BASE game engine, hense UE4Editor.

Why is there no executable in your binary folder? I actually do not know this one, My guess is that if you are using the editor from source you are only building the UE4 Base Editor and not YOUR game’s editor or game for that matter. From Visual Studio, launch the editor “Build->Start Without Debugging” and that will launch your editor. Then from your built editor create your game project. If you already have a game, you want to ONLY open up that game’s Visual Studio file from it’s directory (usually found under your documents/UE4/MyProject). Build that, “Start Without Debugging” and start adding code.

As a final note… The C++ code you write is not exactly the C++ code that runs. To facilitate the development UE4 utilizes a build Tool that basically reads your code, processes it into some Reflection Objects, stub functions for Blueprints and Replication and THEN Creates and links the object files to create the dll. Basically there is a tiny bit of magic between pushing the compile button and running the game or editor.

if absolutely NONE of this helped lol try these areas of documentation :slight_smile:

Documentation - Development Setup - General for working with the Engine using Visual Studio. How to Setup, How to create classes from the editor. Took me a while to get all this…

Coding Standard - this is VERY IMPORTANT to know if you are working with C++. The reason is not for your own coding standard but IMMENSELY helps to understand the engine as a whole and at a glanse as each class is prefixed with a letter to denote what it’s most important base class is or general type. This is important because the Build tool uses these prefixes and will error if they are not correct.

Documentation - Game Modules - general overview on what game modules are.

Introduction to UE4 Plugins - nice overview of UE4 Plugins (which are actually a type of module and you can use to create your own secondary game or editor modules).

Your game’s code is consisting of plugin modules to the Unreal Engine, hence when you build the Editor you get DLL’s containing these modules, to be loaded by the editor process. When you build a shipping game the Unreal Engine modules and the game modules are statically linked together to form YourGame.exe.

There is no executable in the binaries folder because you built the editor target for your game. In order to enable the engine to easily use different projects without having to recompile an editor executable for each of them, UE4 creates an editor module instead of an executable. Then, when you run the editor and choose your project, that module is simply loaded and execution continues normally.

If you build the game target (no suffix, like “Development” instead of “Development Editor”), then you will get an executable for your game. However, this standalone executable also requires cooked data, which you either manually cook or provide using cook on-the-fly through the frontend or editor. In any event, it’s not as fast for iterating as running the editor, so you’ll be spending most of your time building and debugging the editor.

This could be a bit misleading so I want to add – the code you write is the code that runs. Some added code is generated by the header tool, but it won’t touch your own functionality. The closest thing to modifying the code is the automatically generated thunks added by some function tags, which will merely ask you to implement your function with a suffix (i.e.: _Implementation) that is called by the generated thunk.

Thanks for the replies, everyone! I think I’m starting to grasp it a bit more. However, I have a few more questions:

What is the purpose of the build configurations suffixed with either Client or Server? Will I ever be able to build one of those and run them with uncooked content?

Is there any way I can run my game’s executable with uncooked content, or does uncooked content imply I have to run through UE4Editor.exe with the -game flag?

If I wanted to bundle the editor with my shipped game, how would I go about doing this? (I realise this is slightly off-topic)

Again, thanks for all the answers!

You cannot ship any binaries containing editor code according to the license you got. Read the EULA, its not complicated to figure out what parts are for redistribution and what is not to include. So if you want an editable experience you have to provide all means to that by yourself and you’d have to make sure you are not violating the license (you cannot, f.e., allow ppl to create different games with your own editor tools afaik).

For Question number One… I’m not sure except that they maybe methods to build the dedicated server version of your game and the client that connects to it.

Question Number 2 - also… a good question. I’ve never tried it. Honestly the only reason I can think to do this is if you are trying to create a method for users to create their own custom content (like mods).

Question Number 3 - Again going back to the Custom Content idea. The answer is a big giant NO as that is completely against the licensing of UE4 (at least the 20 dollar version). To accomplish a mod tools editor you will have to build a mod tools editor using the engine just as you would build a game. I have seen this done by other teams.

Alright, thanks again everyone, I think that’s enough info to get me started! :slight_smile: