@dcl-regenesislabs/opendcl 0.1.4-22810348207.commit-485ab64 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl-regenesislabs/opendcl",
3
- "version": "0.1.4-22810348207.commit-485ab64",
3
+ "version": "0.1.4",
4
4
  "description": "AI coding assistant for Decentraland SDK7 scene development",
5
5
  "type": "module",
6
6
  "bin": {
@@ -67,5 +67,5 @@
67
67
  "prompts/",
68
68
  "context/"
69
69
  ],
70
- "commit": "485ab6416153a8d74fbbfe4d94fbdd240a1e2e88"
70
+ "commit": "4a4167760132e6b2be9adbf0486f4b061222db69"
71
71
  }
@@ -11,31 +11,37 @@ For basic CRDT multiplayer (no server), see the `multiplayer-sync` skill instead
11
11
 
12
12
  ## Setup
13
13
 
14
- Install the auth-server SDK branch:
14
+ ### 1. Install the auth-server SDK branch (MANDATORY)
15
+
16
+ You **must** use the `auth-server` tag — the standard `@dcl/sdk` does NOT include authoritative server APIs (`isServer`, `registerMessages`, `Storage`, `EnvVar`, etc.):
15
17
 
16
18
  ```bash
17
19
  npm install @dcl/sdk@auth-server
18
20
  ```
19
21
 
20
- Your `scene.json` must include a world name:
22
+ ### 2. Configure scene.json
23
+
24
+ Your `scene.json` **must** include these properties:
25
+
26
+ - **`authoritativeMultiplayer: true`** — enables the authoritative server runtime.
27
+ - **`worldConfiguration.name`** — identifies the world for deployment, Storage, and EnvVar.
28
+ - **`logsPermissions`** — array of wallet addresses allowed to see server logs in the console. Without this, server `console.log()` output is hidden.
21
29
 
22
30
  ```json
23
31
  {
32
+ "authoritativeMultiplayer": true,
24
33
  "worldConfiguration": {
25
- "name": "my-world-name"
26
- }
34
+ "name": "my-world-name.dcl.eth"
35
+ },
36
+ "logsPermissions": ["0xYourWalletAddress"]
27
37
  }
28
38
  ```
29
39
 
30
- Run the scene:
40
+ ### 3. Run the scene
31
41
 
32
- ```bash
33
- # With authoritative server (required for this pattern)
34
- npx @dcl/hammurabi-server@next
42
+ Just use the normal preview — it automatically starts the authoritative server in the background when `authoritativeMultiplayer: true` is set in scene.json.
35
43
 
36
- # Standard dev server (no auth server, for client-only testing)
37
- npm run start
38
- ```
44
+ > **Debugging note (do NOT tell the user to run this):** Under the hood, the preview runs `npx @dcl/hammurabi-server@next`. If the auth server isn't starting, check that the hammurabi process is running and look for errors in its output.
39
45
 
40
46
  ## Server/Client Branching
41
47
 
@@ -170,22 +176,18 @@ room.onMessage('gameEvent', (data) => {
170
176
  })
171
177
  ```
172
178
 
173
- ### Wait for Room Connection
179
+ ### Wait for State Sync
174
180
 
175
- Before sending messages from the client, wait for the connected scene room:
181
+ Before sending messages from the client, wait until state is synchronized:
176
182
 
177
183
  ```typescript
178
- import { engine } from '@dcl/sdk/ecs'
179
- import { RealmInfo } from '@dcl/sdk/ecs'
184
+ import { isStateSynchronized } from '@dcl/sdk/network'
180
185
 
181
- let joined = false
182
186
  engine.addSystem(() => {
183
- if (joined) return
184
- const realm = RealmInfo.getOrNull(engine.RootEntity)
185
- if (realm?.isConnectedSceneRoom) {
186
- joined = true
187
- room.send('playerJoin', { displayName: 'Player' })
188
- }
187
+ if (!isStateSynchronized()) return
188
+
189
+ // Safe to send messages now
190
+ room.send('playerJoin', { displayName: 'Player' })
189
191
  })
190
192
  ```
191
193
 
@@ -321,9 +323,10 @@ Put synced components and messages in `shared/` so both server and client import
321
323
  ## Important Notes
322
324
 
323
325
  - **Use `Schemas.Int64` for timestamps**: `Schemas.Number` corrupts large numbers (13+ digits). Always use `Schemas.Int64` for values like `Date.now()`.
324
- - **Room readiness**: Clients must wait for `RealmInfo.get(engine.RootEntity).isConnectedSceneRoom` before sending messages.
326
+ - **State sync readiness**: Clients must wait for `isStateSynchronized()` (from `@dcl/sdk/network`) to return `true` before sending messages.
325
327
  - **Custom vs built-in validation**: Custom components use global `validateBeforeChange((value) => ...)`. Built-in components (Transform, GltfContainer) use per-entity `validateBeforeChange(entity, (value) => ...)`.
326
328
  - **Single codebase**: Both server and client run the same `index.ts` entry point. Use `isServer()` to branch.
327
329
  - **No Node.js APIs**: The DCL runtime uses sandboxed QuickJS — no `fs`, `http`, etc. `setTimeout`/`setInterval` are supported. Use SDK-provided APIs (Storage, EnvVar, engine systems) for server-side operations.
328
- - **SDK branch**: The auth-server pattern requires `@dcl/sdk@auth-server`, not the standard `@dcl/sdk` package.
330
+ - **SDK branch (MANDATORY)**: The auth-server pattern requires `npm install @dcl/sdk@auth-server`, not the standard `@dcl/sdk`. Without it, `isServer()`, `registerMessages()`, `Storage`, and `EnvVar` are unavailable.
331
+ - **scene.json required fields**: `authoritativeMultiplayer: true` must be set, and `logsPermissions: ["0xWalletAddress"]` must list wallet addresses that should see server logs.
329
332
  - For basic CRDT multiplayer without a server, see the `multiplayer-sync` skill.