0
\$\begingroup\$

I've been wanting to make a small game engine (relatively. basic features, predefined shaders) to learn that side of game development and I was wondering how game engines export projects to create executables.

I would imagine that they copy over all the necessary code and remove the editor from the code base. Or perhaps they are engineered in a way that completely abstracts the game code and the editor code?

If someone could explain the pipeline of how they export the game, I can do the rest of the research and experimentation myself.

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

The details vary widely, especially with the style of language (compiles versus interpreted, for example) and runtimes (native versus, say, browser-based).

However the basic strokes are generally what you surmised. The editor executable for an engine generally knows how to recompile/repackage/et cetera the engine code to exclude the editor bits and alter the code flow so the user’s game is loaded at startup instead of the editor. Unreal, for example, can do this by running the platform specific compiler tools to rebuild the engine without WITH_EDITOR defined, making all the editor code compile out.

You can also distribute your engine as a sort of stub executable that just loads modules from DLLs, have it load the editor DLL by default, but when exporting a game make a copy of the executable (and data files), exclude the editor DLL, and include a config file that tells the executable to load to game DLL instead.

\$\endgroup\$
3
  • \$\begingroup\$ So Unreal uses preprocessor definitions sounds like? I was planning on using that route since I don't want to do too much work. Just use preprocessor definitions to determine whether or not the editor (which uses ImGui) is included. Thank you! \$\endgroup\$
    – Sammi3
    Sep 8, 2019 at 19:56
  • \$\begingroup\$ Unreal's solution is quite a bit more involved than just preprocessor definitions, but they are certainly a part of the solution, yea. And for your own work, they can be enough. \$\endgroup\$
    – user1430
    Sep 8, 2019 at 19:58
  • \$\begingroup\$ Yeah I can imagine that they do a lot since the editor can recompile itself. Thanks for the help! \$\endgroup\$
    – Sammi3
    Sep 8, 2019 at 21:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .