Exporting for multiple targets

Hi guys,

I was curious to know how you could export for multiple targets, so for instance. For HTML5 how the you can export for POKI, CrazyGames, Yandex, etc. etc. from the same project.

Or, you can export a demo and full version of the game from the same project.

One way of doing this is to build using the command line tool and change your project dependencies depending on which platform/portal you are building for.

You can have project setting “stub” files, like this:

poki.settings

[project]
dependencies#0 = https://github.com/defold/https://github.com/defold/extension-poki-sdk/archive/refs/tags/1.4.3.zip
# build for poki
java -jar bob.jar --settings=poki.properties --platform=js-web --archive build bundle

# build for another platform
java -jar bob.jar --settings=another_platform.properties --platform=js-web --archive build bundle

# and so on ...

This will then replace the fields you have in your main game.project file with the fields from the “stub” file you are using. And then in your code you have a wrapper or check which SDK is present and call the appropriate functions.

if poki_sdk then
    poki_sdk.gameplay_start()
elseif my_other_sdk then
    my_other_sdk.start()
end
5 Likes