Start
Ship a URL tonight.
The path is the same for you and for a coding agent. Package install is public. Creator login is a browser device flow. Never paste an access token. After the first ship, fine-tune the game and ship again.
1. Create a project
Sign in at app.lokiplay.cc and create a project. Copy the project ID. If you use an agent, copy the project prompt from the desk and paste it into the repo.
2. Install the client
In the game repository, pin the published SDK. Keep the existing stack and UI.
npm view @lokiplay/sdk@0.3.8 version
npm install @lokiplay/sdk@0.3.8
Optional overlay:
npm install @lokiplay/ui-web@0.3.8
Do not install @loki/*, unofficial packages named Loki, or @heroiclabs/nakama-js.
3. Add a room-entry flow
Installing the SDK does not add a create/join screen. Before shipping, the game needs one of:
- A minimal lobby: create room, join with invite, copy invite, start when ready.
- An automatic flow: a plain play URL creates a room; an invite or deep-link URL joins it.
Players still need loading, waiting, and error states. The Loki overlay does not create or join rooms.
4. Write game.json
{
"schemaVersion": 1,
"name": "my-game",
"entrypoint": "index.html",
"multiplayer": {
"enabled": true,
"authority": "host",
"maxPlayers": 8,
"tickRate": 10
},
"networkAllowlist": []
}
Do not invent extra game.json fields. See the manifest.
5. Integrate the SDK
On a Loki play page, call createHostedLokiClient({ projectId }) once at boot. It listens for loki:init, requests the session immediately, and returns an authenticated client. Do not wait for a Create/Join click — the play shell times out around 15 seconds.
import { createHostedLokiClient } from "@lokiplay/sdk";
const client = await createHostedLokiClient({
projectId, // the UUID from the creator desk
fallbackTransport, // optional FirstPartyTransport for local preview
});
const room = client.createSynchronizedRoom({
initialState,
reduce,
});
await room.create();
// or: await room.join({ inviteCode });
Pick createSynchronizedRoom() for turns and discrete events. Pick createRealtimeRoom() only for a continuous host simulation. Do not run both for the same mode. Details: multiplayer.
6. Log in and connect
Login still needs the production API origin in the environment:
LOKI_API_URL=https://api.lokiplay.cc npx lokiplay@0.3.8 login
Open the printed URL, confirm the code, and approve this terminal. Then:
npx lokiplay@0.3.8 connect --project <project-uuid>
That writes .loki/project.json and AGENTS.md. It does not put secrets in the repo.
7. Validate and ship
npx lokiplay@0.3.8 validate
npx lokiplay@0.3.8 ship
ship builds the project, copies game.json into the output, validates, uploads a zip, waits for security review, activates the release, and prints a playable URL. A blocked or quarantined build never becomes that URL.
8. Fine-tune, then play
Open the playable URL. Invite with the 6-digit room code Loki issued. Then keep going: confirm seats and start conditions, fix the lobby, tune the reducer or realtime profile, and re-ship. Do not invent room keys.