> ## Documentation Index
> Fetch the complete documentation index at: https://docs.musterbox.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Cocos Creator

> Integrate the MusterBox SDK with Cocos Creator 3.8+.

The Cocos adapter (`@musterbox/cocos`) is a TypeScript binding for Cocos
Creator **3.8+**. Package `musterbox-cocos-1.0.0.tgz`.

## Install

```bash theme={"dark"}
# dist/cocos/musterbox-cocos-1.0.0.tgz
# Extension Manager > Add dependency from file (or add to package.json)
npm install ./musterbox-cocos-1.0.0.tgz
```

## Initialize

```ts theme={"dark"}
import { MusterBox } from "@musterbox/cocos";

const box = new MusterBox();
box.initialize({
  gameId: "my-arena-game",
  gameKey: "gk_...",
  environment: "sandbox",
});
box.start();
```

## Authenticate and open a session

```ts theme={"dark"}
box.authenticate({ identifier: "player@example.com", password: "secret" });
const ctx = box.openSession("sandbox", 1042);
// ctx.sessionId, ctx.token, ctx.context { tournamentId, matchId, participantId, slot }
```

## Events

```ts theme={"dark"}
box.submitEvent("match.start", { mode: "arena" });
box.on("session", (evt) => { /* session lifecycle events */ });
box.on("wallet", (evt) => { /* wallet updates */ });
box.on("status", (evt) => { /* status transitions */ });
```

## Support matrix

| Cocos Creator | SDK   | Package            |
| ------------- | ----- | ------------------ |
| 3.8+          | 1.0.0 | `@musterbox/cocos` |

Next: [Defold](/engines/defold).
