GS2-Quest

Progress management function

Manage the progress of the game and the quests.

Quests

A quest is the basic unit of in-game play, and is the entity you select when you start in-game. A quest can have a cost for the challenge and a reward for the challenge, and GS2-Quest accepts the start and end of the quest as an API. In other words, GS2-Quest is not involved in the in-game content.

Quest challenge cost

Sets the cost required to bring a quest to its starting state. In general, set the cost to consume stamina managed by GS2-Stamina or items managed by GS2-Inventory.

Rewards for completing quests

You can set the rewards you receive for attempting and completing quests. Multiple types of rewards can be set. With this feature, you can set up a version of the quest where a rare monster appears with a certain probability and the rewards are more luxurious than usual.

First Clear Reward

It is possible to set up a quest so that an additional reward is only earned the first time the quest is completed.

Reduced Clear Rewards

Quest rewards can be reduced from rewards if you do not defeat a monster that appears in the quest or if you miss a treasure chest.

The maximum reward received for the quest is reported in the response to the quest start API, and the actual number of rewards received is reported in the quest completion API. The reward can be reduced by reporting a lower reward in this report. If you attempt to report a reward that exceeds the maximum, an error will occur.

Quest Failure Rewards

You can set the reward you receive if you attempt a quest and fail. If a quest fails, the stamina paid at the time of the challenge may be refunded.

Prerequisites for Quests

You can set a requirement that another quest must be completed in order to challenge a quest. This allows you to link quests together like a chain.

Quests can be attempted for a certain period of time.

Quests can have GS2 Schedule events associated with them as challengeable periods. The challengeable period is determined at the time the start API is executed, not at the time of the end process.

Quest Group

An entity that groups together multiple Quests.

Quest Group Challengeable Period

A quest group can also have GS2 Schedule events associated with it as a challenge period. If you set a challenge period for a quest group, the condition is applied to all quests in the group.

If you set a challenge period for both a quest group and a quest, the quest will only be challengeable when both events are in session.

Example of implementation

Get a list of Quests

    var items = await gs2.Quest.Namespace(
        namespaceName: "namespace-0001"
    ).QuestGroupModel(
        questGroupName: "quest-group-0001"
    ).QuestModelsAsync(
    ).ToListAsync();
    const auto Domain = Gs2->Quest->Namespace(
        "namespace-0001" // namespaceName
    )->QuestGroupModel(
        "quest-group-0001" // questGroupName
    );
    const auto It = Domain->QuestModels(
    );
    for (auto Item : *It)
    {

    }

Get quest completion status

    var item = await gs2.Quest.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).CompletedQuestList(
        questGroupName: "main"
    ).ModelAsync();
    const auto Domain = Gs2->Quest->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->CompletedQuestList(
        "main" // questGroupName
    );
    const auto item = Domain.Model();

Start a quest

    var result = await gs2.Quest.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).StartAsync(
        questGroupName: "group-0001",
        questName: "quest-0001",
    );
    const auto Domain = Gs2->Quest->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->CompletedQuestList(
        "main" // questGroupName
    );
    const auto item = Domain.Model();

Get quest in progress

    var item = await gs2.Quest.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    ).ModelAsync();
    const auto Domain = Gs2->Quest->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->Progress(
    );
    const auto item = Domain.Model();

Report the end of the quest

    var result = await gs2.Quest.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Progress(
    ).EndAsync(
        isComplete: true,
        rewards: new [] {
            new Gs2.Unity.Gs2Quest.Model.EzReward{},
        },
        config: null
    );
    const auto Domain = Gs2->Quest->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->Progress(
    );
    const auto Future = Domain->End(
        true,
        []
        {
            const auto v = MakeShared<TArray<TSharedPtr<Gs2::Quest::Model::FReward>>>();
            v->Add({});
            return v;
        }(), // rewards
        nullptr // config
    );
    Future->StartSynchronousTask();
    if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;

Other Features

Branching quests

Under normal circumstances, it is not possible to branch quests. If you want to implement a quest that has two exits within the quest, and the next quest that can be attempted changes depending on which exit is used, please consider the following data structure.]

Quest NamePrerequisite Quest
Quest1
Quest1aPhantom
Quest1bPhantom
Quest2aQuest1a
Quest2bQuest1b

It is complicated, but you can set a quest name that does not exist in the master data as a prerequisite for a quest.

In this case, Quest1a / Quest1b is a prerequisite for a quest called Phantom, but the quest Phantom does not exist in the master data. Therefore, Quest1a / Quest1b is a quest that will never be made available as a challenge.

Quest2a / Quest2b is a prerequisite quest for Quest1a / Quest1b. In this state, the rewards “Complete Quest1a” and “Complete Quest1b” are set as the rewards for completing Quest1, and the following rewards are set as the rewards for completing Quest2a and Quest2b. Depending on the exit used, the player decides which of the two rewards will be given to the player to manipulate the completion state of Quest1a.

The reason for Quest1a / Quest1b is that quests that do not exist in the master data cannot be cleared.

graph TD Quest1 -- if use exit A --> Quest1a Quest1 -- if use exit B --> Quest1b phantom --- Quest1a phantom --- Quest1b Quest1a --> Quest2a Quest1b --> Quest2b linkStyle 2 stroke:#ccc,stroke-dasharray:4 linkStyle 3 stroke:#ccc,stroke-dasharray:4 style phantom fill:#fff,stroke:#ccc,stroke-dasharray:4 style Quest1a fill:#fff,stroke:#ccc,stroke-dasharray:4 style Quest1b fill:#fff,stroke:#ccc,stroke-dasharray:4

Detailed reference