# Publishing

## Optional game API Worker

Game API backends are registered by Arcade maintainers. A public route such as `/api/example-game/matches` can map to a private Worker route such as `/api/matches`. Configure the Arcade gateway's `GAME_API_ROUTES` Worker variable and a service binding for the target Worker; keep the target Worker private (`workers_dev = false` and no public route) so callers cannot bypass the gateway's auth and route policy. The target receives `x-vortex-game`, and authenticated routes also receive `x-vortex-user-id` and URL-encoded `x-vortex-username`. The Arcade session cookie and browser Authorization header are stripped before forwarding.

The route config is JSON keyed by game slug. Example:

```json
{
  "example-game": {
    "binding": "EXAMPLE_GAME_API",
    "worker": "example-game-api",
    "auth": "required",
    "routes": [
      { "publicPath": "/matches", "workerPath": "/api/matches", "methods": ["GET", "POST"] }
    ]
  }
}
```

Add the matching `[[services]]` binding to the Arcade Worker's Wrangler config and deploy the backend Worker before the gateway. This route table is deployment-managed; developer-submitted deployments do not receive production bindings automatically.

Example Wrangler binding:

```toml
[[services]]
binding = "EXAMPLE_GAME_API"
service = "example-game-api"
```

Keep the backend Worker private: do not give it a `workers.dev` endpoint or public route. Only the Arcade gateway should be able to invoke it through the service binding.

Use a game backend when your game must verify outcomes or maintain authoritative inventory. Derive identity from the verified gateway context, scope records to the user and game, validate client inputs, and make retries safe. Coordinate the browser call path with Arcade staff. The injected wallet and cloud-save SDK covers Arcade's built-in services. A registered route also needs a supported way for the imported frame to call it.

## Validate the release locally

Build the game, then use a clean commit or release tag containing the manifest, build output, and media. From the Vortex Royale repository root:

```sh
npm --prefix arcade run import-game -- /path/to/game-checkout v1.0.0
npm run build:site
npm run dev
```

The importer resolves the tag to a commit, validates the manifest and required files, stages the release, and updates `arcade/library/<slug>`. Inspect the generated details page, browse card, images, mobile layout, launch path, and any mode selection in the local site preview before publishing.

The local preview defaults to `http://localhost:4173` and uses guest accounts. Use SDK fixtures to exercise account scenarios locally, then verify signed-in behavior through an approved Arcade player build. Use test payment configuration for checkout verification.

To check a basic interaction automatically, add an optional `launchTest` object to `arcade.game.json`. Use CSS selectors for the visible ready state and, when relevant, a start control and the state it reveals.

```json
{
  "launchTest": {
    "ready": "#menu",
    "start": "#play",
    "started": "#game-hud"
  }
}
```

Use a visible `ready` selector on its own for games that start automatically. Provide both `start` and `started` for a click test. The started element must become visible after the click. Use an offline or guest flow for this check.

## Release checklist

| Area | Verify before publication |
| --- | --- |
| Build and catalog | Submit the intended commit with the full export and artwork. Open the listing and player. Check relative URLs, cover text, controls, mobile layout, keyboard focus, and gameplay with external networking blocked during startup. |
| Guest and sign-in | Reach the menu with an absent SDK, as an Arcade guest, and during account lookup failure. Sign in through the player. Switch accounts and verify that cloud state and paid inventory follow the active account. |
| Wallet and store | Compare item prices to the registered catalog. Confirm a one-time item persists after reload. Check cancellation, insufficient funds, and duplicate button presses. Retry an uncertain purchase with the same UUID and verify one debit. For repeatable items, verify that a new UUID records one new purchase and that replaying the old UUID grants no additional item. |
| Credit packs | In an Arcade test environment, verify disabled checkout, successful return, pending payment, and cancellation. Confirm that the UI refreshes the shared balance from the service and shows no credit increase on cancellation. |
| Cloud saves | Save and reload with the same account, open the game from another browser, and verify isolation across accounts. Test a two-tab conflict, a lost response, a save larger than 32 KiB, and migration from the previous release. |
| Matchmaking and TURN | Use two signed-in accounts. Exercise public and invite-code queues, incompatible versions, duplicate joins, cancel, timeout, expired tickets, and a player leaving during handoff. Test a relay-only connection, TURN rejection after release, and the UI when the relay is unavailable. |
| Updates | Re-run the guest launch test and signed-in checks after changes to product IDs, save schema, gameplay logic, or packaged assets. Keep the game slug stable and recheck the exact commit you submit. |

## Submit through Vortex Arcade

Sign in and request developer access. After Arcade approves the account, open the submission page, connect GitHub, select a repository and branch, and choose **Check release**. Arcade checks the manifest, packaged files, and launch HTML before you submit. Fix blocking findings, push to the branch, and check again. The form suggests a title from the manifest and submits the exact checked commit. **Your submissions** shows review status and notes. After changes are requested, **Use this repository** restores the source selection so you can check and submit the updated commit. [Developer registration](https://vortexgame.win/account/developer/) · [Submit a game](https://vortexgame.win/game/submit/)

After an owner approves the source review, the import workflow loads the packaged game in Chromium inside a network-isolated container. It checks that the game displays a launch screen, that packaged startup resources load, and that the page has no uncaught startup errors. It uses a guest Arcade fixture and blocks external networking. A failed check creates a draft import PR with a link to the check run. Review and merge are required for publication.

Include the game's intended age rating, input methods, third-party asset licences, and external services in the review notes. Maintainers review functionality, content rights, loading, accessibility, and the packaged release. For updates, push to the linked branch and keep the same game slug. Arcade checks the new commit and publishes it after the import PR is reviewed and merged.

## Game availability and analytics

Arcade can suspend a game or its online features. Show Arcade's message if the game becomes unavailable and keep supported offline modes available where Arcade permits them. The published catalog registers the game automatically for Arcade game control and analytics.

The Arcade owner can grant a developer access to a published game from **Admin → Developers**. Assigned developers can use `/developer/` to see signed-in players and sessions, game-attributed credit spending, and confirmed credit-pack payments. The player records one session per account per game per 30 minutes. Shop activity uses the launch game's slug, and credit-pack orders from the general credits page are grouped under `arcade`.
