Poki SDK native extension for Defold

Installation

Installation

You can use the Poki SDK extension in your own project by adding this project as a Defold library dependency.
Open your game.project file and in the dependencies field under project add:

https://github.com/AGulev/defold-poki-sdk/archive/main.zip

or point to the ZIP file of a specific release.

Lua API corresponds to original JS API SDK:

poki_sdk.gameplay_start() -- in JS it's PokiSDK.gameplayStart()
poki_sdk.gameplay_stop() -- in JS it's PokiSDK.gameplayStop()
poki_sdk.commercial_break(function(self)end) -- in JS it's PokiSDK.commercialBreak()
poki_sdk.rewarded_break(function(self, success)end) -- in JS it's PokiSDK.rewardedBreak()
poki_sdk.set_debug(value) -- in JS it's PokiSDK.setDebug(value)
poki_sdk.happy_time(value) -- in JS it's PokiSDK.happyTime(value), where value is between 0 and 1
poki_sdk.shareable_url(params, callback) -- in JS it's PokiSDK.shareableURL({}).then(url => {})
local value = poki_sdk.get_url_param(key) -- in JS it's PokiSDK.getURLParam('id')

-- Also, it's possible to check if AdBlock is active.
-- The value updates ones when game init.
poki_sdk.is_adblock_active()

It’s possible to use the original HTML5 integration manual, but this Defold SDK implements the following points from the original manual, so you can ignore them:

1. Include our Javascript SDK

2. Initialize the SDK

3. Implement gameLoadingStart and gameLoadingFinished

7. Prevent page jump

Make sure you pause sounds and music when show ADS.

When you get your PokiSDK Sitelock code, just add it to your game as:

html5.run("Sitelock JS code from Poki")

For security reasons, this piece of code is not public, so please request it from your Poki contact.


If you have any issues, questions or suggestions please create an issue or contact me: me@agulev.com


If you didn’t know about Poki.com before and going to contact them, I would be appreciated if you mention that you found out about them because of this SDK and PotatoJam studio.

20 Likes

Defold Poki SDK 1.2.0

Added new functions:

poki_sdk.shareable_url(params, callback) -- in JS it's PokiSDK.shareableURL({}).then(url => {})
local value = poki_sdk.get_url_param(key) -- in JS it's PokiSDK.getURLParam('id')

More info about this functionality is available here.

7 Likes

Defold Poki SDK 1.3.0

Latest

  • New function added poki_sdk.capture_error(error_string) - track error in the Poki Developer Dashboard
  • Replaced outdated poki_sdk.is_adblock_active() function with new poki_sdk.is_ad_blocked() function
  • Removed deprecated function poki_sdk.happy_time(value)
8 Likes

Starting this release the SDK collects all the internal ERROR, WARNING and FATAL (dmLogError(), dmLogWarning(), dmLogFatal()) engine’s messages using PokiSDK.captureError(). These messages will be available in your dashboard in the following format: DEFOLD:message. For example:

DEFOLD:ERROR:GUI: Could not create the node since the buffer is full (32).

Do not collect Lua errors manually using sys.set_error_handler() anymore. It will be collected automatically, for example:

DEFOLD:ERROR:SCRIPT: example/poki-sdk.gui_script:32: attempt to perform arithmetic on global 'a' (a nil value)
stack traceback:
 example/poki-sdk.gui_script:32: in function <example/poki-sdk.gui_script:31>
6 Likes