GS2-Deploy/CDK Reference of GS2-Experience

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

Entity

Resources operated in Deploy process

Namespace

Namespace

A namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. 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.

TypeConditionRequiredDefaultValue LimitsDescription
namespaceIdstring
~ 1024 charsNamespace GRN
namestring
~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSettingTransaction settings
rankCapScriptIdstring~ 1024 charsScript to dynamically determine rank caps
changeExperienceScriptScriptSettingScript to be executed when experience changes
changeRankScriptScriptSettingScript to be executed when rank changes
changeRankCapScriptScriptSettingScript to be executed when the rank cap changes
overflowExperienceScriptstring~ 1024 charsScript to run when experience overflows
logSettingLogSettingLog output settings
createdAtlong
NowDatetime of creation
Unix time, milliseconds
Automatically configured on the server
updatedAtlong
NowDatetime of last update
Unix time, milliseconds
Automatically configured on the server
revisionlong00 ~ 9223372036854775805Revision

GetAttr

Generation results of resources that can be obtained with the !GetAttr tag

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Experience::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: null
  RankCapScriptId: null
  ChangeExperienceScript: null
  ChangeRankScript: null
  ChangeRankCapScript: null
  OverflowExperienceScript: 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/experience"
    "github.com/openlyinc/pointy"
)

