incanto 0.79.2 → 0.79.3

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/editor/index.html CHANGED
@@ -5,8 +5,9 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Incanto Scene Editor</title>
7
7
  <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><rect width='16' height='16' rx='3' fill='%236ee7dc'/><text x='8' y='12' text-anchor='middle' font-size='11' font-family='monospace' fill='%230e1018'>i</text></svg>" />
8
- <script type="module" crossorigin src="./assets/index-DM_zXnSe.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-CMOFrNki.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="./assets/GameServer-BlrNxR5M.js">
10
+ <link rel="modulepreload" crossorigin href="./assets/errors-BlwBM544.js">
10
11
  </head>
11
12
  <body>
12
13
  <!-- The shell is built by src/shell.ts (generated from this file by
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incanto",
3
- "version": "0.79.2",
3
+ "version": "0.79.3",
4
4
  "description": "Vibe-coding-first web game engine SDK — JSON-driven scenes on three.js",
5
5
  "keywords": [
6
6
  "game-engine",
@@ -52,7 +52,7 @@ Authority rules:
52
52
  ## Scene JSON
53
53
 
54
54
  ```json
55
- "multiplayer": { "room": "auto" },
55
+ "multiplayer": { "room": "arena" },
56
56
  "root": { ..., "children": [
57
57
  { "name": "Player", "type": "CharacterBody2D",
58
58
  "network": { "mode": "owner", "sync": ["position", "Skin.animation"], "throttleMs": 50 },
@@ -205,6 +205,13 @@ Implement `NetworkTransport` (exported from `incanto/net`): `connect`/`disconnec
205
205
  `subscribeRoomCollection`, `onRoomMessage`, `onRoomUserJoin/Leave`). `LoopbackTransport`'s source is the reference
206
206
  implementation — anything that behaves like it works with the whole engine.
207
207
 
208
+ **If your backend does not route rooms through the game's server**, implement the two
209
+ OPTIONAL members instead of answering those two names — `joinRoom(roomId?)` resolving to
210
+ the room actually joined, and `leaveRoom(roomId)`. The engine prefers them when present
211
+ and never sends `remoteFunction('joinRoom')` to that transport. This is what the agent8
212
+ adapter does on SDK 2.x. Implementations that cannot assign a room for `joinRoom()` with
213
+ no argument should REJECT — inventing an id gives you a room nobody else will ever join.
214
+
208
215
  ## Preview: run your REAL server locally (no cloud, no auth)
209
216
 
210
217
  `LoopbackHub` answers only the FIXED built-in protocol — it cannot run your
@@ -257,7 +264,9 @@ Rapier when the scene has bodies; `physics: false` opts out) — without it a
257
264
  `CharacterBody2D` never moves. The first panel's clock pumps `server.tick` (so
258
265
  `$roomTick` runs) — don't add your own. Every panel joins ONE room: a shared scene usually says
259
266
  `multiplayer: { room: "auto" }`, and "auto" means a server-ASSIGNED room, so the
260
- harness pins panels 1..N to the room panel 0 got (`room: 'lobby'` overrides).
267
+ harness pins panels 1..N to the room panel 0 got (`room: 'lobby'` overrides). ("auto"
268
+ is a PREVIEW convenience — the loopback hub and `LocalGameServer` assign one. Live on
269
+ agent8 SDK 2.x nothing can, and incanto refuses it at boot; see "Going live" below.)
261
270
  `dispose()` tears every panel down. Going live is unchanged: ONE
262
271
  client per browser with `createAgent8Server()` as the transport.
263
272
 
@@ -484,10 +493,24 @@ built-in `createAgent8Server()` transport (verse/account/auth auto-resolve via t
484
493
  SDK). Develop against `LoopbackHub`, then drop the `{ transport }` option to go live.
485
494
 
486
495
  **`@agent8/gameserver` 1.10.x and 2.x both work**, which is why the peer range is
