Developers

Paizo SDK

One small script connects your HTML5 game to Paizo Games: cloud saves, ad breaks, the loading screen, automatic pause and player accounts. A basic integration is a dozen lines of code, and every game on the site uses it.

Quick startSubmit a gamev1.1.0 · about 20 KB · no dependencies

Why integrate

Your game runs in a frame on its own address, separate from the portal page around it. The SDK is the link between the two. It is what lets the portal treat your game as part of the site instead of a page it happens to embed.

Cloud saves with no save code

Keep saving to localStorage as you already do. The SDK mirrors it to the player's account, so progress follows them to any device.

Ads without an ad stack

One call at a natural break, one call for a rewarded ad. The portal picks the provider, the frequency and the fallback. You ship no ad code.

A real loading bar

Report progress and the portal shows a branded loading screen with your cover and a bar that moves, then hands focus to your game.

Pause handled for you

When the player switches tab or clicks outside the game, frames and audio stop on their own. Nobody comes back to a lost run.

Players, not login forms

Read the signed-in player's name and avatar, or open the portal's sign-in. No auth screens or account storage of your own.

Works everywhere you test

Opened outside the portal the SDK runs in local mode: every call still resolves, so the same build runs on your machine and on the site.

What happens without the SDK

A game that skips the SDK still runs, but it is cut off from the player's account. Everything the player does stays on their own device:

  • Coins, points, scores, levels and unlocks exist only in the one browser the player used. Nothing is stored on our side.
  • Signing in changes nothing for your game. Progress is not attached to the player's account, so it does not appear on their phone, their other computer or another browser.
  • Clearing browser data, private browsing or a new device wipes everything the player earned, and neither you nor we can bring it back.
  • The portal cannot tell that the game loaded or that anyone is playing: no loading progress, no play activity, no ad breaks.

With the SDK, the same localStorage data is saved to the signed-in player's account and restored wherever they play next. See Cloud saves.

Quick start

Let your AI assistant do it

Working with Claude, ChatGPT, Cursor or another coding assistant? Copy the whole integration brief (rules, API and checklist) and paste it into the chat next to your game's code.

Or follow the three steps by hand:

1Add the SDK

Download paizo-sdk.js, put it in your build and load it before your own scripts. It defines window.PaizoSDK.

index.html
<script src="paizo-sdk.js"></script>
<script src="game.js"></script>

Using a bundler? Install the npm package instead. It is the same file with TypeScript types.

terminal
npm install @paizogames/sdk
game.js
import PaizoSDK from "@paizogames/sdk";

2Start up and report loading

Wait for init() before anything else: it connects to the portal and puts the player's save back into localStorage. Then load your assets and tell the portal how far along you are.

game.js
await PaizoSDK.init();

const save = JSON.parse(localStorage.getItem("mygame.save") || "{}");

await loadAssets((loaded, total) => {
  PaizoSDK.gameLoadingProgress(loaded / total);   // 0..1
});
PaizoSDK.gameLoadingFinished();                   // show the game

3Mark gameplay and offer breaks

game.js
function startLevel() {
  PaizoSDK.gameplayStart();
  // ...
}

async function levelComplete() {
  PaizoSDK.gameplayStop();
  localStorage.setItem("mygame.save", JSON.stringify(save));

  await PaizoSDK.commercialBreak(() => muteAudio());   // may show nothing
  unmuteAudio();
  startLevel();
}

async function onWatchAdClicked() {
  const rewarded = await PaizoSDK.rewardedBreak(() => muteAudio());
  unmuteAudio();
  if (rewarded) save.coins += 100;
}

PaizoSDK.onPause(() => showPauseMenu());

That is a complete integration. The sections below explain each part, and the checklist is what the reviewer goes through.

Loading screen

While your game loads, the portal covers it with a loading screen showing your cover and a progress bar. gameLoadingProgress(value) moves the bar; gameLoadingFinished() removes the screen and gives your game keyboard focus, so the player can start with the keyboard without clicking first.

  • Without progress calls the bar only shows that something is happening. Report real progress, by bytes or by asset count.
  • The bar only moves forward. A lower value than the last one is ignored.
  • Call gameLoadingFinished() when the game is playable, not when the first script has run.
  • Keep the download before play starts small (the build requirements advise an upper limit) and load later levels while the player plays.

Cloud saves

There is no save API. Write to localStorage as you would in any web game; the SDK watches it and mirrors it to the portal, at most every two seconds and whenever the page is hidden. For a signed-in player the copy is kept in their account and restored on init() wherever they play next.

  • Read your save after await PaizoSDK.init(). A save read while the script is still loading misses the copy restored from the account.
  • When the local copy and the account copy differ, the newer one wins.
  • The whole of localStorage may hold up to 1 MB as JSON. Past that, syncing stops for that player.
  • Keys starting with paizo_ignore are never synced. Use them for caches and device-specific settings.
  • Do not use cookies or IndexedDB for progress: they are not synced, and cookies are flagged at upload.

Ad breaks

You tell the portal where a break fits; the portal decides whether an ad plays. Both calls always resolve, so the game never hangs waiting for an ad.

commercialBreak()

Between levels, after game over, on returning to the menu. Call it at every natural break and do not count or time them yourself: frequency is the portal's job.

rewardedBreak()

Only after the player chose it, for example by clicking a "watch an ad for 100 coins" button. Grant the reward only when it resolves true.

  • Both take an optional onStart callback, called only if an ad really starts. Mute your audio there and restore it when the promise resolves.
  • Stop the game's own timers and input while a break is pending, and continue when the promise resolves.
  • Never show ads of your own, and never make progress depend on an ad being shown.