SampleStack := core.NewStack()
experience.NewNamespace(
    &SampleStack,
    "namespace-0001",
    experience.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\Experience\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Experience\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.experience.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.experience.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.Gs2Experience.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Experience.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 experience from "@/gs2cdk/experience";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new experience.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, experience

class SampleStack(Stack):

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

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

ScriptSetting

Script settings

In GS2, you can associate custom scripts with microservice events and execute them. This model holds the settings for triggering script execution.

There are two main ways to execute a script: synchronous execution and asynchronous execution. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script execution result to stop the execution of the API or to tamper with the result of the API.

In contrast, asynchronous execution does not block processing until the script has finished executing. Since the script result cannot be used to stop the API execution or modify the API response, asynchronous execution does not affect the API’s response flow. For this reason, asynchronous execution is generally recommended.

There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.

TypeConditionRequiredDefaultValue LimitsDescription
triggerScriptIdstring~ 1024 charsScript GRN of synchronous execution script
Must be specified in GRN format starting with “grn:gs2:”.
doneTriggerTargetTypeString Enum
enum {
  “none”,
  “gs2_script”,
  “aws”
}
“none”~ 128 charsHow to execute asynchronous scripts
Specifies the type of script to use for asynchronous execution.
You can choose from “Do not use asynchronous execution scripts (none)”, “Use GS2-Script (gs2_script)”, and “Use Amazon EventBridge (aws)”.
Enumerator String DefinitionDescription
“none”None
“gs2_script”GS2-Script
“aws”Amazon EventBridge
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsScript GRN of asynchronous execution script
Must be specified in GRN format starting with “grn:gs2:”.

* Enabled if doneTriggerTargetType is “gs2_script”
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsGS2-JobQueue namespace GRN to execute asynchronous execution scripts
If you want to execute asynchronous execution scripts via GS2-JobQueue instead of executing them directly, specify the GS2-JobQueue namespace GRN.
There is little reason to use GS2-JobQueue, so you don’t need to specify it unless you have a specific reason.

* Enabled if doneTriggerTargetType is “gs2_script”

LogSetting

Log Export Settings

Manages log data export settings. This type holds the GS2-Log namespace identifier (Namespace ID) 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, and debugging.

TypeConditionRequiredDefaultValue LimitsDescription
loggingNamespaceIdstring
~ 1024 charsGS2-Log namespace GRN to output logs

TransactionSetting

Transaction settings

Transaction settings control how transactions are executed, their consistency, asynchronous processing, and conflict avoidance mechanisms. Combining features like AutoRun, AtomicCommit, Distributor, batch application of script results, and asynchronous acquisition actions via JobQueue enables robust transaction management tailored to game logic.

TypeConditionRequiredDefaultValue LimitsDescription
enableAutoRunbool
falseWhether to automatically execute issued transactions on the server side
enableAtomicCommitbool{enableAutoRun} == true
✓*
falseWhether to commit the execution of transactions atomically
* Required if enableAutoRun is true
transactionUseDistributorbool{enableAtomicCommit} == true
✓*
falseWhether to execute transactions asynchronously
* Required if enableAtomicCommit is true
commitScriptResultInUseDistributorbool{transactionUseDistributor} == true
✓*
falseWhether to execute the commit processing of the script result asynchronously
* Required if transactionUseDistributor is true
acquireActionUseJobQueuebool{enableAtomicCommit} == true
✓*
falseWhether to use GS2-JobQueue to execute the acquire action
* Required if enableAtomicCommit is true
distributorNamespaceIdstring
“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024 charsGS2-Distributor namespace used for transaction execution
queueNamespaceIdstring
“grn:gs2:{region}:{ownerId}:queue:default”~ 1024 charsNamespace in GS2-JobQueue used to run the transaction

CurrentExperienceMaster

Currently Available Master Data

GS2 uses JSON format files for managing master data. By uploading these files, the settings are applied to the server.

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

TypeConditionRequiredDefaultValue LimitsDescription
namespaceIdstring
~ 1024 charsNamespace GRN
settingsstring
~ 5242880 bytes (5MB)Master Data

GetAttr

Generation results of resources that can be obtained with the !GetAttr tag

TypeDescription
ItemCurrentExperienceMasterUpdated and currently available experience settings

Implementation Example

Type: GS2::Experience::CurrentExperienceMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2019-01-11",
    "experienceModels": [
      {
        "name": "character_ssr",
        "defaultExperience": 0,
        "defaultRankCap": 50,
        "maxRankCap": 80,
        "rankThreshold":
          {
            "metadata": "CHARACTER",
            "values": [
              100,
              200,
              300,
              400,
              500
            ]
          },
        "metadata": "SSR"
      },
      {
        "name": "character_sr",
        "defaultExperience": 0,
        "defaultRankCap": 40,
        "maxRankCap": 70,
        "rankThreshold":
          {
            "metadata": "CHARACTER",
            "values": [
              100,
              200,
              300,
              400,
              500
            ]
          },
        "metadata": "SR"
      },
      {
        "name": "character_r",
        "defaultExperience": 0,
        "defaultRankCap": 30,
        "maxRankCap": 60,
        "rankThreshold":
          {
            "metadata": "CHARACTER",
            "values": [
              100,
              200,
              300,
              400,
              500
            ]
          },
        "metadata": "R"
      },
      {
        "name": "equipment",
        "defaultExperience": 0,
        "defaultRankCap": 30,
        "maxRankCap": 50,
        "rankThreshold":
          {
            "metadata": "EQUIPMENT",
            "values": [
              200,
              400,
              600,
              800,
              1000
            ]
          },
        "metadata": "EQUIPMENT",
        "acquireActionRates": [
          {
            "name": "rate-0001",
            "mode": "big",
            "bigRates": [
              "1",
              "10",
              "100",
              "1000",
              "10000"
            ]
          }
        ]
      },
      {
        "name": "skill",
        "defaultExperience": 0,
        "defaultRankCap": 10,
        "maxRankCap": 20,
        "rankThreshold":
          {
            "metadata": "SKILL",
            "values": [
              300,
              600,
              900,
              1200,
              1500
            ]
          },
        "metadata": "SKILL"
      }
    ]
  }
  UploadToken: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/experience"
    "github.com/openlyinc/pointy"
)

