GS2-Ranking2 Deploy/CDK Reference

The template format used when creating stacks with GS2-Deploy, and implementation examples of template output in various languages using CDK

Entities

Resources managed by the Deploy operation

Namespace

Namespace

A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.

Therefore, you must create a namespace before you can start using each service.

Request

Resource creation and update requests

Type Condition Required Default Value Limits Description
name string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
description string ~ 1024 chars Description
transactionSetting TransactionSetting
Transaction Setting
Settings for distributed transactions used to grant ranking rewards. Supports auto-run to automatically execute transactions and atomic commit for all-or-nothing guarantee.
logSetting LogSetting Log Output Setting
Specifies the GS2-Log namespace for outputting API request and response logs. Used for tracking score submissions and ranking reward distributions.

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

Type Description
Item Namespace Namespace created

Implementation Example

Type: GS2::Ranking2::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: null
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/ranking2"
)


SampleStack := core.NewStack()
ranking2.NewNamespace(
    &SampleStack,
    "namespace-0001",
    ranking2.NamespaceOptions{
        LogSetting: &core.LogSetting{
            LoggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
        },
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Ranking2\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Ranking2\Model\Options\NamespaceOptions(
                logSetting: new \Gs2Cdk\Core\Model\LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            )
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.ranking2.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.ranking2.model.options.NamespaceOptions()
                        .withLogSetting(new io.gs2.cdk.core.model.LogSetting(
                            "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                        ))
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Ranking2.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Ranking2.Model.Options.NamespaceOptions
            {
                logSetting = new Gs2Cdk.Core.Model.LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import ranking2 from "@/gs2cdk/ranking2";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new ranking2.model.Namespace(
            this,
            "namespace-0001",
            {
                logSetting: new core.LogSetting(
                    "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, ranking2

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        ranking2.Namespace(
            stack=self,
            name='namespace-0001',
            options=ranking2.NamespaceOptions(
                log_setting=core.LogSetting(
                    logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
                ),
            ),
        )

print(SampleStack().yaml())  # Generate Template

TransactionSetting

Transaction Setting

Transaction Setting controls execution methods, consistency, asynchronous processing, and conflict avoidance mechanisms of transactions. Combining features like AutoRun, AtomicCommit, asynchronous execution using GS2-Distributor, batch application of script results, and asynchronous processing of Acquire Actions via GS2-JobQueue enables robust transaction management tailored to game logic.

Type Condition Required Default Value Limits Description
enableAutoRun bool false Whether to automatically execute issued transactions on the server side
enableAtomicCommit bool {enableAutoRun} == true false Whether to commit the execution of transactions atomically
* Enabled only if enableAutoRun is true
transactionUseDistributor bool {enableAtomicCommit} == true false Whether to execute transactions asynchronously
* Enabled only if enableAtomicCommit is true
commitScriptResultInUseDistributor bool {transactionUseDistributor} == true false Whether to execute the commit processing of the script result asynchronously
* Enabled only if transactionUseDistributor is true
acquireActionUseJobQueue bool {enableAtomicCommit} == true false Whether to use GS2-JobQueue to execute the acquire action
* Enabled only if enableAtomicCommit is true
distributorNamespaceId string “grn:gs2:{region}:{ownerId}:distributor:default” ~ 1024 chars GS2-Distributor Namespace GRN used to execute transactions
queueNamespaceId string “grn:gs2:{region}:{ownerId}:queue:default” ~ 1024 chars GS2-JobQueue Namespace GRN used to execute transactions

LogSetting

Log Output Setting

Log Output Setting defines how log data is exported. This type holds the GS2-Log namespace identifier (Namespace ID), which is used to export log data. Specify the GS2-Log namespace where log data is collected and stored in the GRN format for the Log Namespace ID (loggingNamespaceId). Configuring this setting ensures that log data for API requests and responses occurring within the specified namespace is output to the target GS2-Log namespace. GS2-Log provides real-time logs that can be used for system monitoring, analysis, debugging, and other operational purposes.

Type Condition Required Default Value Limits Description
loggingNamespaceId string
~ 1024 chars GS2-Log namespace GRN to output logs
Must be specified in GRN format starting with “grn:gs2:”.

CurrentRankingMaster

Currently active Ranking Model master data

This master data defines the Ranking Models currently active within the namespace. GS2 uses JSON format files for managing master data. By uploading these files, the master data are updated on the server.

To create JSON files, GS2 provides a master data editor within the management console. Additionally, you can create tools better suited for game operations and export JSON files in the appropriate format.

Request

Resource creation and update requests

Type Condition Required Default Value Limits Description
namespaceName string
~ 128 chars Namespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
mode string (enum)
enum {
  “direct”,
  “preUpload”
}
“direct” Update mode
DefinitionDescription
“direct”Directly update master data
“preUpload”Upload master data and then update
settings string {mode} == “direct”
✓*
~ 5242880 chars Master Data
* Required if mode is “direct”
uploadToken string {mode} == “preUpload”
✓*
~ 1024 chars Token obtained by pre-upload
Used to apply the uploaded master data.
* Required if mode is “preUpload”

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

Type Description
Item CurrentRankingMaster Updated master data of the currently active Ranking Models

Implementation Example

Type: GS2::Ranking2::CurrentRankingMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2024-05-30",
    "globalRankingModels": [
      {
        "name": "ranking-0001",
        "orderDirection": "asc"
      },
      {
        "name": "ranking-0002",
        "orderDirection": "desc"
      }
    ],
    "clusterRankingModels": [
      {
        "name": "ranking-0001",
        "clusterType": "Raw",
        "orderDirection": "asc"
      },
      {
        "name": "ranking-0002",
        "clusterType": "Gs2Guild::Guild",
        "orderDirection": "desc"
      }
    ],
    "subscribeRankingModels": [
      {
        "name": "ranking-0001",
        "orderDirection": "asc"
      },
      {
        "name": "ranking-0002",
        "orderDirection": "desc"
      }
    ]
  }
  UploadToken: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/ranking2"
)


SampleStack := core.NewStack()
ranking2.NewNamespace(
    &SampleStack,
    "namespace-0001",
    ranking2.NamespaceOptions{},
).MasterData(
    []ranking2.GlobalRankingModel{
        ranking2.NewGlobalRankingModel(
            "ranking-0001",
            false,
            ranking2.GlobalRankingModelOrderDirectionAsc,
            ranking2.GlobalRankingModelRewardCalculationIndexRank,
            ranking2.GlobalRankingModelOptions{
            },
        ),
        ranking2.NewGlobalRankingModel(
            "ranking-0002",
            false,
            ranking2.GlobalRankingModelOrderDirectionDesc,
            ranking2.GlobalRankingModelRewardCalculationIndexRank,
            ranking2.GlobalRankingModelOptions{
            },
        ),
    },
    []ranking2.ClusterRankingModel{
        ranking2.NewClusterRankingModel(
            "ranking-0001",
            ranking2.ClusterRankingModelClusterTypeRaw,
            false,
            ranking2.ClusterRankingModelOrderDirectionAsc,
            ranking2.ClusterRankingModelRewardCalculationIndexRank,
            ranking2.ClusterRankingModelOptions{
            },
        ),
        ranking2.NewClusterRankingModel(
            "ranking-0002",
            ranking2.ClusterRankingModelClusterTypeGs2Guild_guild,
            false,
            ranking2.ClusterRankingModelOrderDirectionDesc,
            ranking2.ClusterRankingModelRewardCalculationIndexRank,
            ranking2.ClusterRankingModelOptions{
            },
        ),
    },
    []ranking2.SubscribeRankingModel{
        ranking2.NewSubscribeRankingModel(
            "ranking-0001",
            false,
            ranking2.SubscribeRankingModelOrderDirectionAsc,
            ranking2.SubscribeRankingModelOptions{
            },
        ),
        ranking2.NewSubscribeRankingModel(
            "ranking-0002",
            false,
            ranking2.SubscribeRankingModelOrderDirectionDesc,
            ranking2.SubscribeRankingModelOptions{
            },
        ),
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Ranking2\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Ranking2\Model\GlobalRankingModel(
                    name:"ranking-0001",
                    sum: false,
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\GlobalRankingModelOrderDirection::ASC,
                    rewardCalculationIndex: \Gs2Cdk\Ranking2\Model\Enums\GlobalRankingModelRewardCalculationIndex::RANK
                ),
                new \Gs2Cdk\Ranking2\Model\GlobalRankingModel(
                    name:"ranking-0002",
                    sum: false,
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\GlobalRankingModelOrderDirection::DESC,
                    rewardCalculationIndex: \Gs2Cdk\Ranking2\Model\Enums\GlobalRankingModelRewardCalculationIndex::RANK
                )
            ],
            [
                new \Gs2Cdk\Ranking2\Model\ClusterRankingModel(
                    name:"ranking-0001",
                    clusterType: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelClusterType::RAW,
                    sum: false,
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelOrderDirection::ASC,
                    rewardCalculationIndex: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelRewardCalculationIndex::RANK
                ),
                new \Gs2Cdk\Ranking2\Model\ClusterRankingModel(
                    name:"ranking-0002",
                    clusterType: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelClusterType::GS2_GUILD__GUILD,
                    sum: false,
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelOrderDirection::DESC,
                    rewardCalculationIndex: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelRewardCalculationIndex::RANK
                )
            ],
            [
                new \Gs2Cdk\Ranking2\Model\SubscribeRankingModel(
                    name:"ranking-0001",
                    sum: false,
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\SubscribeRankingModelOrderDirection::ASC
                ),
                new \Gs2Cdk\Ranking2\Model\SubscribeRankingModel(
                    name:"ranking-0002",
                    sum: false,
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\SubscribeRankingModelOrderDirection::DESC
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.ranking2.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.ranking2.model.GlobalRankingModel(
                    "ranking-0001",
                    false,
                    io.gs2.cdk.ranking2.model.enums.GlobalRankingModelOrderDirection.ASC,
                    io.gs2.cdk.ranking2.model.enums.GlobalRankingModelRewardCalculationIndex.RANK
                ),
                new io.gs2.cdk.ranking2.model.GlobalRankingModel(
                    "ranking-0002",
                    false,
                    io.gs2.cdk.ranking2.model.enums.GlobalRankingModelOrderDirection.DESC,
                    io.gs2.cdk.ranking2.model.enums.GlobalRankingModelRewardCalculationIndex.RANK
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.ranking2.model.ClusterRankingModel(
                    "ranking-0001",
                    io.gs2.cdk.ranking2.model.enums.ClusterRankingModelClusterType.RAW,
                    false,
                    io.gs2.cdk.ranking2.model.enums.ClusterRankingModelOrderDirection.ASC,
                    io.gs2.cdk.ranking2.model.enums.ClusterRankingModelRewardCalculationIndex.RANK
                ),
                new io.gs2.cdk.ranking2.model.ClusterRankingModel(
                    "ranking-0002",
                    io.gs2.cdk.ranking2.model.enums.ClusterRankingModelClusterType.GS2_GUILD__GUILD,
                    false,
                    io.gs2.cdk.ranking2.model.enums.ClusterRankingModelOrderDirection.DESC,
                    io.gs2.cdk.ranking2.model.enums.ClusterRankingModelRewardCalculationIndex.RANK
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.ranking2.model.SubscribeRankingModel(
                    "ranking-0001",
                    false,
                    io.gs2.cdk.ranking2.model.enums.SubscribeRankingModelOrderDirection.ASC
                ),
                new io.gs2.cdk.ranking2.model.SubscribeRankingModel(
                    "ranking-0002",
                    false,
                    io.gs2.cdk.ranking2.model.enums.SubscribeRankingModelOrderDirection.DESC
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Ranking2.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Ranking2.Model.GlobalRankingModel[] {
                new Gs2Cdk.Gs2Ranking2.Model.GlobalRankingModel(
                    name: "ranking-0001",
                    sum: false,
                    orderDirection: Gs2Cdk.Gs2Ranking2.Model.Enums.GlobalRankingModelOrderDirection.Asc,
                    rewardCalculationIndex: Gs2Cdk.Gs2Ranking2.Model.Enums.GlobalRankingModelRewardCalculationIndex.Rank
                ),
                new Gs2Cdk.Gs2Ranking2.Model.GlobalRankingModel(
                    name: "ranking-0002",
                    sum: false,
                    orderDirection: Gs2Cdk.Gs2Ranking2.Model.Enums.GlobalRankingModelOrderDirection.Desc,
                    rewardCalculationIndex: Gs2Cdk.Gs2Ranking2.Model.Enums.GlobalRankingModelRewardCalculationIndex.Rank
                )
            },
            new Gs2Cdk.Gs2Ranking2.Model.ClusterRankingModel[] {
                new Gs2Cdk.Gs2Ranking2.Model.ClusterRankingModel(
                    name: "ranking-0001",
                    clusterType: Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelClusterType.Raw,
                    sum: false,
                    orderDirection: Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelOrderDirection.Asc,
                    rewardCalculationIndex: Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelRewardCalculationIndex.Rank
                ),
                new Gs2Cdk.Gs2Ranking2.Model.ClusterRankingModel(
                    name: "ranking-0002",
                    clusterType: Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelClusterType.Gs2Guild_guild,
                    sum: false,
                    orderDirection: Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelOrderDirection.Desc,
                    rewardCalculationIndex: Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelRewardCalculationIndex.Rank
                )
            },
            new Gs2Cdk.Gs2Ranking2.Model.SubscribeRankingModel[] {
                new Gs2Cdk.Gs2Ranking2.Model.SubscribeRankingModel(
                    name: "ranking-0001",
                    sum: false,
                    orderDirection: Gs2Cdk.Gs2Ranking2.Model.Enums.SubscribeRankingModelOrderDirection.Asc
                ),
                new Gs2Cdk.Gs2Ranking2.Model.SubscribeRankingModel(
                    name: "ranking-0002",
                    sum: false,
                    orderDirection: Gs2Cdk.Gs2Ranking2.Model.Enums.SubscribeRankingModelOrderDirection.Desc
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import ranking2 from "@/gs2cdk/ranking2";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new ranking2.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new ranking2.model.GlobalRankingModel(
                    "ranking-0001",
                    false,
                    ranking2.model.GlobalRankingModelOrderDirection.ASC,
                    ranking2.model.GlobalRankingModelRewardCalculationIndex.RANK
                ),
                new ranking2.model.GlobalRankingModel(
                    "ranking-0002",
                    false,
                    ranking2.model.GlobalRankingModelOrderDirection.DESC,
                    ranking2.model.GlobalRankingModelRewardCalculationIndex.RANK
                )
            ],
            [
                new ranking2.model.ClusterRankingModel(
                    "ranking-0001",
                    ranking2.model.ClusterRankingModelClusterType.RAW,
                    false,
                    ranking2.model.ClusterRankingModelOrderDirection.ASC,
                    ranking2.model.ClusterRankingModelRewardCalculationIndex.RANK
                ),
                new ranking2.model.ClusterRankingModel(
                    "ranking-0002",
                    ranking2.model.ClusterRankingModelClusterType.GS2_GUILD__GUILD,
                    false,
                    ranking2.model.ClusterRankingModelOrderDirection.DESC,
                    ranking2.model.ClusterRankingModelRewardCalculationIndex.RANK
                )
            ],
            [
                new ranking2.model.SubscribeRankingModel(
                    "ranking-0001",
                    false,
                    ranking2.model.SubscribeRankingModelOrderDirection.ASC
                ),
                new ranking2.model.SubscribeRankingModel(
                    "ranking-0002",
                    false,
                    ranking2.model.SubscribeRankingModelOrderDirection.DESC
                )
            ]
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, ranking2

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        ranking2.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            global_ranking_models=[
                ranking2.GlobalRankingModel(
                    name='ranking-0001',
                    sum=False,
                    order_direction=ranking2.GlobalRankingModelOrderDirection.ASC,
                    reward_calculation_index=ranking2.GlobalRankingModelRewardCalculationIndex.RANK
                ),
                ranking2.GlobalRankingModel(
                    name='ranking-0002',
                    sum=False,
                    order_direction=ranking2.GlobalRankingModelOrderDirection.DESC,
                    reward_calculation_index=ranking2.GlobalRankingModelRewardCalculationIndex.RANK
                ),
            ],
            cluster_ranking_models=[
                ranking2.ClusterRankingModel(
                    name='ranking-0001',
                    cluster_type=ranking2.ClusterRankingModelClusterType.RAW,
                    sum=False,
                    order_direction=ranking2.ClusterRankingModelOrderDirection.ASC,
                    reward_calculation_index=ranking2.ClusterRankingModelRewardCalculationIndex.RANK
                ),
                ranking2.ClusterRankingModel(
                    name='ranking-0002',
                    cluster_type=ranking2.ClusterRankingModelClusterType.GS2_GUILD__GUILD,
                    sum=False,
                    order_direction=ranking2.ClusterRankingModelOrderDirection.DESC,
                    reward_calculation_index=ranking2.ClusterRankingModelRewardCalculationIndex.RANK
                ),
            ],
            subscribe_ranking_models=[
                ranking2.SubscribeRankingModel(
                    name='ranking-0001',
                    sum=False,
                    order_direction=ranking2.SubscribeRankingModelOrderDirection.ASC
                ),
                ranking2.SubscribeRankingModel(
                    name='ranking-0002',
                    sum=False,
                    order_direction=ranking2.SubscribeRankingModelOrderDirection.DESC
                ),
            ],
        )

print(SampleStack().yaml())  # Generate Template

GlobalRankingModel

Global Ranking Model

The global ranking is a model that allows you to create a ranking that targets all players. You can display the top 1000 rankings.

By associating it with the repeat event of GS2-Schedule, you can reset the ranking according to the number of repetitions.

Type Condition Required Default Value Limits Description
globalRankingModelId string
*
~ 1024 chars Global Ranking GRN
* Set automatically by the server
name string
~ 128 chars Global Ranking Model name
Global Ranking Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 1024 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
minimumValue long 0 ~ 9223372036854775805 Minimum Score
The minimum allowed score value. Scores below this value will be rejected when submitted. Used to filter out invalid or unintended score values.
maximumValue long 0 ~ 9223372036854775805 Maximum Score
The maximum allowed score value. Scores above this value will be rejected when submitted. Used to prevent abnormally high scores from being registered.
sum bool false Sum Scores
When enabled, all submitted scores are accumulated and the ranking is determined by the total value. When disabled, only the best score (highest or lowest depending on sort direction) is used for ranking.
orderDirection string (enum)
enum {
  “asc”,
  “desc”
}
Order Direction
The sort direction for ranking scores. Use “asc” for rankings where lower scores are better (e.g., time trials), or “desc” for rankings where higher scores are better (e.g., high scores).
DefinitionDescription
“asc”ascending-order
“desc”descending-order
entryPeriodEventId string ~ 1024 chars Entry Period Event GRN
GS2-Schedule event GRN that defines the period during which scores can be submitted. When linked to a repeating event, the ranking resets with each repeat cycle, enabling seasonal rankings.
rankingRewards List<RankingReward> {entryPeriodEventId} != null [] 0 ~ 100 items Ranking Rewards
List of rewards granted based on ranking position at the end of each season. Only available when an entry period event is configured. Each reward defines a rank threshold and the acquire actions to execute.
accessPeriodEventId string ~ 1024 chars Access Period Event GRN
GS2-Schedule event GRN that defines the period during which ranking results can be viewed and rewards can be claimed. Typically set to the interval between score entry periods.
rewardCalculationIndex string (enum)
enum {
  “rank”,
  “index”
}
“rank” Reward Calculation Index
Determines how rewards are matched to players. “rank” uses the 1-based ranking position (players with tied scores share the same rank), while “index” uses the 0-based unique sorted position (no ties). Choose “rank” for most typical use cases.
DefinitionDescription
“rank”Determine rewards based on rank
“index”Determine rewards based on index

RankingReward

Ranking Reward

Set the rewards that can be received during the reference period when the score registration period is set in the ranking. If the repeat setting is enabled, the most recently ended period ranking will be the target for receiving rewards.

Type Condition Required Default Value Limits Description
thresholdRank int
1 ~ 1001 Rank Threshold
The rank threshold for this reward tier. Players whose rank (or index, depending on rewardCalculationIndex setting) is at or above this threshold receive this reward. Set to 1001 to define rewards for unranked players (those outside the top 1000).
metadata string ~ 1024 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
acquireActions List<AcquireAction> [] 0 ~ 100 items List of Acquire Actions
List of acquire actions executed when the player claims this ranking reward. These define the actual items, currency, or other resources granted as the reward for achieving this rank threshold.

ClusterRankingModel

Cluster Ranking Model

The cluster ranking model enables rankings for players within guilds or gatherings. You can display the top 1000 rankings.

By associating it with the repeat event of GS2-Schedule, you can reset the ranking according to the number of repetitions.

Type Condition Required Default Value Limits Description
clusterRankingModelId string
*
~ 1024 chars Cluster Ranking GRN
* Set automatically by the server
name string
~ 128 chars Cluster Ranking Model name
Cluster Ranking Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 1024 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
clusterType string (enum)
enum {
  “Raw”,
  “Gs2Guild::Guild”,
  “Gs2Matchmaking::SeasonGathering”
}
Cluster Type
Defines the type of group (cluster) used for ranking segmentation. “Raw” allows arbitrary cluster names without membership verification, “Gs2Guild::Guild” verifies the user belongs to a GS2-Guild guild, and “Gs2Matchmaking::SeasonGathering” verifies membership in a GS2-Matchmaking season gathering.
DefinitionDescription
“Raw”No verification
“Gs2Guild::Guild”GS2-Guild Guild
“Gs2Matchmaking::SeasonGathering”GS2-Matchmaking Season Gathering
minimumValue long 0 ~ 9223372036854775805 Minimum Score
The minimum allowed score value. Scores below this value will be rejected when submitted.
maximumValue long 0 ~ 9223372036854775805 Maximum Score
The maximum allowed score value. Scores above this value will be rejected when submitted.
sum bool false Sum Scores
When enabled, all submitted scores are accumulated and the ranking is determined by the total value. When disabled, only the best score is used for ranking.
orderDirection string (enum)
enum {
  “asc”,
  “desc”
}
Order Direction
The sort direction for ranking scores. Use “asc” for lower-is-better rankings, or “desc” for higher-is-better rankings.
DefinitionDescription
“asc”ascending-order
“desc”descending-order
entryPeriodEventId string ~ 1024 chars Entry Period Event GRN
GS2-Schedule event GRN that defines the period during which scores can be submitted. When linked to a repeating event, the ranking resets with each repeat cycle, enabling seasonal rankings.
rankingRewards List<RankingReward> {entryPeriodEventId} != null [] 0 ~ 100 items Ranking Rewards
List of rewards granted based on ranking position at the end of each season. Only available when an entry period event is configured.
accessPeriodEventId string ~ 1024 chars Access Period Event GRN
GS2-Schedule event GRN that defines the period during which ranking results can be viewed and rewards can be claimed.
rewardCalculationIndex string (enum)
enum {
  “rank”,
  “index”
}
“rank” Reward Calculation Index
Determines how rewards are matched to players. “rank” uses the 1-based ranking position (tied scores share same rank), “index” uses the 0-based unique sorted position (no ties).
DefinitionDescription
“rank”Determine rewards based on rank
“index”Determine rewards based on index

SubscribeRankingModel

Subscribe Ranking Model

A model that aggregates scores of other players that the user has subscribed to and creates a ranking.

Type Condition Required Default Value Limits Description
subscribeRankingModelId string
*
~ 1024 chars Subscribe Ranking GRN
* Set automatically by the server
name string
~ 128 chars Subscribe Ranking Model name
Subscribe Ranking Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadata string ~ 1024 chars Metadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
minimumValue long 0 ~ 9223372036854775805 Minimum Score
The minimum allowed score value. Scores below this value will be rejected when submitted.
maximumValue long 0 ~ 9223372036854775805 Maximum Score
The maximum allowed score value. Scores above this value will be rejected when submitted.
sum bool false Sum Scores
When enabled, all submitted scores are accumulated and the ranking is determined by the total value. When disabled, only the best score is used for ranking.
orderDirection string (enum)
enum {
  “asc”,
  “desc”
}
Order Direction
The sort direction for ranking scores. Use “asc” for lower-is-better rankings, or “desc” for higher-is-better rankings.
DefinitionDescription
“asc”ascending-order
“desc”descending-order
entryPeriodEventId string ~ 1024 chars Entry Period Event GRN
GS2-Schedule event GRN that defines the period during which scores can be submitted. When linked to a repeating event, the ranking resets with each repeat cycle, enabling seasonal rankings.
accessPeriodEventId string ~ 1024 chars Access Period Event GRN
GS2-Schedule event GRN that defines the period during which ranking results can be viewed.

AcquireAction

Acquire Action

Type Condition Required Default Value Limits Description
action string (enum)
enum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Schedule:ExtendTriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
Type of Acquire Action
request string
~ 524288 chars JSON string of the request used when executing the action