GS2-Experience GS2-Deploy/CDK リファレンス
エンティティ
Deploy処理で操作する対象リソース
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceId | string | ✓ | ~ 1024文字 | ネームスペース GRN | ||
| name | string | ✓ | ~ 128文字 | ネームスペース名 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| transactionSetting | TransactionSetting | トランザクション設定 | ||||
| rankCapScriptId | string | ~ 1024文字 | ランクキャップを動的に決定するスクリプト | |||
| changeExperienceScript | ScriptSetting | 経験値変化したときに実行するスクリプト | ||||
| changeRankScript | ScriptSetting | ランク変化したときに実行するスクリプト | ||||
| changeRankCapScript | ScriptSetting | ランクキャップ変化したときに実行するスクリプト | ||||
| overflowExperienceScript | string | ~ 1024文字 | 経験値あふれしたときに実行するスクリプト | |||
| logSetting | LogSetting | ログの出力設定 | ||||
| createdAt | long | ✓ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 | ||
| updatedAt | long | ✓ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | Namespace | 作成したネームスペース |
実装例
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-0001import (
"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 Templatepublic 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 Templateimport 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 TemplateTransactionSetting
トランザクション設定
トランザクション設定は、トランザクションの実行方法・整合性・非同期処理・競合回避の仕組みを制御する設定です。
自動実行(AutoRun)、アトミック実行(AtomicCommit)、非同期実行(Distributor)、スクリプト結果の一括適用、JobQueue による入手アクションの非同期化などを組み合わせ、ゲームロジックに応じた堅牢なトランザクション管理を可能にします。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | ✓ | false | 発行したトランザクションをサーバーサイドで自動的に実行するか | ||
| enableAtomicCommit | bool | {enableAutoRun} == true | ✓* | false | トランザクションの実行をアトミックにコミットするか ※ enableAutoRun が true であれば必須 | |
| transactionUseDistributor | bool | {enableAtomicCommit} == true | ✓* | false | トランザクションを非同期処理で実行する ※ enableAtomicCommit が true であれば必須 | |
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | ✓* | false | スクリプトの結果コミット処理を非同期処理で実行するか ※ transactionUseDistributor が true であれば必須 | |
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | ✓* | false | 入手アクションを実行する際に GS2-JobQueue を使用するか ※ enableAtomicCommit が true であれば必須 | |
| distributorNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-Distributor ネームスペース | |
| queueNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペース |
ScriptSetting
スクリプト設定
GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。
このモデルは、スクリプトの実行をトリガーするための設定を保持します。
スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。
代わりに、スクリプトの実行結果を使ってAPIの実行を止めたり、APIの結果を改ざんすることができます。
一方、非同期実行ではスクリプトの完了を待つために処理がブロックされることはありません。
ただし、スクリプトの実行結果を利用して API の実行を停止したり、API の応答内容を変更することはできません。
非同期実行は API の応答フローに影響を与えないため、原則として非同期実行を推奨します。
非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| triggerScriptId | string | ~ 1024文字 | 同期実行スクリプトの GS2-Script のスクリプト
GRN 「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 | |||||||||||
| doneTriggerTargetType | 文字列列挙型 enum { “none”, “gs2_script”, “aws” } | ✓ | “none” | 非同期スクリプトの実行方法 非同期実行で使用するスクリプトの種類を指定します。 「非同期実行のスクリプトを使用しない(none)」「GS2-Scriptを使用する(gs2_script)」「Amazon EventBridgeを使用する(aws)」が選択できます。
| ||||||||||
| doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | 非同期実行スクリプトの GS2-Script のスクリプト
GRN 「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 ※ doneTriggerTargetType が “gs2_script” であれば有効 | ||||||||||
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024文字 | 非同期実行スクリプトを実行する GS2-JobQueue ネームスペース
GRN 非同期実行スクリプトを直接実行するのではなく、GS2-JobQueue を経由する場合は GS2-JobQueue のネームスペースGRN を指定します。 GS2-JobQueue を利用する理由は多くはありませんので、特に理由がなければ指定する必要はありません。 ※ doneTriggerTargetType が “gs2_script” であれば有効 |
LogSetting
ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用される GS2-Log 名前空間の識別子(Namespace ID)を保持します。
ログ名前空間ID(loggingNamespaceId)には、ログデータを収集し保存する GS2-Log の名前空間を、GRNの形式で指定します。
この設定をすることで、設定された名前空間内で発生したAPIリクエスト・レスポンスのログデータが、対象の GS2-Log 名前空間側へ出力されるようになります。
GS2-Log ではリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024文字 | ログを出力する GS2-Log のネームスペース GRN |
CurrentExperienceMaster
現在有効なマスターデータ
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール内にマスターデータエディタを提供しています。
また、よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
Note
JSONファイルの形式については GS2-Experience マスターデータリファレンス をご参照ください。| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| namespaceId | string | ✓ | ~ 1024文字 | ネームスペース GRN | ||
| settings | string | ✓ | ~ 5242880 バイト (5MB) | マスターデータ |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | CurrentExperienceMaster | 更新した現在有効なマスターデータ |
実装例
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: nullimport (
"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 Templatepublic 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 Templateimport 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 TemplateExperienceModel
経験値モデル
経験値モデルとは、ランクアップに必要な経験値の閾値や、デフォルトのランクキャップ・最大ランクキャップ毎に設定するエンティティです。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| experienceModelId | string | ✓ | ~ 1024文字 | 経験値モデル GRN | ||
| name | string | ✓ | ~ 128文字 | 経験値モデル名 | ||
| metadata | string | ~ 2048文字 | メタデータ | |||
| defaultExperience | long | ✓ | 0 | 0 ~ 9223372036854775805 | 経験値の初期値 | |
| defaultRankCap | long | ✓ | 0 ~ 9223372036854775805 | ランクキャップの初期値 | ||
| maxRankCap | long | ✓ | 0 ~ 9223372036854775805 | ランクキャップの最大値 | ||
| rankThreshold | Threshold | ✓ | ランクアップ閾値 | |||
| acquireActionRates | List<AcquireActionRate> | 0 ~ 100 items | 報酬加算テーブルリスト |
Threshold
ランクアップ閾値
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| metadata | string | ~ 2048文字 | メタデータ | |||
| values | List<long> | ✓ | 1 ~ 10000 items | ランクアップ経験値閾値リスト |
AcquireActionRate
報酬加算テーブル
ランクに応じて報酬の量を調整することができます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128文字 | 報酬加算テーブル名 | ||||||||
| mode | 文字列列挙型 enum { “double”, “big” } | ✓ | “double” | 報酬加算テーブルの種類
| ||||||||
| rates | List<double> | {mode} == “double” | ✓* | 1 ~ 10000 items | ランクごとの加算量(倍率) ※ mode が “double” であれば必須 | |||||||
| bigRates | List<string> | {mode} == “big” | ✓* | 1 ~ 10000 items | ランクごとの加算量(倍率) ※ mode が “big” であれば必須 |
Threshold
ランクアップ閾値
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| metadata | string | ~ 2048文字 | メタデータ | |||
| values | List<long> | ✓ | 1 ~ 10000 items | ランクアップ経験値閾値リスト |