487
- `>=1.10.0`. Measured against both packages: every method the adapter touches exists
488
- in each, and 2.x only ADDS — `joinRoom`/`leaveRoom` as first-class calls (incanto does
489
- not use them; the room protocol goes through `remoteFunction` so a game proven on
490
- `LoopbackHub` runs live unchanged) and two `remoteFunction` options.
496
+ `>=1.10.0` — but **2.x took room entry away from the server**, and that is the one
497
+ place the two majors are not interchangeable:
498
+
499
+ | | 1.10.x | 2.x |
500
+ |---|---|---|
501
+ | enter a room | `remoteFunction('joinRoom', [roomId])` → your kernel's `joinRoom` | `GameServer.joinRoom(roomId)` on the CLIENT; the gateway routes the room and the kernel is never asked |
502
+ | leave | `remoteFunction('leaveRoom', […])` | `GameServer.leaveRoom()` — synchronous, returns `void` |
503
+ | `room: "auto"` | server assigns a random room | **gone** — `roomId` is required and there is no matchmaking call |
504
+ | those two names via `remoteFunction` | fine | **throws client-side**: *"joinRoom() is no longer available via remoteFunction(). Use server.joinRoom() directly."* |
505
+
506
+ The adapter feature-detects which SDK it was handed, so you write the same game
507
+ either way. What you cannot keep is `"room": "auto"` on 2.x — nothing can assign a
508
+ room, so incanto refuses it at boot and tells you to name one. **Declare the room**
509
+ (`"multiplayer": { "room": "arena" }`); everyone who passes the same id meets, and a
510
+ game that wants private matches mints an id per match and shares it.
511
+
512
+ Everything else measured equal across the two: every other method the adapter touches
513
+ exists in both, and 2.x adds two `remoteFunction` options.
491
514
 
492
515
  **The SDK's own `react` peer is narrow, in both majors** — `^18.2.0` in 2.x, an exact
493
516
  `19.2.7` in 1.10.2 — so `npm add @agent8/gameserver` fails with `ERESOLVE` on a project
