Engine guide
GameMaker
GML + HTML5 build
GameMaker Studio 2 exposes JS to GML through Extensions → JavaScript files. Wire the Pixlland SDK as one .js extension + a GML wrapper.
1. Add the SDK to index.html
In your project, edit Game Options → Platform Settings → HTML5 → General → Included Files / HTML head, append:
<script src="https://pixlland.com/sdk/v1/pixlland.js" defer></script>2. Create a JavaScript Extension
Right-click Extensions → Create Extension. Add a file pixlland.js with these functions (and register each in the Extension Properties):
function pll_init() {
if (window.PixllandSDK) window.PixllandSDK.init();
}
function pll_loading_finished() {
if (window.PixllandSDK) window.PixllandSDK.gameLoadingFinished();
}
function pll_gameplay_start() {
if (window.PixllandSDK) window.PixllandSDK.gameplayStart();
}
function pll_gameplay_stop() {
if (window.PixllandSDK) window.PixllandSDK.gameplayStop();
}
function pll_happy_time(delta) {
if (window.PixllandSDK) window.PixllandSDK.happyTime(delta);
}
// commercial_break is async — fire a GM async event when done.
function pll_commercial_break() {
if (!window.PixllandSDK) {
GMS_API.send_async_event_social({ id: "pixlland", outcome: "skipped" });
return;
}
window.PixllandSDK.commercialBreak().then(function() {
GMS_API.send_async_event_social({ id: "pixlland", outcome: "completed" });
});
}3. GML wrapper
// scripts/pixlland.gml
function pll_boot() {
if (os_browser != browser_not_a_browser) {
pll_init();
pll_loading_finished();
pll_gameplay_start();
}
}
function pll_on_died() {
pll_gameplay_stop();
pll_commercial_break();
}
// In the Async - Social event of a persistent object:
// if async_load[? "id"] == "pixlland" {
// room_restart();
// }4. Plug into rooms
In your first room's Create event call pll_boot(). In Step:
pll_happy_time(delta_time / 1000000); // delta_time is in µsCommon pitfalls
- Extensions are platform-scoped. Flag the JS extension as HTML5-only so your Windows/macOS builds skip it.
- room_restart() inside the ad callback. Wait for the Async - Social event rather than chaining synchronously — the browser may still be painting the ad when the script returns.
