GAME CREATOR

Multiplayer games

Separate local-multi from reviewed online-multi Relay capabilities and their result-trust boundaries.

Play modes

playModeMeaning
singleA regular Host session for one player
local-multiThe game owns all same-device state
online-multiAn approved exact-version profile connects to the shared Relay

Manifest request example

The currently activatable request is websocket + relay for 2–8 players. This declaration requests review; it is not runtime authority.

json
{
  "game": {
    "slug": "my-online-game",
    "title": "My Online Game",
    "genre": "party",
    "mode": "multi",
    "playModes": ["online-multi"]
  },
  "progression": { "type": "none" },
  "result": { "score": null },
  "leaderboard": { "enabled": false },
  "multiplayer": {
    "version": 1,
    "transport": { "kind": "websocket", "protocolVersion": 1 },
    "runtime": { "kind": "relay" },
    "players": { "min": 2, "max": 8 },
    "features": {
      "reconnect": "resume",
      "directMessages": true,
      "hostSnapshot": true,
      "joinInProgress": false,
      "spectators": false
    }
  }
}

Review and activation

  1. 1Upload a new version whose playModes include online-multi.
  2. 2The request is bound to the exact gameId, versionId, contentHash, and request hash.
  3. 3Staff approval creates a disabled Relay profile.
  4. 4New rooms and tickets are allowed only after a separate operator activation.
  5. 5A new ZIP or version never inherits a previous profile approval automatically.

Relay API

Register a listener before calling ready(). broadcast reaches every participant, direct targets an allowed participant, and snapshot stores an allowed HOST reconnect snapshot.

js
const relay = window.OWOGG.multiplayer;

const unsubscribe = relay.subscribe((message) => {
  const bootstrap = relay.bootstrap;
  if (!bootstrap || bootstrap.runtime.kind !== "relay") return;

  if (message.type === "MULTI_CONNECTED") {
    initializePlayers(bootstrap.self, bootstrap.roster);
  } else if (message.type === "RELAY_SYNC") {
    restoreSnapshot(message.snapshot);
  } else if (message.type === "RELAY_MESSAGE") {
    applyPeerMessage(message.sender, message.payload);
  }
});

relay.ready();
relay.broadcast({ type: "MOVE", revision: 1, x: 3, y: 4 });

// When leaving the room:
relay.leave();
unsubscribe();

Room creation and Relay budgets

One authenticated user may host at most three rooms that have not reached a terminal state. A fourth new room is rejected with 409 ACTIVE_HOST_ROOM_EXISTS even under concurrent requests, so close finished rooms in the platform room UI or wait for expiry before creating another.

A waiting room is stored in D1 and does not create a Durable Object before a real socket connection. The game ZIP never calls the room API or handles tickets directly; it uses only the multiplayer bootstrap approved by the parent.

  • The current Relay profile allows up to 4 KiB per message and up to 16 KiB for an allowed HOST snapshot, using JSON-safe payloads only.
  • The current application rate is 20 messages per connection per second. Honor bootstrap capabilities and RELAY_REJECTED/RELAY_CLOSED, and never busy-loop failed sends.
  • These are server-owned policy limits. Do not invent them in owogg.json or assume larger values.

What the creator owns

  • Application message types and revisions
  • HOST authority and actions allowed by sender or seat
  • State synchronization, conflict resolution, and hidden-information privacy
  • Reconnect snapshot application and duplicate-message handling
  • A clear separation between local-multi and online-multi state
Relay is not a game-rules server. The server limits connections, participants, targets, size, and rate, but it does not validate payload rules, physics, or winners. Relay results are currently UNVERIFIED and do not affect leaderboards, XP, rewards, or MMR.

Continue reading