diff --git a/content/creator/sdk7/projects/kinds-of-project.md b/content/creator/sdk7/projects/kinds-of-project.md index 720e23e4..6a09b1de 100644 --- a/content/creator/sdk7/projects/kinds-of-project.md +++ b/content/creator/sdk7/projects/kinds-of-project.md @@ -44,7 +44,7 @@ Worlds offer a few options to customize the scene sky box, which aren't availabl ## Global Scenes Global scenes can transform the already existing landscape of Decentraland, adding layers of interactivity and gameplay. These are scenes that are not constrained to only run on certain parcels of LAND or certain Worlds. Players carry them with them wherever they go. - + ### Smart Wearables diff --git a/content/creator/sdk7/projects/portable-experiences.md b/content/creator/sdk7/projects/portable-experiences.md index a5369eb9..8d447fa2 100644 --- a/content/creator/sdk7/projects/portable-experiences.md +++ b/content/creator/sdk7/projects/portable-experiences.md @@ -9,7 +9,11 @@ url: /creator/development-guide/sdk7/portable-experiences/ weight: 4 --- -Portable experiences are essentially scenes that are not constrained to parcels of land. Players can carry these with them anywhere they go in Decentraland, adding a new layer of content over their experience. +{{< hint warning >}} +**š Note**: Portable expereinces are currently not supported in the Decentraland desktop client. +{{< /hint >}} + + diff --git a/content/creator/sdk7/projects/scene-metadata.md b/content/creator/sdk7/projects/scene-metadata.md index fe0698f4..a5b1530b 100644 --- a/content/creator/sdk7/projects/scene-metadata.md +++ b/content/creator/sdk7/projects/scene-metadata.md @@ -146,14 +146,14 @@ Currently, only the following feature is handled like this: - **Voice Chat**: Refers to players using their microphones to have conversations over voice chat with other nearby players. -- **Disable Portable Experiences**: This setting will set the behavior for any portable experience of a player while standing inside the your scene. This includes not only [portable experiences]({{< ref "/content/creator/sdk7/projects/portable-experiences.md" >}}) but also [smart wearables]({{< ref "/content/creator/sdk7/projects/smart-wearables.md" >}}). With this setting, you can chose to either keep them all enabled (default), disable them, or hide their UI. This is useful for scenes where portable experiences might give an unfair advantage to some players, for example using a jetpack in a parkour challenge. It's also recommended to prevent these in scenes where blockchain transactions take place, and where a malicious portable experience could potentially impersonate the sceneĀ“s UI. +- **Disable Portable Experiences**: This setting will set the behavior for any smart wearables or portable experience of a player while standing inside the your scene. This includes both [portable experiences]({{< ref "/content/creator/sdk7/projects/portable-experiences.md" >}}) and [smart wearables]({{< ref "/content/creator/sdk7/projects/smart-wearables.md" >}}). With this setting, you can chose to either keep them all enabled (default), or disable them. This is useful for scenes where smart wearables might give an unfair advantage to some players, for example using a jetpack in a parkour challenge. It's also recommended to prevent these in scenes where blockchain transactions take place, and where a malicious global scene could potentially impersonate the sceneĀ“s UI. On the `scene.json` file, these toggles are managed under `featureToggles`. The corresponding features are enabled by default, unless specified as _disabled_ in the `scene.json` file. ```json "featureToggles": { "voiceChat": "disabled", - "portableExperiences": "enabled" | "disabled" | "hideUi" + "portableExperiences": "enabled" | "disabled" }, ``` @@ -318,26 +318,24 @@ This example spawns a player on _5, 1, 4_ looking East at _10, 1, 4_. If the spa The `requiredPermissions` property manages various controlled features that could be used in an abusive way and damage a player's experience. {{< hint warning >}} -**š Note**: Permissions are only relevant in [portable experiences]({{< ref "/content/creator/sdk7/projects/portable-experiences.md" >}}) and [smart wearables]({{< ref "/content/creator/sdk7/projects/smart-wearables.md" >}}). Normal scenes (both in parcels or in Worlds) are not affected by these permissions, and are free to use the corresponding functionality. +**š Note**: Permissions are only relevant in [smart wearables]({{< ref "/content/creator/sdk7/projects/smart-wearables.md" >}}) and [portable experiences]({{< ref "/content/creator/sdk7/projects/portable-experiences.md" >}}). Normal scenes (both in parcels or in Worlds) are not affected by these permissions, and are free to use the corresponding functionality. {{< /hint >}} -The corresponding features are blocked from being used by the scene, unless the permission is requested in the `scene.json` file. +The corresponding features are blocked from being used by the global scene, unless the permission is requested in the `scene.json` file. ```json "requiredPermissions": [ - "ALLOW_TO_MOVE_PLAYER_INSIDE_SCENE", + "USE_WEB3_API", "OPEN_EXTERNAL_LINK", ], ``` Currently, the following permissions are managed on smart wearables and portable experiences: - -- `ALLOW_TO_MOVE_PLAYER_INSIDE_SCENE`: Refers to [moving a Player]({{< ref "/content/creator/sdk7/interactivity/player-avatar.md#move-player" >}}) -- `ALLOW_TO_TRIGGER_AVATAR_EMOTE`: Refers to [Playing emotes on the player avatar]({{< ref "/content/creator/sdk7/interactivity/player-avatar.md" >}}) - `USE_WEB3_API`: Refers to interacting with the player's browser wallets, to make transactions or sign messages. -- `USE_FETCH`: Refers to sending http requests to 3rd party servers, using `fetch` or `signedFetch` + + If a `requiredPermissions` property doesn't exist in your `scene.json` file, create it at root level in the json tree. diff --git a/content/creator/sdk7/projects/smart-wearables.md b/content/creator/sdk7/projects/smart-wearables.md index f276e3e7..388464c0 100644 --- a/content/creator/sdk7/projects/smart-wearables.md +++ b/content/creator/sdk7/projects/smart-wearables.md @@ -9,9 +9,9 @@ url: /creator/development-guide/sdk7/smart-wearables/ weight: 4 --- -Smart wearables are a type of global scene. Like [portable experiences]({{< ref "/content/creator/sdk7/projects/portable-experiences.md">}}), they are gameplay that players take with them as they move through the metaverse. For example, while running a global scene, a player could take a snowball from the ground in Genesis Plaza, walk away to another scene, and throw the snowball to another player whoās also playing the same game. +Smart wearables are a kind of global scene that is associated to a wearable, and activated based on if the player is using that wearable. These global scenes are turned on when the player puts on a certain item of clothing, and turned off when the player takes off the item. -Smart wearables are portable experiences that are turned on when the player puts on a certain item of clothing. Smart wearables can grant players new abilities, like a jetpack that lets them fly, or add a new layer of content on top of the rest of the world, like randomly placing coins to be collected throughout the whole of genesis city. +Smart wearables can grant players new abilities, like a jetpack that lets them fly, or add a new layer of content on top of the rest of the world, like randomly placing coins to be collected throughout the whole of genesis city. {{< hint warning >}} **š Note**: Smart Wearables can only be created using SDK 7. @@ -23,17 +23,19 @@ The **Creator Hub** doesn't currently support creating Smart Wearables projects. ### Using the CLI -1. Open a command line in a new folder and run +Open a command line in a new folder and run `npx @dcl/sdk-commands init --project smart-wearable` This command creates the basic files and structure for a new smart wearable. +You can also copy the project template from the Github repository: [Smart Wearable Sample](https://github.com/decentraland/smart-wearable-sample). + ## The files in the template The folder of a brand new Smart Wearable project is very similar to that of a [Decentraland scene]({{< ref "/content/creator/sdk7/projects/scene-files.md">}}), but you will notice the following differences: -- `wearable.json` includes all of the metadata for the portable experience +- `wearable.json` includes all of the metadata for the smart wearable - Thereās a placeholder 3D model (glasses.glb) and thumbnail (glasses.png) for a pair of dark glasses. You should replace these with the actual wearable you are creating - `scene.json` is a lot shorter, it doesnāt include properties that are irrelevant to a wearable, like parcels or spawn points @@ -43,27 +45,33 @@ The default `wearable.json` file looks like this: ```json { - "data": { - "replaces": [], - "hides": [], - "tags": ["special", "new", "eyebrows"], - "representations": [ - { - "bodyShapes": [ - "urn:decentraland:off-chain:base-avatars:BaseMale", - "urn:decentraland:off-chain:base-avatars:BaseFemale" - ], - "mainFile": "glasses.glb", - "contents": ["glasses.glb"], - "overrideHides": [], - "overrideReplaces": [] - } - ], - "category": "eyewear" - }, - "name": "Portable Experience Example", - "description": "This feature is in Alpha state.", - "rarity": "mythic" + "data": { + "replaces": [], + "hides": [], + "tags": [ + "special", + "new", + "eyebrows" + ], + "representations": [ + { + "bodyShapes": [ + "urn:decentraland:off-chain:base-avatars:BaseMale", + "urn:decentraland:off-chain:base-avatars:BaseFemale" + ], + "mainFile": "glasses.glb", + "contents": [ + "glasses.glb" + ], + "overrideHides": [], + "overrideReplaces": [] + } + ], + "category": "eyewear" + }, + "name": "Smart Wearable Example", + "description": "Smart wearable desription here.", + "rarity": "mythic" } ``` @@ -148,24 +156,30 @@ You must include an image named `thumbnail.png` at root level in your folder. Th Chose an image that sets player expectations and properly represents your creation. +This image can also be set in the Builder UI after uploading the smart wearable. + ## The Preview -Running a preview of a portable experience is just like running that of a scene, simply click **Run Scene** on the Decentraland tab, or run `npm run start` on the command line. If the `wearable.json` file is properly configured and the project is recognized as a smart wearable, youāll notice that all the visible around you are the default empty parcels. In this preview mode, you are not restricted to any set of parcels, you can add 3D models or sounds anywhere in the world. +Running a preview of a portable experience is just like running that of a scene, simply click *Preview** on the Creator Hub, or run `npm run start` on the command line. If the `wearable.json` file is properly configured and the project is recognized as a smart wearable, youāll notice that all the visible around you are the default empty parcels. In this preview mode, you are not restricted to any set of parcels, you can add 3D models or sounds anywhere in the world. -To test how the smart wearable behaves in the context of a scene, you can also run a preview of your wearable at the same time as you run a preview of one or several scenes by using a [Workspace]({{< ref "/content/creator/sdk7/projects/workspaces.md" >}}). For example, you can run your smart wearable together with the [Genesis Plaza](https://github.com/decentraland-scenes/Genesis-Plaza) scene to test how it behaves on a busy scene, while on an elevator, etc. +To test how the smart wearable behaves in the context of a scene, upload the smart wearable to the Builder and click the **See in world** button. This will open Decentraland with the wearable avialable in your backpack. + + ## Tips +When writing the code for your smart wearable, keep the following in mind: + - When positioning an entity, note that positions are global, relative to the 0,0 coordinates of Genesis Plaza. +- Other players surrounding you will not see or hear the entities in your smart wearable's global scene, as they don't have the same global scene loaded. - To react to nearby players: - See [Fetch all players]({{< ref "/content/creator/sdk7/interactivity/user-data.md#fetch-all-players" >}}) to know how to obtain data from other players in the surroundings. - Be mindful that the loading of the smart wearable, surrounding scenes and other players may occur in different orders depending on the situation. If the player enters Decentraland with the smart wearable already on, itās likely that your wearable's global scene will load before other players do. On the other hand, if the player first loads into a scene and then puts on the wearable, itās likely that other players will already be loaded by the time the wearable's scene starts running. - - For multiplayer experiences, wait till the player is connected to an island inside their realm. Fetch the realm data and check for the āroomā field. If the āroomā field is null, the player is not yet connected to an island and other players wonāt be loaded yet. You can periodically check this every 1 second till the āroomā field is present, and only initialize your logic then. + - The `syncEntity` method can't be used to sync entities with other players. To have multiplayer behavior between players that are wearing the same wearable, use an external server to send information between players, see [3rd party servers]({{< ref "/content/creator/sdk7/networking/authoritative-servers.md" >}}). - To interact with surrounding scenes: - - You canāt directly send any instructions to nearby scenes or other portable experiences, the `messageBus` is currently sandboxed for each portable experience/scene. - - You can use an intermediate server to send information between the portable experience and a scene. - - If you do a raycast, you can detect hits against the colliders of entities from the surrounding scenes. This can tell you the exact hit location, normal direction, and even the entity name and mesh name of the 3D model. This only works when hitting entities on scenes written with SDK7. -- Kill a portable experience: Run the `kill()` method to self-terminate a portable experience. + - You canāt directly send any instructions to nearby scenes or other smart wearables, the `messageBus` is currently sandboxed for each smart wearable. + - You can use an intermediate server to send information between the smart wearable and a scene. + ## Publish @@ -179,9 +193,9 @@ To publish your smart wearable: **š Note**: The output of `npm run pack` will indicate the size of the uncompressed exported project, it must be under 3MB. If larger than that, it wonāt be accepted by the builder. {{< /hint >}} -3. Open the Builder, open the Collections tab, click + to upload a new wearable. +3. Open the Builder, open the Collections tab, click **Create Collection** and select **Wearables or Emotes** , then name your collection and click **Create**. -4. Drag your compressed `smart-wearable.zip` file into the Builder, verify that all the information is accurate. +4. Click the **Add Items** button, then drag your compressed `smart-wearable.zip` file into the Builder, verify that all the information is accurate. > Note: If your wearable contains different model representations, you need to do a workaround: > @@ -210,10 +224,10 @@ To publish your smart wearable: >