Poki SDK

rob1221

  • *
  • Posts: 9473
This is an extension for the Poki.com SDK for HTML5 games that can be used by any developers approved by Poki.  If not already involved with Poki, you can check this page for more information: https://developers.poki.com/

If using Stencyl version b11186 or later, the extension is now hosted on Github: https://github.com/rob1221/poki-stencyl

The extension has 5 blocks, and the initialization happens automatically due to the template files that are replaced by the extension (thanks to Justin for helping with that).


Use this block to tell Poki when gameplay has started and stopped.


Show a standard ad and then the blocks inside the wrapper will be triggered when the ad either finishes or fails to show.  Ad rate throttling is done automatically on Poki's end.


Show a rewarded ad and then the blocks inside the wrapper will be triggered when the ad either finishes or fails to show.  If the embedded reward boolean is true inside the wrapper, then the ad was shown correctly and the player should be rewarded.


This block no longer functions (always returns false) due to privacy changes on Poki.


Send an error message that can be viewed on the Poki developer site.


For more info, refer to the Poki Developer Guide here: https://sdk.poki.com/index.html

While not a part of this extension, Poki games need to be scalable on their site.  To enable automatic scaling, go to Settings > Advanced > OpenFL Settings and paste <window resizable="true" /> into that box.  Your game resolution will also need to be in the 16:9 aspect ratio.

If using Stencyl version b10568 or if encountering a console error about APP_FILE_SIZE, open up include.xml inside of the extension folder and uncomment the line that says <set name="b10568" />

If there are issues with the extension let me know either on here, the Stencyl Discord, or the Stencyl channel in the Poki Discord.

Download Extension
(must be signed in to the forums to download)

Update 3:
Added a new block for custom error reporting.
Removed some things deprecated by Poki (happy time, loading start/progress, sitelock).

Update 2:
Replaced the outdated public build template with one that works with the current public build  (b10568) and fixes the APP_FILE_SIZE error.
Fixed wrapper blocks so they still work in cases where the Poki extension code is disabled.

Update 1:
Restricted the sitelock code to non-debug mode since it caused a crash when testing locally.
Added a boolean block to check if an ad blocker was detected by Poki on startup.

« Last Edit: October 18, 2023, 10:48:44 am by rob1221 »

zerosimms

  • Posts: 710
Legend! Thanks for sharing this, looking forward to giving it a whirl (if my game gets accepted)

rodolfovs

  • *
  • Posts: 183
Hi Rob,

Reading the POKI SDK page says I need to implement a loading code like the one below:

PokiSDK.gameLoadingStart();
PokiSDK.gameLoadingFinished();
PokiSDK.gameLoadingProgress(<data>);


Does your extension have blocks that meet this need?

rob1221

  • *
  • Posts: 9473
That's done automatically with the ApplicationMain.hx template file included in the extension.

rodolfovs

  • *
  • Posts: 183
I imagined that the extension automatically would, but I thought I'd ask.

And another question, out of curiosity, in the SDK documents POKI says nothing about ad blocker. What use is indicated for this block? If the user has adblocker enabled is it to block the game or something?

rob1221

  • *
  • Posts: 9473
I think one of the code samples mentions ad block.  You could use that block to ask the player to disable ad block or you could use it to hide any rewarded ad buttons.  It's optional, but you should absolutely not use it to block the game.

rodolfovs

  • *
  • Posts: 183
I asked because some game sites do not open the game if you use adblocker.

But this block will be very useful to warn the user about the lock and offer benefits.

Thanks for the extension Rob!

rodolfovs

  • *
  • Posts: 183
Hi!

2 questions for those who already work with POKI. Is sitelock really a giant code? I got this  code from them, but I thought it would be some domains only.

Another thing, in POKI's QA tool the loading bar doesn't fill up, it's all black, even the game loading. Is this normal?

rob1221

  • *
  • Posts: 9473
Quote
Is sitelock really a giant code? I got this  code from them, but I thought it would be some domains only.
Yeah, just paste the whole thing in there at the place I marked.  It should show up as a single long line but that may depend on the text editor you're using.

Quote
Another thing, in POKI's QA tool the loading bar doesn't fill up, it's all black, even the game loading. Is this normal?
My games load quickly enough that I don't really notice the bar, but I have read about the loading bar not working for published HTML5 games.  I'm not sure what's going on there.

SadiQ

  • Posts: 1795
@rob1221 You can force the browser to use a slower loading speed, and you'll see if the bar works or not. Here's chrome's developer console option:

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

rob1221

  • *
  • Posts: 9473
After doing some tests with a sample game I can see that the loading bar works fine in test mode but not when publishing.  If I test the game and then zip/upload the generated files, that also works fine, which means the problem has something to do with the publish game option.  It's unrelated to the Poki SDK since I was testing without it on Newgrounds.

rodolfovs

  • *
  • Posts: 183
Stencyl testing works fine, but if I test in POKI's QA tools it doesn't work.

I also tried using a custom loading but it doesn't work in the Stencyl test.

SadiQ

  • Posts: 1795
Seems to work fine in this game by Colburt187, and it also uses a custom preloader.
Can you post a link to that game from poki's website?
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

rodolfovs

  • *
  • Posts: 183
I haven't posted it on POKI's website yet, I'm testing it on their QA tool.

Custom preloader for me would be enough, but in my tests does not appear. I will try again today using a custom preloader.

Custom preloader only SWF, correct?

SadiQ

  • Posts: 1795
The SWF file will only work on flash games. You need to make your own with code. I once saw that the bar was being drawn behind the image that you chose for your background, so check to see if you don't have that issue first.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.