Open Web Arcade

For developers · Zero dependencies

Open Web Arcade Score SDK

One line of JavaScript gives any hosted game global leaderboards, verified player accounts, and guest score claiming — injected automatically by our sandbox with zero external packages.

1. Report a score

Every game hosted on Open Web Arcade automatically receives a frozen window.OWA object inside its sandbox. Because it uses optional chaining, your game keeps working identically on GitHub Pages, localhost, or itch.io with zero bundle overhead.

JavaScript / TypeScript
// Report a points high score (higher is better)
window.OWA?.score(14250);

// Report a timed run in milliseconds (lower is better, e.g. fastest lap)
window.OWA?.score(42810, { unit: "ms" });

// Optional: a separate board per track or level
window.OWA?.score(61250, { unit: "ms", board: "coast-highway" });

// Optional: report a custom gameplay milestone
window.OWA?.event("lap_complete", { lap: 3 });

2. Units and ranking

  • "pts" (default) — points score, ranked highest first. Whole integers from 1 to 1,000,000,000.
  • "ms" — speedrun or lap time in milliseconds, ranked lowest first (formatted as 42.81s or 1:12.40).
  • "sec" — survival or session duration in seconds, ranked highest first.

Pass board to keep separate leaderboards inside one game, such as one per track or level. Board names use letters, numbers, spaces and dashes, up to 32 characters, and "Coast Highway" and "coast-highway" are the same board. Each board and unit is its own ranking, and the game page lets players switch between them. Without board, scores go to the game's main board.

3. TypeScript types

Drop this ambient declaration anywhere in your src/ folder (for example src/owa.d.ts):

src/owa.d.ts
declare global {
  interface Window {
    OWA?: {
      readonly version: string;
      score(value: number, options?: { unit?: "pts" | "ms" | "sec"; board?: string }): boolean;
      event(name: string, data?: Record<string, unknown>): boolean;
      ready(): void;
    };
  }
}

4. Automatic fallback for classic games

Even if a hosted game has not added window.OWA yet, our sandbox automatically detects standard numeric localStorage keys such as bestScore, highScore, and highscore and offers to save them to the leaderboard. Games without numeric scoring also get a built-in run-time tracker.

5. How players claim scores

Guests can post immediately with a filtered arcade tag, then click Sign in to claim your score to link their scores to a verified Open Web Arcade profile. Signed-in players submit automatically and keep one personal best per board.

Open-source SDK repository

Want typed helpers, a local mock leaderboard harness, or the reference Three.js bridge? Grab the MIT-licensed repository at github.com/marginsystems/open-web-arcade-sdk.

Try it on hosted games

Every game marked Plays here in the playable catalog runs inside the sandbox with window.OWA ready out of the box, or submit your own .zip build to get an instant leaderboard.