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\$
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\$
  • \$\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 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\$ – Josh Sep 8 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 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.