# Connect a game to Pocket Beyond

You are integrating a game with Pocket Beyond. Preserve the game's art direction and gameplay.

1. Read WORLD-STARTER.md, ARCHITECTURE.md, and RIG-PROFILE.md from the same guides directory. Use the existing generated JavaScript template as the executable reference.
2. Give the world a unique stable ID and its own HTTPS hostname. Different paths or ports on one hostname do not isolate cookies. Never share the central account hostname with a third-party world.
3. Keep the world's private credential on its server. Browser code imports `/client/runtime/sdk.js` from the central service, or uses a pinned local copy with its transitive imports. Inspect the module's actual exports; do not invent SDK calls.
4. Exchange a 60-second, single-use entry ticket from the destination server. Set an HttpOnly, Secure, host-only session cookie. Acknowledge entry only after creating the local session. Never treat a player ID, store context, or browser-supplied appearance as authentication.
5. Use the world's server session for appearance, travel, and store calls. Keep keys, tickets, cookies, and authorization headers out of logs and error reports.
6. Cache avatar bytes by the immutable asset revision. Use one in-flight request per revision and reuse resources for repeated actors. Apply bounded cache retention. Distribute validated bytes or a trusted immutable asset URL; never proxy arbitrary player-supplied URLs.
7. Preserve the named humanoid joints, rest pose, and animation clips. Reject unvalidated uploads, external glTF references, oversized assets, and invalid animation data. Do not pass uploads directly to players.
8. Keep multiplayer movement authoritative on the world server. The shared identity system does not validate your game rules.
9. Test two separate browser contexts. Enter the world, see both avatars, change a look, travel to another world and back. Verify expired and replayed tickets, destination mismatches, offline services, and origin violations fail safely.
10. Production must disable seeded demo identity selection and simulated payments. Never claim a purchase succeeded from a client callback or an unconfirmed blockchain block.

Nano checkout, external identity providers, and self-service registration must be used only when the deployment explicitly exposes those capabilities. Do not fabricate credentials or promise that unconfigured providers work.
