Build profiles?

I’m asking this to see if I’m in the right “mindset” for how to use Defold. I definitely want some way to branch my code depending on a “build profile” but perhaps some of the nuance of the way I want to go about it could be different in the context of Defold.

I see it’s possible to do preprocessor directives with this extension-lua-preprocessor.

Should I come up with my own way to have even more build profile options? In Unity when you uncheck “Development build”, all the hooks for profiling, logging etc. are stripped out, so it becomes necessary to have a “pre-release” mode, where it still compiles out all your “development mode logic” (eg. level skip, infinite health etc.) and runs the game as it would in “release” but is still able to print log messages and profile the performance, to help fix bugs that only occur in “release” code paths.

Maybe there’s something on the command line? When I build for Nintendo Switch, I have a bob.jar batch file I run, if I could specify a build profile on the command line, I could just run a different batch file depending on the build I want to do.

1 Like

One option is to build from the command line with Bob, and pass an additional settings file, which has the same format as game.project and can override some of the settings.

You can add game-specific config values to those files which you can fetch at runtime with eg sys.get_config_int()

1 Like

Thanks :slight_smile: That sounds really flexible, I like that.

I would also like to know more about this. In addition to having profiles for debug, release and profiling/live testing (if needed), I would like to set up more targets than platforms, e.g. a Steam demo target and a Steam full game target (with different assets and code).

One way to go might be to override properties in project settings, as AarrrBee mentioned, modifying bundle_resources, bundle_exclude_resources and/or custom_resources. All profiles and targets could have modules with the same names and functions, but depending on includes/excludes these get bound to different implementations. That way we minimize “if debug, if live_server, if steam” etc. in game code.

There are a few (?) build/deploy setups that might be helpful to look at. I found these two repos now — there might be one or two more out there.

1 Like