Skip to main content

Missions

Pre-requisites

Please make sure that you've followed our getting started guide and set up your development environment.

You'll also need the following:

  1. A project
  2. At least one resource
  3. Characters

In order to participate in missions, your users will need to have created a profile for your project. They'll also need eligible characters that can go on the missions you create (more on this below).

Why use missions?

Missions can be used in a variety of ways, including:

  • Idle rewards: Your players earn idle rewards while they're not actively playing, or interacting with, your game.
  • Give players a reason to come back: Missions can be used to encourage your users to come back to your game. As a developer, you can create a mission that can be completed once a day, for example.
  • Encourage players to explore: Developers can also create missions that require players to have certain characters. It's up to you to decide how players can get these characters. For example, you could create a mission that requires a character that can only be obtained by completing a certain quest in your game.
  • Guild/clan missions (coming soon): Honeycomb Protocol will soon be implementing guilds. That way, a whole guild will be able to participate in missions and earn rewards together. The reward distribution mechanism will be decided by the guild leader.

Missions instructions

Create a mission pool

You'll begin by creating a mission pool. The purpose of a mission pool is to group missions together based on the criteria you define. For example, you could create a mission pool for all missions that require a certain character model. Users who don't have a character based on that model won't be able to participate in the missions in that pool.

const {
createCreateMissionPoolTransaction: {
missionPoolAddress, // The address of the mission pool
tx, // The transaction response, you'll need to sign and send this transaction
},
} = await client.createCreateMissionPoolTransaction({
data: {
name: "Test Mission Pool",
project: projectAddress.toString(),
payer: adminPublicKey.toString(),
authority: adminPublicKey.toString(),
delegateAuthority: delegateAuthority.toString(), // Optional
characterModel: characterModelAddress.toString(),
},
});

Create a mission

In order to create a mission, you should already have a mission pool. Afterwards, here's how you can create a mission:

import { RewardKind } from "@honeycomb-protocol/edge-client";

const {
createCreateMissionTransaction: {
missionAddress, // The address of the mission
tx, // The transaction response, you'll need to sign and send this transaction
},
} = await client.createCreateMissionTransaction({
data: {
name: "Test mission",
project: projectAddress.toString(),
cost: {
address: resourceAddress.toString(),
amount: "100000",
},
duration: "86400", // 1 day
minXp: "50000", // Minimum XP required to participate in the mission
rewards: [
{
kind: RewardKind.Xp,
max: "100",
min: "100",
},
{
kind: RewardKind.Resource,
max: "25000000",
min: "50000000",
resource: resourceAddress.toString(),
},
],
missionPool: missionPoolAddress.toString(),
authority: adminPublicKey.toString(),
payer: adminPublicKey.toString(),
},
});

Send characters on mission

This transaction will send a player's character(s) on an eligible mission:

const {
createSendCharactersOnMissionTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createSendCharactersOnMissionTransaction({
data: {
mission: missionAddress.toString(),
characterAddresses: [
characterAddress.toString(),
],
authority: userPublicKey.toString(),
payer: payerPublicKey.toString(), // Optional
},
});

Recall characters from a mission

Once a mission's duration has ended, you can recall characters from the mission. Recalling will automatically claim any rewards that the characters have earned. If you recall before the mission's duration has ended, the characters will not receive any rewards.

Here's the transaction for recalling characters:

const {
createRecallCharactersTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createRecallCharactersTransaction({
data: {
mission: missionAddress.toString(),
characterAddresses: [
characterAddress.toString()
],
authority: userPublicKey.toString(),
payer: payerPublicKey.toString(), // Optional
},
lutAddresses: [lookupTableAddress],
});

Fetching a character's history

Please see the character history guide to learn how to fetch a character's history.