Construct integration
Native Construct setup, integration source and export guidance.
Downloads for this guide
Construct source packageSource + configuration/adapter + README; engine verification notes included.Download play-island.jsIndividual native integration source.Support and prerequisites
Integration source adapter; the native editor/export has not been verified. Validate your actual build under Play Island's sandbox before submission. The same per-game event registration and provider approval requirements apply. Download the source package and read README.txt before building. Browser samples never need a secret key.
Set up the project
Use Construct 3 scripting with Use worker = No. Add play-island.js as a script file and load client.js on the DOM before it. Create global variables PIReady (boolean), PIBusy (boolean), PIError (string) and Score (number). Import reportPlayIsland in your event-sheet scripting. On a real start await reportPlayIsland(runtime,'started',{}); on a result after at least four seconds await reportPlayIsland(runtime,'completed',{score:runtime.globalVars.Score,progress:100}). Gate input on PIReady and !PIBusy and show PIError. Export HTML5, bundle scripts locally, keep index.html at root, and disable offline/PWA features that need same-origin storage. No .c3p project or worker-mode adapter is supplied; this is an unverified integration source template.
Native integration example
// Construct 3 script file. Set Use worker = No: the injected SDK lives on window.
// Load client.js on the DOM before this script. Create global variables
// PIReady (boolean), PIBusy (boolean), PIError (string), Score (number).
runOnStartup(async runtime => {
runtime.addEventListener('beforeprojectstart',async () => {
runtime.globalVars.PIReady=false;
try {
if (runtime.isInWorker) throw Error('This adapter requires Use worker = No.');
await globalThis.PIExample.connect();
runtime.globalVars.PIReady=true;
} catch (error) { runtime.globalVars.PIError=error.message; }
});
});
// Import this exported function in event-sheet scripts. Await it, and gate
// gameplay on PIReady && !PIBusy. On failure PIReady becomes false: reload.
export async function reportPlayIsland(runtime,name,payload = {}) {
if (!runtime.globalVars.PIReady || runtime.globalVars.PIBusy) return false;
runtime.globalVars.PIBusy=true;
try { await globalThis.PIExample.report(name,payload); return true; }
catch (error) { runtime.globalVars.PIError=error.message; runtime.globalVars.PIReady=false; return false; }
finally { runtime.globalVars.PIBusy=false; }
}Event lifecycle and errors
The project uses the supplied client.js helper to call the real injected PlayIsland SDK. It waits for configuration and acknowledgement callbacks. The helper serializes reports, detects rejected events and stops after a timeout or rejection. It does not manufacture accepted events offline. The example's proposed registry permits score (integer 0–1,000,000) and progress (number 0–100); both are optional in that proposal. Staff must publish the relevant definitions for your game. Other games may have different required fields. Do not copy a built-in game's specialized counters. Wait for real gameplay before reporting completion; the server rejects completed within the first three seconds of a session. Stop after terminal acceptance; use started to begin a new run or reload the launcher. On error, display the reason, correct the problem and reload to obtain a clean sequence.
Test, export and submit
- Test the engine's own rendering and controls locally. A standalone/editor launch will not connect to Play Island.
- Build using the setup instructions above and inspect the resulting runtime files.
- Follow ZIP packaging and provider submission.
- Use the visual preview for loading/layout. Use a published /play/ launch for actual accepted-event tests.
- Verify configuration, accepted start/progress/result, guest behavior, signed-in receipts if configured, replay and mobile controls.
Saves, exit, platform leaderboard navigation and general player profiles are not available automatically to your new game. See feature availability before adding those buttons.
Engine reference
Construct runtime scripting explains the native engine/browser mechanism. The Play Island contract is defined by the platform implementation, not by the engine documentation.