How to manage different platform SDKs in a single project?

Hi everyone!

I’m developing a game that I’d like to publish on several platforms, such as Google Play, the App Store, Wavedash, and itch.io.

Each platform has its own SDK that I need to integrate to take advantage of its features. For example, I’ve currently fetched the GPSG libraries into my project and integrated the necessary code to use its login, achievements, and leaderboard features. If I wanted to use, for example, Wavedash’s libraries as well to publish the game on that platform, how should I approach this?

The game is designed to work on both mobile and web, so I’d like to maintain a single codebase. Creating a separate project for every platform and maintaining each one independently seems like a huge amount of extra work.

However, I’m not sure how to manage these libraries separately. Including all the SDKs in every build would obviously be wasteful.

Do you have any advice on how to handle this? Is there a clean way to manage multiple SDKs in a single Defold project and include only the ones needed for each build?

If the api’s are similar and with similar app flows, you could write a .lua wrapper to handle them all.

adswrapper.Init(...)
adswrapper.show_ad(...)
-- and so on

For checking optional api’s at runtime, we generally recommend pattern like this:

-- checking GPGS support
if gpgs then
    gpgs.some_function(...)
end

And, for having optional builds, we recommend building woth bob.jar, using the --settings flag.

java -jar bob.jar --settings release.ini  --settings android_gpgs.ini --platform arm64-android

When using the settings files, it’s important to know the properties are overriden, so you need to take case with the “dependencies” property to get it the way you want.

1 Like