Defining a Quest
Below is the full Quest schema as a Typescript type:
{
name: string,
description: string,
imageUrl: string,
definition: {
steps: {
id: string,
description: string,
tasks: {
id: string,
description: string,
actionItems: {
type: string,
parameters: {[key: string]: string]}
}[]
}[]
}[],
connections: {
stepFrom: string,
stepTo: string
}[]
},
reward: {
hook: {
webhookUrl: string,
requestBody: { [key: string]: string } | null
},
items: {
name: string,
imageLink: string
}[]
} | null,
}
Basic fields #
name: The name of the Quest. This name is displayed in Decentraland.description: A short description of the Quest, to give the player some idea of what the Quest is about.imageUrl: URL to an image to display in Decentraland along with the quest.
Steps definition section #
The definition field is the most important section, as it defines the actual steps and their order.
steps: An array of steps. Each step has anid, adescriptionand an array oftasks. Steps are ordered, which means that a player will need to go through each of them, fulfilling each of their tasks in other to advance to the next one in the definition.id: A unique identifier of the step.description: A short description of the step. This information is suitable to be used as a display name or human friendly label for the current step to be seen by players of the quest through the HUD.tasks: An array of tasks that the player has to complete to consider the step as done. Each task has anid, adescriptionand an array ofactionItems. The order of the tasks in a step is not important, the player will need to fulfill each of them to advance to the next one.-
idA unique identifier of the task. -
descriptionA short description of the task. This information is suitable to be used as a display name or human friendly label for the current task to be seen by players of the quest through the HUD. -
actionItems: An array of action items that the player has to complete to consider the task as done. The order of the actions defined is not important, the player is able to fulfill each of the different items in a single task in any order. Each action item has atypeand aparametersfield.type: The type of the action item. Find the supported types here .parameters: An object with the parameters needed to complete the action item. The parameters are depend on the type of the action item. Find the supported parameters here .
Note:
actionItemswill not be publicly available for anyone but the owner of the quest.
-
connections: An array of connections. Each connection has astepFromand astepTofield. The connections define the order of the steps. Steps that don’t have astepFromin this array are considered the starting steps of the Quest. Steps that don’t have astepToin this array are considered the ending steps of the Quest. Note that one step can lead to multiple steps at once.stepFrom: Theidof the step where the connection starts.stepTo: Theidof the step where the connection ends.
The relation between steps, tasks, and action items is as follows:
- A Quest may have multiple Steps
- Each Step can may have multiple Tasks
- Each Task may have multiple Action items.
To complete each of these:
- To complete a Quest, you must complete all ending steps (steps with no
stepTofield in theconnectionssection). - To complete a Step, you must complete all its Tasks
- To complete a Task, you must complete all its Action items
Rewards section #
Finally, let’s take a look at the reward section. This section defines the reward that players will receive after completing the quest. It’s not mandatory for a Quest to give a reward to the player, this section is optional.
hook: An object with two fields:webhookUrlandrequestBody.webhookUrl: The URL of the webhook that is called when the Quest is completed.requestBody: An optional object with parameters that are sent to the webhook. The webhook is called via a POST request with therequestBodyas the body of the request.
items: An array of items. Each items is a reward that the Quest gives to each player after completing the Quest. Each item has anameand animageLinkfield.name: The name of the item.imageLink: The URL of the image that is used to display the item on Decentraland.
Read more about the Quest’s rewards here .
Action Items #
Action items are the smallest unit of work that the player must complete. All action items in a task must be completed to consider the task as done.
The following set of types are supported, each with their corresponding parameters.
-
Location: This action item is used to check if the player is at specific coordinates. This action is detected by the Quest Client library’s system helpers. The
parametersare the coordinates of a parcel of LAND on the Decentraland map. Theparametersare:x: The x coordinate of the location.y: The y coordinate of the location.
{
type: "LOCATION",
parameters: { "x": string, "y": string }
}
-
Jump: This action item is used to check if the player has jumped. This action is detected by the Quest Client library’s system helpers. The
parametersare the coordinates of parcel of LAND on the Decentraland map where the player has to jump. Theparametersare:x: The x coordinate of the location.y: The y coordinate of the location.
{
type: "JUMP",
parameters: { "x": string, "y": string }
}
-
Emote: This action item is used to check if the player has played an emote. This action is detected by the Quest Client library’s system helpers. The
parametersare the coordinates of the parcel of LAND on the Decentraland map where the player has to play the emote, and theidof the emote that the player has to play. Theparametersare:x: The x coordinate of the location.y: The y coordinate of the location.id: Theidof the emote that the player has to play.
{
type: "EMOTE",
parameters: { "x": string, "y": string, "id": string }
}
-
Custom: This action item is used to check if the player has completed a custom action. This action is a “third-party” action, so the Quest Creator is responsible for sending the event to the Quest Service when it occurs. There is only one field within
parameters. The field is:id: Theidof the custom action that the player has to complete.
{
type: "CUSTOM",
parameters: { "id": string }
}
An example of a CUSTOM action item could be a “click a box”, or “kill 10 zombies”. The Quest Creator is responsible for sending the event to the Quest Service when the player has completed the action.
💡 Tip: If the player must repeat a same action multiple times, add the same action item more than once within the actionItems array.
Examples of Defined Quests #
Linear Quest #
A linear Quest “Z World”, with just only two step and with CUSTOM action types:
{
"name": "Z World",
"description": "Zombies World",
"imageUrl": "https://the-image-u-want-to-be-displayed-on-dcl-explorer.com",
"definition": {
"steps": [
{
"id": "STEP_1",
"description": "First Step",
"tasks": [
{
"id": "STEP_1_1",
"description": "First Task of First Step",
"actionItems": [
{
"type": "CUSTOM",
"parameters": {
"id": "CUSTOM_EVENT_1"
}
}
]
}
]
},
{
"id": "STEP_2",
"description": "Second Step",
"tasks": [
{
"id": "STEP_2_1",
"description": "First Task of Second Step",
"actionItems": [
{
"type": "CUSTOM",
"parameters": {
"id": "CUSTOM_EVENT_2"
}
}
]
}
]
}
],
"connections": [
{
"stepFrom": "STEP_1",
"stepTo": "STEP_2"
}
]
}
}
Linear Quest 2 #
A linear Quest “Z World”, with 3 steps and with CUSTOM, LOCATION ad JUMP action types:
{
"name": "Z World",
"description": "Zombies World",
"imageUrl": "https://the-image-u-want-to-be-displayed-on-dcl-explorer.com",
"definition": {
"steps": [
{
"id": "STEP_1",
"description": "First Step",
"tasks": [
{
"id": "STEP_1_1",
"description": "First Task of First Step",
"actionItems": [
{
"type": "CUSTOM",
"parameters": {
"id": "CUSTOM_EVENT_1"
}
}
]
}
]
},
{
"id": "STEP_2",
"description": "Second Step",
"tasks": [
{
"id": "STEP_2_1",
"description": "First Task of Second Step",
"actionItems": [
{
"type": "LOCATION",
"parameters": {
"x": "100",
"y": "-101"
}
}
]
}
]
},
{
"id": "STEP_3",
"description": "Third Step",
"tasks": [
{
"id": "STEP_3_1",
"description": "First Task of Thitd Step",
"actionItems": [
{
"type": "JUMP",
"parameters": {
"x": "105",
"y": "-101"
}
}
]
}
]
}
],
"connections": [
{
"stepFrom": "STEP_1",
"stepTo": "STEP_2"
},
{
"stepFrom": "STEP_2",
"stepTo": "STEP_3"
}
]
}
}
Linear Quest 3 #
A linear Quest “Z World”, similar to “Linear Quest 2” but this one gives rewards to its players. It uses https://the-rewards-webhook-url.com/rewards as the webhook URL, so this endpoint will be called when a user completes this Quest. The request to this server includes a JSON in the Request Body. The JSON has two placeholders that are replaced by the Quests Server with the actual values. The rewards include only one item called “Zombie Head”, with the image https://the-wearable-item-image.com:
{
"name": "Z World",
"description": "Zombies World",
"imageUrl": "https://the-image-u-want-to-be-displayed-on-dcl-explorer.com",
"definition": {
"steps": [
{
"id": "STEP_1",
"description": "First Step",
"tasks": [
{
"id": "STEP_1_1",
"description": "First Task of First Step",
"actionItems": [
{
"type": "CUSTOM",
"parameters": {
"id": "CUSTOM_EVENT_1"
}
}
]
}
]
},
{
"id": "STEP_2",
"description": "Second Step",
"tasks": [
{
"id": "STEP_2_1",
"description": "First Task of Second Step",
"actionItems": [
{
"type": "LOCATION",
"parameters": {
"x": "100",
"y": "-101"
}
}
]
}
]
},
{
"id": "STEP_3",
"description": "Third Step",
"tasks": [
{
"id": "STEP_3_1",
"description": "First Task of Third Step",
"actionItems": [
{
"type": "JUMP",
"parameters": {
"x": "105",
"y": "-101"
}
}
]
}
]
}
],
"connections": [
{
"stepFrom": "STEP_1",
"stepTo": "STEP_2"
},
{
"stepFrom": "STEP_2",
"stepTo": "STEP_3"
}
]
},
"reward": {
"hook": {
"webhookUrl": "https://the-rewards-webhook-url.com/rewards",
"requestBody": {
"player": "{user_address}",
"quest": "{quest_id}",
"myIdentifier": "my-identifier-123-456"
}
},
"items": [
{
"name": "Zombie Head",
"imageLink": "https://the-wearable-item-image.com"
}
]
}
}
💡 Tip: To give more than one item as a reward, add more items to the items array. These images may be used to display a quest’s rewards in-world.
Branching Quest #
This Quest is more complex. A Branching Quest “Z World”, with 4 steps:
-
STEP_1_1: One of two possible fist steps of the Quest. It has two tasks:STEP_1_1andSTEP_1_2. Both tasks have only one action item, and both action items areCUSTOMaction items.- The first task has a
CUSTOMaction item withCUSTOM_EVENT_1as theidof the custom event that the player has to complete. - The second task has a
CUSTOMaction item withSECOND_TASK_COLLECT_EVENTas theidof the custom event that the player has to complete. This step has a connection toSTEP_2.
- The first task has a
-
STEP_1_2: One of two possible fist steps of the Quest. It has two tasks:STEP_1_2_1andSTEP_1_2_2.- The first task has a
LOCATIONaction item with100as thexcoordinate and-101as theycoordinate. - The second task has two
CUSTOMaction items withSECOND_TASK_COLLECT_EVENTas theidof the custom event that the player has to complete. As there are two identical action items, the action has to be repeated by the user. This step has a connection toSTEP_2.
- The first task has a
📔 Note:STEP_1_1andSTEP_1_2are two different steps, but they both lead toSTEP_2. This means that the player must completeSTEP_1_1andSTEP_1_2to continue toSTEP_2and the other next steps.
-
STEP_2: It has one task:STEP_2_1. This task has two action items:JUMPandLOCATION. TheJUMPaction item has105as thexcoordinate and-101as theycoordinate. TheLOCATIONaction item has103as thexcoordinate and-101as theycoordinate. This step has a connection toSTEP_3. -
STEP_3: It has one task:STEP_3_1. This task has three action items:CUSTOM,CUSTOMandCUSTOM. The first twoCUSTOMaction items haveUSERACTION_STEP_3as theidof the custom event that the player has to complete. Once more, since the action items are identical, the user must repeat the same action. The thirdCUSTOMaction item hasANOTHER_USERACTION_STEP_3as theidof the custom event that the player has to complete. This step has no connections, so it’s considered the last step of the Quest. After finishing this step, the Quest is completed.
{
"name": "Z World",
"description": "Zombies World (branching version)",
"imageUrl": "https://the-image-u-want-to-be-displayed-on-dcl-explorer.com",
"definition": {
"steps": [
{
"id": "STEP_1_1",
"description": "First Step 1",
"tasks": [
{
"id": "STEP_1_1",
"description": "First Task of First Step 1",
"actionItems": [
{
"type": "CUSTOM",
"parameters": {
"id": "CUSTOM_EVENT_1"
}
}
]
}
]
},
{
"id": "STEP_1_2",
"description": "First Step 2",
"tasks": [
{
"id": "STEP_1_2_1",
"description": "First Task of First Step 2",
"actionItems": [
{
"type": "LOCATION",
"parameters": {
"x": "100",
"y": "-101"
}
}
]
},
{
"id": "STEP_1_2_2",
"description": "Second Task of First Step 2",
"actionItems": [
{
"type": "CUSTOM",
"parameters": {
"id": "SECOND_TASK_COLLECT_EVENT"
}
},
{
"type": "CUSTOM",
"parameters": {
"id": "SECOND_TASK_COLLECT_EVENT"
}
}
]
}
]
},
{
"id": "STEP_2",
"description": "Second Step",
"tasks": [
{
"id": "STEP_2_1",
"description": "First Task of Second Step",
"actionItems": [
{
"type": "JUMP",
"parameters": {
"x": "105",
"y": "-101"
}
},
{
"type": "LOCATION",
"parameters": {
"x": "103",
"y": "-101"
}
}
]
}
]
},
{
"id": "STEP_3",
"description": "Third Step",
"tasks": [
{
"id": "STEP_3",
"description": "First Task of Third Step",
"actionItems": [
{
"type": "CUSTOM",
"parameters": {
"id": "USERACTION_STEP_3"
}
},
{
"type": "CUSTOM",
"parameters": {
"id": "USERACTION_STEP_3"
}
},
{
"type": "CUSTOM",
"parameters": {
"id": "ANOTHER_USERACTION_STEP_3"
}
}
]
}
]
}
],
"connections": [
{
"stepFrom": "STEP_1_1",
"stepTo": "STEP_2"
},
{
"stepFrom": "STEP_1_2",
"stepTo": "STEP_2"
},
{
"stepFrom": "STEP_2",
"stepTo": "STEP_3"
}
]
},
"reward": {
"hook": {
"webhookUrl": "https://the-rewards-webhook-url.com/rewards",
"requestBody": {
"player": "{user_address}",
"quest": "{quest_id}",
"myIdentifier": "my-identifier-123-456"
}
},
"items": [
{
"name": "Zombie Head",
"imageLink": "https://the-wearable-item-image.com"
}
]
}
}