@unboxy/phaser-sdk 0.2.8 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SDK-GUIDE.md CHANGED
@@ -11,6 +11,39 @@ Reference for AI agents building games on the Unboxy platform. Tracks the **inst
11
11
  - `unboxy.gameData` — **per-game** key-value store (read by anyone; write requires auth)
12
12
  - `unboxy.rooms` — **multiplayer rooms** (server-authoritative state sync, requires sign-in and host support)
13
13
 
14
+ ## `createUnboxyGame` options
15
+
16
+ | field | type | note |
17
+ |-------|------|------|
18
+ | `width` | `number` | required |
19
+ | `height` | `number` | required |
20
+ | `scenes` | `Phaser.Scene class[]` | required |
21
+ | `backgroundColor` | `string` | defaults to `'#1a1a2e'` |
22
+ | `pixelArt` | `boolean` | defaults to `false` |
23
+ | `physics` | `Phaser.Types.Core.PhysicsConfig` | defaults to arcade physics, no gravity |
24
+ | `plugins` | `Phaser.Types.Core.PluginObject` | forwarded as-is into the Phaser `GameConfig`. **Since 0.2.9.** Earlier versions silently dropped this field. |
25
+
26
+ Any field not listed is ignored. If you need something else (e.g. `callbacks`, custom `render` options), use plain `new Phaser.Game(config)` instead of `createUnboxyGame`.
27
+
28
+ ### Registering third-party Phaser plugins (e.g. rexUI)
29
+
30
+ Pass them via the `plugins` option — do NOT try to register them inside a scene's `preload`:
31
+
32
+ ```ts
33
+ import VirtualJoystickPlugin from 'phaser3-rex-plugins/plugins/virtualjoystick-plugin.js';
34
+
35
+ createUnboxyGame({
36
+ // ...
37
+ plugins: {
38
+ global: [
39
+ { key: 'rexVirtualJoystick', plugin: VirtualJoystickPlugin, start: true },
40
+ ],
41
+ },
42
+ });
43
+ ```
44
+
45
+ Then in a scene: `this.plugins.get('rexVirtualJoystick').add(this, { ... })`.
46
+
14
47
  ## Platform services
15
48
 
16
49
  Initialize once at module load — resolves the host (home-ui, standalone, etc.) and returns a bound instance. Scenes read from the resulting promise.
@@ -348,6 +381,8 @@ Don't blindly apply interpolation to everything. It's wrong for a chess piece an
348
381
 
349
382
  ## Changelog
350
383
 
384
+ - **0.2.10** — docs: added a `createUnboxyGame` options table (including the new `plugins` field) and a third-party Phaser plugin registration example. No code changes; version bumped so existing workspaces pick up the new guidance via `npm update @unboxy/phaser-sdk`.
385
+ - **0.2.9** — `createUnboxyGame` now forwards the optional `plugins` field to Phaser's `GameConfig`. Previously the option was accepted at the call site but silently dropped — any `phaser3-rex-plugins` (or similar) registration never took effect, and `this.plugins.get(key)` returned undefined at runtime. Purely additive; no effect on games that don't pass `plugins`. Lets the `phaser-rex-touch` agent skill work end-to-end.
351
386
  - **0.2.8** — docs: added "Making remote motion feel smooth" section to the multiplayer chapter with concrete examples for interpolation (continuous motion), extrapolation (projectiles), and snap (discrete/turn-based/infrequent). No code changes — version bumped so existing workspaces pick up the new guidance via `npm update @unboxy/phaser-sdk`.
352
387
  - **0.2.7** — fixed handshake race on slow-mounting hosts. `PostMessageTransport.connect` now retries `unboxy:hello` every 200 ms until `unboxy:init` arrives (previously one-shot → lost on Android/mobile where React mounted after the iframe first fired hello). Default handshake timeout bumped from 2 s → 5 s.
353
388
  - **0.2.6** — redesigned `unboxy.rooms` around two generic primitives: delta-synced KV state (`room.player.set/get/delete`, `room.data.set/get/delete`) + transient relay (`room.send` / `room.on`). Server no longer bakes in game-specific fields like x/y/color/ready or a `move` handler — games define their own shapes via opaque JSON values, same contract as `gameData` / `saves`.
@@ -12,6 +12,8 @@ export interface UnboxyGameOptions {
12
12
  pixelArt?: boolean;
13
13
  /** Custom physics config (default: arcade with no gravity) */
14
14
  physics?: Phaser.Types.Core.PhysicsConfig;
15
+ /** Phaser plugin registrations (e.g. `phaser3-rex-plugins` virtual joystick) */
16
+ plugins?: Phaser.Types.Core.PluginObject;
15
17
  }
16
18
  /**
17
19
  * Create an Unboxy-enhanced Phaser game instance.
@@ -23,6 +23,7 @@ export function createUnboxyGame(options) {
23
23
  default: 'arcade',
24
24
  arcade: { gravity: { x: 0, y: 0 }, debug: false },
25
25
  },
26
+ ...(options.plugins ? { plugins: options.plugins } : {}),
26
27
  scene: options.scenes,
27
28
  };
28
29
  const game = new Phaser.Game(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboxy/phaser-sdk",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Unboxy Phaser 3 SDK — game infrastructure for the Unboxy platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",