SampleStack := core.NewStack()
experience.NewNamespace(
    &SampleStack,
    "namespace-0001",
    experience.NamespaceOptions{},
).MasterData(
    []experience.ExperienceModel{
        experience.NewExperienceModel(
            "character_ssr",
            0,
            50,
            80,
            experience.NewThreshold(
                []int64{
                    100,
                    200,
                    300,
                    400,
                    500,
                },
                experience.ThresholdOptions{
                    Metadata: pointy.String("CHARACTER"),
                },
            ),
            experience.ExperienceModelOptions{
                Metadata: pointy.String("SSR"),
            },
        ),
        experience.NewExperienceModel(
            "character_sr",
            0,
            40,
            70,
            experience.NewThreshold(
                []int64{
                    100,
                    200,
                    300,
                    400,
                    500,
                },
                experience.ThresholdOptions{
                    Metadata: pointy.String("CHARACTER"),
                },
            ),
            experience.ExperienceModelOptions{
                Metadata: pointy.String("SR"),
            },
        ),
        experience.NewExperienceModel(
            "character_r",
            0,
            30,
            60,
            experience.NewThreshold(
                []int64{
                    100,
                    200,
                    300,
                    400,
                    500,
                },
                experience.ThresholdOptions{
                    Metadata: pointy.String("CHARACTER"),
                },
            ),
            experience.ExperienceModelOptions{
                Metadata: pointy.String("R"),
            },
        ),
        experience.NewExperienceModel(
            "equipment",
            0,
            30,
            50,
            experience.NewThreshold(
                []int64{
                    200,
                    400,
                    600,
                    800,
                    1000,
                },
                experience.ThresholdOptions{
                    Metadata: pointy.String("EQUIPMENT"),
                },
            ),
            experience.ExperienceModelOptions{
                Metadata: pointy.String("EQUIPMENT"),
                AcquireActionRates: []experience.AcquireActionRate{
                    experience.NewAcquireActionRate(
                        "rate-0001",
                        experience.AcquireActionRateModeBig,
                        experience.AcquireActionRateOptions{
                            BigRates: []string{
                                "1",
                                "10",
                                "100",
                                "1000",
                                "10000",
                            },
                        },
                    ),
                },
            },
        ),
        experience.NewExperienceModel(
            "skill",
            0,
            10,
            20,
            experience.NewThreshold(
                []int64{
                    300,
                    600,
                    900,
                    1200,
                    1500,
                },
                experience.ThresholdOptions{
                    Metadata: pointy.String("SKILL"),
                },
            ),
            experience.ExperienceModelOptions{
                Metadata: pointy.String("SKILL"),
            },
        ),
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Experience\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Experience\Model\ExperienceModel(
                    name:"character_ssr",
                    defaultExperience:0,
                    defaultRankCap:50,
                    maxRankCap:80,
                    rankThreshold:new \Gs2Cdk\Experience\Model\Threshold(
                        values: [
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        options: new \Gs2Cdk\Experience\Model\Options\ThresholdOptions(
                            metadata: "CHARACTER",
                        )
                    ),
                    options: new \Gs2Cdk\Experience\Model\Options\ExperienceModelOptions(
                        metadata:"SSR"
                    )
                ),
                new \Gs2Cdk\Experience\Model\ExperienceModel(
                    name:"character_sr",
                    defaultExperience:0,
                    defaultRankCap:40,
                    maxRankCap:70,
                    rankThreshold:new \Gs2Cdk\Experience\Model\Threshold(
                        values: [
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        options: new \Gs2Cdk\Experience\Model\Options\ThresholdOptions(
                            metadata: "CHARACTER",
                        )
                    ),
                    options: new \Gs2Cdk\Experience\Model\Options\ExperienceModelOptions(
                        metadata:"SR"
                    )
                ),
                new \Gs2Cdk\Experience\Model\ExperienceModel(
                    name:"character_r",
                    defaultExperience:0,
                    defaultRankCap:30,
                    maxRankCap:60,
                    rankThreshold:new \Gs2Cdk\Experience\Model\Threshold(
                        values: [
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        options: new \Gs2Cdk\Experience\Model\Options\ThresholdOptions(
                            metadata: "CHARACTER",
                        )
                    ),
                    options: new \Gs2Cdk\Experience\Model\Options\ExperienceModelOptions(
                        metadata:"R"
                    )
                ),
                new \Gs2Cdk\Experience\Model\ExperienceModel(
                    name:"equipment",
                    defaultExperience:0,
                    defaultRankCap:30,
                    maxRankCap:50,
                    rankThreshold:new \Gs2Cdk\Experience\Model\Threshold(
                        values: [
                            200,
                            400,
                            600,
                            800,
                            1000,
                        ],
                        options: new \Gs2Cdk\Experience\Model\Options\ThresholdOptions(
                            metadata: "EQUIPMENT",
                        )
                    ),
                    options: new \Gs2Cdk\Experience\Model\Options\ExperienceModelOptions(
                        metadata:"EQUIPMENT",
                        acquireActionRates:[
                            new \Gs2Cdk\Experience\Model\AcquireActionRate(
                                name: "rate-0001",
                                mode: Gs2Cdk\Experience\Model\Enums\AcquireActionRateMode::BIG,
                                options: new \Gs2Cdk\Experience\Model\Options\AcquireActionRateOptions(
                                    bigRates: [
                                        "1",
                                        "10",
                                        "100",
                                        "1000",
                                        "10000",
                                    ],
                                )
                            ),
                        ]
                    )
                ),
                new \Gs2Cdk\Experience\Model\ExperienceModel(
                    name:"skill",
                    defaultExperience:0,
                    defaultRankCap:10,
                    maxRankCap:20,
                    rankThreshold:new \Gs2Cdk\Experience\Model\Threshold(
                        values: [
                            300,
                            600,
                            900,
                            1200,
                            1500,
                        ],
                        options: new \Gs2Cdk\Experience\Model\Options\ThresholdOptions(
                            metadata: "SKILL",
                        )
                    ),
                    options: new \Gs2Cdk\Experience\Model\Options\ExperienceModelOptions(
                        metadata:"SKILL"
                    )
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.experience.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.experience.model.ExperienceModel(
                    "character_ssr",
                    0L,
                    50L,
                    80L,
                    new io.gs2.cdk.experience.model.Threshold(
                        Arrays.asList(
                            100L,
                            200L,
                            300L,
                            400L,
                            500L
                        ),
                        new io.gs2.cdk.experience.model.options.ThresholdOptions()
                            .withMetadata("CHARACTER")
                    ),
                    new io.gs2.cdk.experience.model.options.ExperienceModelOptions()
                        .withMetadata("SSR")
                ),
                new io.gs2.cdk.experience.model.ExperienceModel(
                    "character_sr",
                    0L,
                    40L,
                    70L,
                    new io.gs2.cdk.experience.model.Threshold(
                        Arrays.asList(
                            100L,
                            200L,
                            300L,
                            400L,
                            500L
                        ),
                        new io.gs2.cdk.experience.model.options.ThresholdOptions()
                            .withMetadata("CHARACTER")
                    ),
                    new io.gs2.cdk.experience.model.options.ExperienceModelOptions()
                        .withMetadata("SR")
                ),
                new io.gs2.cdk.experience.model.ExperienceModel(
                    "character_r",
                    0L,
                    30L,
                    60L,
                    new io.gs2.cdk.experience.model.Threshold(
                        Arrays.asList(
                            100L,
                            200L,
                            300L,
                            400L,
                            500L
                        ),
                        new io.gs2.cdk.experience.model.options.ThresholdOptions()
                            .withMetadata("CHARACTER")
                    ),
                    new io.gs2.cdk.experience.model.options.ExperienceModelOptions()
                        .withMetadata("R")
                ),
                new io.gs2.cdk.experience.model.ExperienceModel(
                    "equipment",
                    0L,
                    30L,
                    50L,
                    new io.gs2.cdk.experience.model.Threshold(
                        Arrays.asList(
                            200L,
                            400L,
                            600L,
                            800L,
                            1000L
                        ),
                        new io.gs2.cdk.experience.model.options.ThresholdOptions()
                            .withMetadata("EQUIPMENT")
                    ),
                    new io.gs2.cdk.experience.model.options.ExperienceModelOptions()
                        .withMetadata("EQUIPMENT")
                        .withAcquireActionRates(Arrays.asList(
                            new io.gs2.cdk.experience.model.AcquireActionRate(
                                "rate-0001",
                                io.gs2.cdk.experience.model.enums.AcquireActionRateMode.BIG,
                                new io.gs2.cdk.experience.model.options.AcquireActionRateOptions()
                                    .withBigRates(Arrays.asList(
                                        "1",
                                        "10",
                                        "100",
                                        "1000",
                                        "10000"
                                    ))
                            )
                        ))
                ),
                new io.gs2.cdk.experience.model.ExperienceModel(
                    "skill",
                    0L,
                    10L,
                    20L,
                    new io.gs2.cdk.experience.model.Threshold(
                        Arrays.asList(
                            300L,
                            600L,
                            900L,
                            1200L,
                            1500L
                        ),
                        new io.gs2.cdk.experience.model.options.ThresholdOptions()
                            .withMetadata("SKILL")
                    ),
                    new io.gs2.cdk.experience.model.options.ExperienceModelOptions()
                        .withMetadata("SKILL")
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Experience.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Experience.Model.ExperienceModel[] {
                new Gs2Cdk.Gs2Experience.Model.ExperienceModel(
                    name: "character_ssr",
                    defaultExperience: 0L,
                    defaultRankCap: 50L,
                    maxRankCap: 80L,
                    rankThreshold: new Gs2Cdk.Gs2Experience.Model.Threshold(
                        values: new long[]
                        {
                            100L,
                            200L,
                            300L,
                            400L,
                            500L,
                        },
                        options: new Gs2Cdk.Gs2Experience.Model.Options.ThresholdOptions
                        {
                            metadata = "CHARACTER"
                        }
                    ),
                    options: new Gs2Cdk.Gs2Experience.Model.Options.ExperienceModelOptions
                    {
                        metadata = "SSR"
                    }
                ),
                new Gs2Cdk.Gs2Experience.Model.ExperienceModel(
                    name: "character_sr",
                    defaultExperience: 0L,
                    defaultRankCap: 40L,
                    maxRankCap: 70L,
                    rankThreshold: new Gs2Cdk.Gs2Experience.Model.Threshold(
                        values: new long[]
                        {
                            100L,
                            200L,
                            300L,
                            400L,
                            500L,
                        },
                        options: new Gs2Cdk.Gs2Experience.Model.Options.ThresholdOptions
                        {
                            metadata = "CHARACTER"
                        }
                    ),
                    options: new Gs2Cdk.Gs2Experience.Model.Options.ExperienceModelOptions
                    {
                        metadata = "SR"
                    }
                ),
                new Gs2Cdk.Gs2Experience.Model.ExperienceModel(
                    name: "character_r",
                    defaultExperience: 0L,
                    defaultRankCap: 30L,
                    maxRankCap: 60L,
                    rankThreshold: new Gs2Cdk.Gs2Experience.Model.Threshold(
                        values: new long[]
                        {
                            100L,
                            200L,
                            300L,
                            400L,
                            500L,
                        },
                        options: new Gs2Cdk.Gs2Experience.Model.Options.ThresholdOptions
                        {
                            metadata = "CHARACTER"
                        }
                    ),
                    options: new Gs2Cdk.Gs2Experience.Model.Options.ExperienceModelOptions
                    {
                        metadata = "R"
                    }
                ),
                new Gs2Cdk.Gs2Experience.Model.ExperienceModel(
                    name: "equipment",
                    defaultExperience: 0L,
                    defaultRankCap: 30L,
                    maxRankCap: 50L,
                    rankThreshold: new Gs2Cdk.Gs2Experience.Model.Threshold(
                        values: new long[]
                        {
                            200L,
                            400L,
                            600L,
                            800L,
                            1000L,
                        },
                        options: new Gs2Cdk.Gs2Experience.Model.Options.ThresholdOptions
                        {
                            metadata = "EQUIPMENT"
                        }
                    ),
                    options: new Gs2Cdk.Gs2Experience.Model.Options.ExperienceModelOptions
                    {
                        metadata = "EQUIPMENT",
                        acquireActionRates = new Gs2Cdk.Gs2Experience.Model.AcquireActionRate[]
                        {
                            new Gs2Cdk.Gs2Experience.Model.AcquireActionRate(
                                name: "rate-0001",
                                mode: Gs2Cdk.Gs2Experience.Model.Enums.AcquireActionRateMode.Big,
                                options: new Gs2Cdk.Gs2Experience.Model.Options.AcquireActionRateOptions
                                {
                                    bigRates = new string[]
                                    {
                                        "1",
                                        "10",
                                        "100",
                                        "1000",
                                        "10000",
                                    }
                                }
                            )
                        }
                    }
                ),
                new Gs2Cdk.Gs2Experience.Model.ExperienceModel(
                    name: "skill",
                    defaultExperience: 0L,
                    defaultRankCap: 10L,
                    maxRankCap: 20L,
                    rankThreshold: new Gs2Cdk.Gs2Experience.Model.Threshold(
                        values: new long[]
                        {
                            300L,
                            600L,
                            900L,
                            1200L,
                            1500L,
                        },
                        options: new Gs2Cdk.Gs2Experience.Model.Options.ThresholdOptions
                        {
                            metadata = "SKILL"
                        }
                    ),
                    options: new Gs2Cdk.Gs2Experience.Model.Options.ExperienceModelOptions
                    {
                        metadata = "SKILL"
                    }
                )
            }
        );
    }
}

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

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new experience.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new experience.model.ExperienceModel(
                    "character_ssr",
                    0,
                    50,
                    80,
                    new experience.model.Threshold(
                        [
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        {
                            metadata: "CHARACTER"
                        }
                    ),
                    {
                        metadata: "SSR"
                    }
                ),
                new experience.model.ExperienceModel(
                    "character_sr",
                    0,
                    40,
                    70,
                    new experience.model.Threshold(
                        [
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        {
                            metadata: "CHARACTER"
                        }
                    ),
                    {
                        metadata: "SR"
                    }
                ),
                new experience.model.ExperienceModel(
                    "character_r",
                    0,
                    30,
                    60,
                    new experience.model.Threshold(
                        [
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        {
                            metadata: "CHARACTER"
                        }
                    ),
                    {
                        metadata: "R"
                    }
                ),
                new experience.model.ExperienceModel(
                    "equipment",
                    0,
                    30,
                    50,
                    new experience.model.Threshold(
                        [
                            200,
                            400,
                            600,
                            800,
                            1000,
                        ],
                        {
                            metadata: "EQUIPMENT"
                        }
                    ),
                    {
                        metadata: "EQUIPMENT",
                        acquireActionRates: [
                            new experience.model.AcquireActionRate(
                                "rate-0001",
                                experience.model.AcquireActionRateMode.BIG,
                                {
                                    bigRates: [
                                        "1",
                                        "10",
                                        "100",
                                        "1000",
                                        "10000",
                                    ]
                                }
                            ),
                        ]
                    }
                ),
                new experience.model.ExperienceModel(
                    "skill",
                    0,
                    10,
                    20,
                    new experience.model.Threshold(
                        [
                            300,
                            600,
                            900,
                            1200,
                            1500,
                        ],
                        {
                            metadata: "SKILL"
                        }
                    ),
                    {
                        metadata: "SKILL"
                    }
                )
            ]
        );
    }
}

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

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        experience.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            experience_models=[
                experience.ExperienceModel(
                    name='character_ssr',
                    default_experience=0,
                    default_rank_cap=50,
                    max_rank_cap=80,
                    rank_threshold=experience.Threshold(
                        values=[
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        options=experience.ThresholdOptions(
                            metadata='CHARACTER',
                        ),
                    ),
                    options=experience.ExperienceModelOptions(
                        metadata = 'SSR'
                    ),
                ),
                experience.ExperienceModel(
                    name='character_sr',
                    default_experience=0,
                    default_rank_cap=40,
                    max_rank_cap=70,
                    rank_threshold=experience.Threshold(
                        values=[
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        options=experience.ThresholdOptions(
                            metadata='CHARACTER',
                        ),
                    ),
                    options=experience.ExperienceModelOptions(
                        metadata = 'SR'
                    ),
                ),
                experience.ExperienceModel(
                    name='character_r',
                    default_experience=0,
                    default_rank_cap=30,
                    max_rank_cap=60,
                    rank_threshold=experience.Threshold(
                        values=[
                            100,
                            200,
                            300,
                            400,
                            500,
                        ],
                        options=experience.ThresholdOptions(
                            metadata='CHARACTER',
                        ),
                    ),
                    options=experience.ExperienceModelOptions(
                        metadata = 'R'
                    ),
                ),
                experience.ExperienceModel(
                    name='equipment',
                    default_experience=0,
                    default_rank_cap=30,
                    max_rank_cap=50,
                    rank_threshold=experience.Threshold(
                        values=[
                            200,
                            400,
                            600,
                            800,
                            1000,
                        ],
                        options=experience.ThresholdOptions(
                            metadata='EQUIPMENT',
                        ),
                    ),
                    options=experience.ExperienceModelOptions(
                        metadata = 'EQUIPMENT',
                        acquire_action_rates = [
                            experience.AcquireActionRate(
                                name='rate-0001',
                                mode=experience.AcquireActionRateMode.BIG,
                                options=experience.AcquireActionRateOptions(
                                    big_rates=[
                                        '1',
                                        '10',
                                        '100',
                                        '1000',
                                        '10000',
                                    ],
                                ),
                            ),
                        ]
                    ),
                ),
                experience.ExperienceModel(
                    name='skill',
                    default_experience=0,
                    default_rank_cap=10,
                    max_rank_cap=20,
                    rank_threshold=experience.Threshold(
                        values=[
                            300,
                            600,
                            900,
                            1200,
                            1500,
                        ],
                        options=experience.ThresholdOptions(
                            metadata='SKILL',
                        ),
                    ),
                    options=experience.ExperienceModelOptions(
                        metadata = 'SKILL'
                    ),
                ),
            ],
        )

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

Threshold

Rank Up Threshold

TypeConditionRequiredDefaultValue LimitsDescription
metadatastring~ 2048 charsMetadata
valuesList<long>
1 ~ 10000 itemsList of Rank Up Experience Threshold

ExperienceModel

Experience Model

An experience model is an entity that sets the threshold of experience required for rank advancement and for each default and maximum rank cap.

TypeConditionRequiredDefaultValue LimitsDescription
experienceModelIdstring
~ 1024 charsExperience Model GRN
namestring
~ 128 charsExperience Model Name
metadatastring~ 2048 charsMetadata
defaultExperiencelong
00 ~ 9223372036854775805Initial Experience Value
defaultRankCaplong
0 ~ 9223372036854775805Initial value of rank cap
maxRankCaplong
0 ~ 9223372036854775805Maximum rank cap
rankThresholdThreshold
rank-up threshold
acquireActionRatesList<AcquireActionRate>0 ~ 100 itemsList of Remuneration addition table

AcquireActionRate

Remuneration addition table master

You can adjust the amount of rewards according to the rank.

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 128 charsRemuneration addition table name
modeString Enum
enum {
  “double”,
  “big”
}
“double”~ 128 charsRemuneration addition table type
Enumerator String DefinitionDescription
“double”Floating point number less than 2^48
“big”Floating point number less than 1024 digits
ratesList<double>{mode} == “double”
✓*
1 ~ 10000 itemsAmount added per rank (multiplier)
* Required if mode is “double”
bigRatesList<string>{mode} == “big”
✓*
1 ~ 10000 itemsAmount added per rank (multiplier)
* Required if mode is “big”