@@ -133,6 +133,19 @@ declare const $asset: {
133
133
 
134
134
  export class Server {
135
135
  // ---- rooms -----------------------------------------------------------------
136
+ // KEEP THESE, and know that on the live platform nothing calls them.
137
+ //
138
+ // SDK 2.x took room entry away from the server: the client calls
139
+ // `GameServer.joinRoom(roomId)`, which asks the gateway to route the room and
140
+ // connects to its Room Server, and the deployed kernel is never consulted. The
141
+ // SDK goes further and REFUSES the old path — `remoteFunction('joinRoom')` and
142
+ // `('leaveRoom')` throw client-side with *"no longer available via
143
+ // remoteFunction()"*, so these two names are the only ones you may not expose
144
+ // as remote functions.
145
+ //
146
+ // They still earn their place: `createLocalGameServer` runs this same class in
147
+ // PREVIEW and enters rooms through them, and a project still on SDK 1.x reaches
148
+ // them for real. Deployed on 2.x they are simply never reached.
136
149
 
137
150
  /** undefined roomId → server-assigned random room; explicit id → shared room. */
138
151
  async joinRoom(roomId?: string): Promise<string> {
@@ -14,7 +14,7 @@
14
14
  "@dimforge/rapier2d-compat": "0.19.3",
15
15
  "@dimforge/rapier3d-compat": "0.19.3",
16
16
  "@pixiv/three-vrm": "^3.5.3",
17
- "incanto": "^0.79.2",
17
+ "incanto": "^0.79.3",
18
18
  "react": "^18.3.1",
19
19
  "react-dom": "^18.3.1",
20
20
  "three": "^0.184.0"
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
- "incanto": "^0.79.2",
14
+ "incanto": "^0.79.3",
15
15
  "react": "^18.3.1",
16
16
  "react-dom": "^18.3.1",
17
17
  "three": "^0.184.0"
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
- "incanto": "^0.79.2",
14
+ "incanto": "^0.79.3",
15
15
  "react": "^18.3.1",
16
16
  "react-dom": "^18.3.1",
17
17
  "three": "^0.184.0"
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
- "incanto": "^0.79.2",
14
+ "incanto": "^0.79.3",
15
15
  "react": "^18.3.1",
16
16
  "react-dom": "^18.3.1",
17
17
  "three": "^0.184.0"
@@ -13,7 +13,7 @@
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
14
  "@dimforge/rapier3d-compat": "0.19.3",
15
15
  "@pixiv/three-vrm": "^3.5.3",
16
- "incanto": "^0.79.2",
16
+ "incanto": "^0.79.3",
17
17
  "react": "^18.3.1",
18
18
  "react-dom": "^18.3.1",
19
19
  "three": "^0.184.0"
@@ -13,7 +13,7 @@
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
14
  "@dimforge/rapier3d-compat": "0.19.3",
15
15
  "@pixiv/three-vrm": "^3.5.3",
16
- "incanto": "^0.79.2",
16
+ "incanto": "^0.79.3",
17
17
  "react": "^18.3.1",
18
18
  "react-dom": "^18.3.1",
19
19
  "three": "^0.184.0"
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./index-DM_zXnSe.js";async function n(e,n){return new a((await t(()=>import(`./GameServer-BlrNxR5M.js`),[],import.meta.url)).GameServer,e,{diagnostics:n})}var r=[500,1e3,2e3,4e3,8e3],i=8,a=class{raw;active=new Map;reconnecting=!1;disposed=!1;diagnostics;wait;constructor(e,t,n){this.diagnostics=n?.diagnostics??null,this.wait=n?.wait??(e=>new Promise(t=>{setTimeout(t,e)})),this.raw=new e({...t})}get account(){return this.raw.account}get connected(){return this.raw.connected}connect(){return this.raw.connected?Promise.resolve(!0):(this.disposed=!1,this.rawConnect())}rawConnect(){return this.raw.connect({onDisconnect:()=>void this.reconnect()})}disconnect(){this.disposed=!0;for(let e of this.active.values())e.off();return this.active.clear(),this.raw.disconnect()}remoteFunction(e,t,n){return this.raw.remoteFunction(e,t,n)}track(e){let t=Symbol(`sub`),n={make:e,off:e()};return this.active.set(t,n),()=>{n.off(),this.active.delete(t)}}async reconnect(){if(!this.disposed&&!this.reconnecting){this.reconnecting=!0;try{for(let t=0;t<i;t++){let n=!1,i=null;try{n=await this.rawConnect()!==!1}catch(e){i=e}if(this.disposed)return;if(n){for(let e of this.active.values())e.off(),e.off=e.make();t>0&&e(this.diagnostics,`info`,`[incanto] multiplayer reconnected after ${t+1} attempts.`);return}t===0&&e(this.diagnostics,`warn`,`[incanto] the multiplayer connection dropped and the server would not take it back${i?` (${i instanceof Error?i.message:String(i)})`:``}. Retrying — other players cannot see this one until it comes back.`);let a=r[Math.min(t,r.length-1)]??8e3;if(await this.wait(a),this.disposed)return}e(this.diagnostics,`error`,`[incanto] multiplayer gave up after ${i} reconnect attempts — this client is offline and the others cannot see it. Call connect() again to retry.`)}finally{this.reconnecting=!1}}}subscribeRoomState(e,t){return this.track(()=>this.raw.subscribeRoomState(e,t))}subscribeRoomMyState(e,t){return this.track(()=>this.raw.subscribeRoomMyState(e,t))}subscribeRoomAllUserStates(e,t){return this.track(()=>this.raw.subscribeRoomAllUserStates(e,e=>{let n={};for(let t of e??[]){if(!t||typeof t.account!=`string`||t.__leaved)continue;let{account:e,__updated:r,__leaved:i,...a}=t;n[e]=a}t(n)}))}subscribeRoomCollection(e,t,n){return this.track(()=>this.raw.subscribeRoomCollection(e,t,({items:e})=>{let t={};for(let n of e??[])n&&typeof n.__id==`string`&&(t[n.__id]=n);n(t)}))}onRoomMessage(e,t,n){return this.track(()=>this.raw.onRoomMessage(e,t,n))}onRoomUserJoin(e,t){return this.track(()=>this.raw.onRoomUserJoin(e,t))}onRoomUserLeave(e,t){return this.track(()=>this.raw.onRoomUserLeave(e,t))}subscribeGlobalState(e){return this.track(()=>this.raw.subscribeGlobalState(e))}subscribeGlobalMyState(e){return this.track(()=>this.raw.subscribeGlobalMyState(e))}subscribeGlobalUserState(e,t){return this.track(()=>this.raw.subscribeGlobalUserState(e,t))}subscribeGlobalCollection(e,t){return this.track(()=>this.raw.subscribeGlobalCollection(e,({items:e})=>{let n={};for(let t of e??[])t&&typeof t.__id==`string`&&(n[t.__id]=t);t(n)}))}subscribeAsset(e,t){return this.track(()=>this.raw.subscribeAsset(e,t))}onGlobalMessage(e,t){return this.track(()=>this.raw.onGlobalMessage(e,t))}};export{n as createAgent8Server};