How to create executable from engine ?

closed account (DEhqDjzh)
hi, I am working on a game engine project but I have a problem. In my game engine, there will 2 modes. Editor mode and play in editor mode(Like in unity). But In unity and other engines, you can build your project and get an only play mode executable. Let's say my engine directory is Engine_dir what I want to do is, engine creates an executable in Engine_dir\builds. How can I do that?
Note: I tried creating a bool releasemode but then players can change the bool with cheat engine and get the editor mode. and file size will be so big with engine integrated to the game.
Last edited on
You could define a macro and use preprocessor directives to only include code when the macro is defined, or not defined.

1
2
3
#ifdef RELEASE_MODE
	// code that you only want to use in release mode
#endif 
closed account (DEhqDjzh)
@Peter87 But let's say I wanted to add an enemy to my game, how can I open editor mode again?
You run the other executable. The one you built in not RELEASE_MODE
closed account (DEhqDjzh)
@Repeater is Adding macro causes to create other executable? I guess not. Then how to create second executable ?
I think you should research this on your own because this is a very basic concept.

You haven't even told us what IDE/makefile system you use, which is how you set these things, it really can't be that hard to google what are macros and how to put in a define them for 2 separate targets, and how to set the executable path in your IDE.
closed account (DEhqDjzh)
@poteto I use Windows 10 with visual studio 2017
It's trivially easy to add multiple projects to the same solution in VS2017, each of which builds a different executable.
Switching back and forth between different executable files might not be what you want. You could still have editor mode and normal mode in the same executable if you want, but when you are done with it and want to create the final product, you could just rebuild everything with the macro to disables the editor mode, or you might want to do the opposite, having a macro that enables the editor mode and not defining the macro disables it. It's up to you.
Last game engine I wrote for the fun of it, the game engine did not contain the game. The game engine consumed files that told it what to do and what images to load and so on. The editor was a separate program that generated those files.
closed account (DEhqDjzh)
Thank you all :)
Yeah, usually if you have a game engine it either loads DLLs (might be renamed to a different extension), has a virtual machine that executes code, or isn't a separate program at all. If you're looking to "make a game and levels then release only the final executable" then you'll do defines. If you're trying to make your own version of unity, you'll probably load DLLs, or if you want to make it cross platform, you'll probably make a virtual machine so that games don't have to constantly be cross compiled, but only your engine itself.
Topic archived. No new replies allowed.