Automatic pause

A game stops the moment the player is not in it: another tab, a minimised window, or a click on the page around the game. The SDK does this for every game. There is nothing to turn on and no way to turn it off.

  • requestAnimationFrame callbacks are held back and released when the player returns.
  • Every AudioContext and every playing <audio> or <video> element is suspended.
  • A "click to continue" cover is drawn over the game.

What is left to you:

  • Show your own pause menu in onPause, so the player does not come back into a running level.
  • Clamp the frame delta, for example Math.min(dt, 0.05): the first frame after a pause arrives late.
  • setTimeout and setInterval keep running. Stop any game logic you drive from them in onPause.

Players

Accounts belong to the portal. Your game never shows a login form and never stores credentials. It can ask who is playing:

game.js
const user = await PaizoSDK.getUser();   // { username, avatarUrl } or null
if (user) showGreeting(user.username);

// A guest clicked "sign in to keep your progress":
signInButton.onclick = () => PaizoSDK.login().catch(() => {});

login() opens the portal's sign-in. After signing in the page reloads and the game gets the player from getUser(). Outside the portal it rejects, so catch it.

Testing locally

Open your index.html from any local web server. With no portal around it the SDK switches to local mode after its handshake goes unanswered, and logs [PaizoSDK] v1.1.0 ready, environment: local to the console.

  • Ad breaks show a one-second placeholder, and rewarded breaks grant the reward.
  • Saves stay in localStorage. getUser() resolves null.
  • Only a hidden tab pauses the game, so the dev tools can be used without the game stopping.

You never need to branch on the environment. After you upload a build, the Open preview link on the developer page runs it from its real address, and once it is approved it plays inside the portal with everything connected.

API reference

Everything lives on PaizoSDK. Every call waits for init() on its own, so calls made early are not lost.

CallReturnsWhat it does
init()Promise<void>Connects to the portal and restores the player's save. Call it once, first. Never rejects.
environment"paizo" | "local"Where the game is running. Valid after init(). You should not need to branch on it.
versionstringThe SDK version, for example "1.1.0".
gameLoadingProgress(value)voidLoading progress from 0 to 1. Drives the portal's loading bar; values that go backwards are ignored.
gameLoadingFinished()Promise<void>The game is ready. Hides the loading screen and gives the game keyboard focus.
gameplayStart()Promise<void>The player is actively playing: a level starts, the game is unpaused.
gameplayStop()Promise<void>Play stopped: level complete, game over, pause, back to a menu. Also pushes the save.
commercialBreak(onStart?)Promise<void>Ask for an ad at a natural break. Resolves when the game may continue, whether or not an ad played.
rewardedBreak(onStart?)Promise<boolean>An ad the player chose to watch. Resolves true only if the reward should be granted.
onPause(fn) / onResume(fn)() => voidThe SDK stopped or released the game because the player left or came back. Returns an unsubscribe function.
pausedbooleanTrue while the SDK is holding the game.
getUser()Promise<User | null>{ username, avatarUrl } for a signed-in player, null for a guest.
login()Promise<User | null>Opens the portal's sign-in for a guest and resolves null; the page reloads after sign-in. Rejects outside the portal.

Before you submit

The reviewer checks these on every build. Going through them first saves a round.

  • The SDK is loaded before your own scripts, and init() is awaited before anything reads a save.
  • gameLoadingProgress() is called while assets load and gameLoadingFinished() once the game can be played.
  • gameplayStart() and gameplayStop() wrap every stretch of real play.
  • commercialBreak() is called at natural breaks only: between levels, after game over. Never in the middle of play.
  • Rewards are granted only when rewardedBreak() resolves true, and audio is muted in onStart.
  • Progress is saved in localStorage. No cookies, no accounts and no backend of your own.
  • No third-party ads, analytics or trackers, and nothing loaded from other hosts.
  • The game still works when no ad is shown and when index.html is opened on its own.

FAQ

Is the SDK required?

Yes. Every game on Paizo Games loads it. A build that does not is flagged by the automated checks when you upload it, and it can be sent back in review.

My game already saves to localStorage. Is that not enough?

Not on its own. Without the SDK that data never leaves the player's browser: coins, scores and progress are not saved to their account, and signing in syncs nothing. The SDK is what copies the same localStorage data to the account, with no extra save code from you.

Does it work with Unity, Godot, Phaser, Construct or my own engine?

Yes. The SDK is one plain JavaScript file with no dependencies, exposed as window.PaizoSDK. Anything that exports to HTML5 can call it: from your page's own script, or from the engine's JavaScript bridge (a .jslib plugin in Unity, JavaScriptBridge in Godot).

How big is it?

About 20 KB before compression, and it starts no network requests of its own. It only talks to the portal page around your game.

Will my game be flooded with ads?

No. You mark the moments where a break would be acceptable; the portal decides whether one plays and keeps a minimum interval between ads. A commercialBreak() that shows nothing resolves right away.

What happens to a guest's progress?

It stays in their browser, exactly as without the SDK. Once they sign in, the same save is kept in their account and restored on their other devices.

Can I use the SDK outside Paizo Games?

The build runs anywhere, because local mode keeps every call working. The portal features (ads, accounts, cloud saves) only exist on paizogames.com.

Integrated? Submit your game

Zip the build with index.html at the top level and upload it. We review every version before it goes live.

Submit a game

설정을 기억하고 트래픽을 측정하기 위해 쿠키를 사용합니다. 쿠키 정책