Poki SDK

rob1221

  • *
  • Posts: 9456
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/

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.


Returns true if an ad blocker was detected by Poki when starting.


Use this block when a happy event happens in your game.  Intensity is between 0 and 1.

For more info about when to use these blocks, refer to the instructions in this link, ignoring the code examples: https://sdk.poki.com/html5/

To enable debug mode for testing purposes, go to Settings > Advanced > Haxe Flags.
Then paste -D pokiDebug into that box.  When ready to publish your final build to Poki, remember to delete that line.

Poki games need to be sitelocked, but the sitelock code is not public and thus cannot be included in the extension.  When given the sitelock code, open templates/haxe/ApplicationMain.hx inside of the extension folder.  At or close to line 325 it says // INSERT POKI SITELOCK CODE HERE and you can either replace that line or paste the sitelock code just under it.  The sitelock can be tested on Poki's QA tool when the pokiDebug flag is disabled.

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 the public build b10300, open up include.xml inside of the extension folder and uncomment the line that says <set name="b10300" />

If there are issues with any Stencyl builds let me know as I've only tested with b10300 and b10417.

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

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: November 15, 2019, 02:56:24 pm by rob1221 »

zerosimms

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

rodolfovs

  • *
  • Posts: 159
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: 9456
That's done automatically with the ApplicationMain.hx template file included in the extension.

rodolfovs

  • *
  • Posts: 159
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: 9456
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: 159
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: 159
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: 9456
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: 1788
@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: 9456
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: 159
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: 1788
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: 159
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: 1788
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.