PixiJS integration
Native PixiJS setup, integration source and export guidance.
Downloads for this guide
PixiJS source packageSource + configuration/adapter + README; engine verification notes included.Download game.jsIndividual native integration source.Support and prerequisites
Verified in local desktop and mobile-viewport Chromium: this bundled starter rendered inside Play Island's real sandbox and sent an accepted start event. Complete gameplay, other renderers and physical devices still require release-specific testing. 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 Node 22+, run npm install, then npm run build. This source targets PixiJS 8.6.6: await Application.init(), append app.canvas, set eventMode='static' on the target, then handle pointerdown. Import pixi.js/unsafe-eval before initializing the renderer: despite its name, this official compatibility module replaces generated functions with CSP-safe polyfills. The example selects WebGL explicitly. The Graphics circle and Text label implement the small sample. The engine is bundled into build/game.js; ZIP build/ contents, not node_modules or project sources. Test the installed renderer under Play Island's CSP; source syntax alone does not prove engine compatibility.
Native integration example
import { Application, Graphics, Text } from 'pixi.js';
// Pixi's named "unsafe-eval" compatibility module replaces dynamic code generation
// with CSP-safe polyfills. It does not loosen Play Island's content security policy.
import 'pixi.js/unsafe-eval';
// PixiJS 8: asynchronous renderer initialization and federated pointer events.
async function main() {
const app = new Application();
await app.init({width:720,height:540,background:0x10251d,preference:'webgl'});
document.body.appendChild(app.canvas);
const label = new Text({text:'Connecting…',style:{fill:0xffffff,fontSize:18,wordWrap:true,wordWrapWidth:660}});
label.position.set(24,24); app.stage.addChild(label);
const target = new Graphics().circle(0,0,45).fill(0xc4f66b);
target.position.set(360,270); target.eventMode = 'static'; target.cursor = 'pointer'; app.stage.addChild(target);
let count = 0, busy = true, ended = false, startedAt = 0;
target.on('pointerdown',async () => {
if (busy || ended) return; busy = true;
try {
if (count < 5) {
count++; await PIExample.report('progress',{progress:count*20});
target.position.set(80+Math.random()*560,150+Math.random()*260);
label.text = `${count}/5. Tap again after 4 seconds to finish.`;
} else if (performance.now()-startedAt >= 4000) {
await PIExample.report('completed',{score:50,progress:100});
ended = true; label.text = 'Run accepted. Reload to replay.';
}
busy = false;
} catch (error) { label.text = error.message+' Reload after fixing the integration.'; }
});
await PIExample.connect(); await PIExample.report('started',{});
startedAt = performance.now(); busy = false; label.text = 'Collect five stars.';
}
main().catch(error => { document.querySelector('#status').textContent = error.message; });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
PixiJS application explains the native engine/browser mechanism. The Play Island contract is defined by the platform implementation, not by the engine documentation.