GS2-Formation Deploy/CDK リファレンス
エンティティ
Deploy処理で操作する対象リソース
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
Request
リソースの生成リクエスト
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| transactionSetting | TransactionSetting | トランザクション設定 | ||||
| updateMoldScript | ScriptSetting | フォームの保存領域のキャパシティを更新するときに実行するスクリプトの設定 | ||||
| updateFormScript | ScriptSetting | フォームを更新するときに実行するスクリプトの設定 | ||||
| updatePropertyFormScript | ScriptSetting | プロパティフォームを更新するときに実行するスクリプトの設定 | ||||
| logSetting | LogSetting | ログの出力設定 |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | Namespace | 作成したネームスペース |
実装例
Type: GS2::Formation::Namespace
Properties:
Name: namespace-0001
Description: null
TransactionSetting:
EnableAutoRun: true
QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
UpdateMoldScript: null
UpdateFormScript: null
UpdatePropertyFormScript: 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/formation"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
formation.NewNamespace(
&SampleStack,
"namespace-0001",
formation.NamespaceOptions{
TransactionSetting: &core.TransactionSetting{
QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
},
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\Formation\Model\Namespace_(
stack: $this,
name: "namespace-0001",
options: new \Gs2Cdk\Formation\Model\Options\NamespaceOptions(
transactionSetting: new \Gs2Cdk\Core\Model\TransactionSetting(
new \Gs2Cdk\Core\Model\TransactionSettingOptions(
queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
)
),
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.formation.model.Namespace(
this,
"namespace-0001",
new io.gs2.cdk.formation.model.options.NamespaceOptions()
.withTransactionSetting(new io.gs2.cdk.core.model.TransactionSetting(
new io.gs2.cdk.core.model.options.TransactionSettingOptions()
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
))
.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.Gs2Formation.Model.Namespace(
stack: this,
name: "namespace-0001",
options: new Gs2Cdk.Gs2Formation.Model.Options.NamespaceOptions
{
transactionSetting = new Gs2Cdk.Core.Model.TransactionSetting(
options: new Gs2Cdk.Core.Model.TransactionSettingOptions
{
queueNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
}
),
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 formation from "@/gs2cdk/formation";
class SampleStack extends core.Stack
{
public constructor() {
super();
new formation.model.Namespace(
this,
"namespace-0001",
{
transactionSetting: new core.TransactionSetting(
{
queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-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, formation
class SampleStack(Stack):
def __init__(self):
super().__init__()
formation.Namespace(
stack=self,
name='namespace-0001',
options=formation.NamespaceOptions(
transaction_setting=core.TransactionSetting(
options=core.TransactionSettingOptions(
queue_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001',
)
),
log_setting=core.LogSetting(
logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
),
),
)
print(SampleStack().yaml()) # Generate TemplateTransactionSetting
トランザクション設定
トランザクション設定は、トランザクションの実行方法・整合性・非同期処理・競合回避の仕組みを制御する設定です。
自動実行(AutoRun)、アトミック実行(AtomicCommit)、GS2-Distributor を利用した非同期実行、スクリプト結果の一括適用、GS2-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 ネームスペース GRN | |
| queueNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024文字 | トランザクションの実行に使用する GS2-JobQueue のネームスペース GRN |
ScriptSetting
スクリプト設定
GS2 ではマイクロサービスのイベントに関連づけて、カスタムスクリプトを実行することができます。
このモデルは、スクリプトの実行をトリガーするための設定を保持します。
スクリプトの実行方式は大きく2種類あり、それは「同期実行」と「非同期実行」です。
同期実行は、スクリプトの実行が完了するまで処理がブロックされます。
代わりに、スクリプトの実行結果を使って API の実行を止めたり、API のレスポンス内容を制御することができます。
一方、非同期実行ではスクリプトの完了を待つために処理がブロックされることはありません。
ただし、スクリプトの実行結果を利用して API の実行を停止したり、API の応答内容を変更することはできません。
非同期実行は API の応答フローに影響を与えないため、原則として非同期実行を推奨します。
非同期実行には実行方式が2種類あり、GS2-Script と Amazon EventBridge があります。
Amazon EventBridge を使用することで、Lua 以外の言語で処理を記述することができます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| triggerScriptId | string | ~ 1024文字 | API 実行時に同期的に実行される 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 「grn:gs2:」ではじまる GRN 形式のIDで指定する必要があります。 |
CurrentFormMaster
現在アクティブなマスターデータ
現在ネームスペース内で有効な、フォームモデルの定義を記述したマスターデータです。
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール内にマスターデータエディタを提供しています。
また、よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
Note
JSONファイルの形式については GS2-Formation マスターデータリファレンス をご参照ください。Request
リソースの生成リクエスト
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||||||||
| mode | 文字列列挙型 enum { “direct”, “preUpload” } | ✓ | “direct” | 更新モード
| ||||||||
| settings | string | {mode} == “direct” | ✓* | ~ 5242880文字 | マスターデータ ※ mode が “direct” であれば必須 | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024文字 | 事前アップロードで取得したトークン アップロードしたマスターデータを適用するために使用されます。 ※ mode が “preUpload” であれば必須 |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | CurrentFormMaster | 更新した現在アクティブなマスターデータ |
実装例
Type: GS2::Formation::CurrentFormMaster
Properties:
NamespaceName: namespace-0001
Mode: direct
Settings: {
"version": "2019-09-09",
"moldModels": [
{
"name": "party",
"initialMaxCapacity": 10,
"maxCapacity": 20,
"formModel":
{
"name": "party",
"metadata": "PARTY",
"slots": [
{
"name": "tank",
"metadata": "TANK",
"propertyRegex": "grn:.*"
},
{
"name": "healer",
"metadata": "HEALER",
"propertyRegex": "grn:.*"
},
{
"name": "dps_1",
"metadata": "DPS",
"propertyRegex": "grn:.*"
},
{
"name": "dps_2",
"metadata": "DPS",
"propertyRegex": "grn:.*"
}
]
},
"metadata": "PARTY"
},
{
"name": "equipment",
"initialMaxCapacity": 20,
"maxCapacity": 30,
"formModel":
{
"name": "equipment",
"metadata": "EQUIPMENT",
"slots": [
{
"name": "head",
"metadata": "HEAD",
"propertyRegex": "grn:.*"
},
{
"name": "body",
"metadata": "BODY",
"propertyRegex": "grn:.*"
},
{
"name": "leg",
"metadata": "LEG",
"propertyRegex": "grn:.*"
}
]
},
"metadata": "EQUIPMENT"
}
],
"propertyFormModels": []
}
UploadToken: nullimport (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/formation"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
formation.NewNamespace(
&SampleStack,
"namespace-0001",
formation.NamespaceOptions{},
).MasterData(
[]formation.MoldModel{
formation.NewMoldModel(
"party",
10,
20,
formation.NewFormModel(
"party",
[]formation.SlotModel{
formation.NewSlotModel(
"tank",
"grn:.*",
formation.SlotModelOptions{
Metadata: pointy.String("TANK"),
},
),
formation.NewSlotModel(
"healer",
"grn:.*",
formation.SlotModelOptions{
Metadata: pointy.String("HEALER"),
},
),
formation.NewSlotModel(
"dps_1",
"grn:.*",
formation.SlotModelOptions{
Metadata: pointy.String("DPS"),
},
),
formation.NewSlotModel(
"dps_2",
"grn:.*",
formation.SlotModelOptions{
Metadata: pointy.String("DPS"),
},
),
},
formation.FormModelOptions{
Metadata: pointy.String("PARTY"),
},
),
formation.MoldModelOptions{
Metadata: pointy.String("PARTY"),
},
),
formation.NewMoldModel(
"equipment",
20,
30,
formation.NewFormModel(
"equipment",
[]formation.SlotModel{
formation.NewSlotModel(
"head",
"grn:.*",
formation.SlotModelOptions{
Metadata: pointy.String("HEAD"),
},
),
formation.NewSlotModel(
"body",
"grn:.*",
formation.SlotModelOptions{
Metadata: pointy.String("BODY"),
},
),
formation.NewSlotModel(
"leg",
"grn:.*",
formation.SlotModelOptions{
Metadata: pointy.String("LEG"),
},
),
},
formation.FormModelOptions{
Metadata: pointy.String("EQUIPMENT"),
},
),
formation.MoldModelOptions{
Metadata: pointy.String("EQUIPMENT"),
},
),
},
[]formation.PropertyFormModel{
},
)
println(SampleStack.Yaml()) // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
(new \Gs2Cdk\Formation\Model\Namespace_(
stack: $this,
name: "namespace-0001"
))->masterData(
[
new \Gs2Cdk\Formation\Model\MoldModel(
name:"party",
initialMaxCapacity:10,
maxCapacity:20,
formModel:new \Gs2Cdk\Formation\Model\FormModel(
name: "party",
slots: [
new \Gs2Cdk\Formation\Model\SlotModel(
name: "tank",
propertyRegex: "grn:.*",
options: new \Gs2Cdk\Formation\Model\Options\SlotModelOptions(
metadata: "TANK",
)
),
new \Gs2Cdk\Formation\Model\SlotModel(
name: "healer",
propertyRegex: "grn:.*",
options: new \Gs2Cdk\Formation\Model\Options\SlotModelOptions(
metadata: "HEALER",
)
),
new \Gs2Cdk\Formation\Model\SlotModel(
name: "dps_1",
propertyRegex: "grn:.*",
options: new \Gs2Cdk\Formation\Model\Options\SlotModelOptions(
metadata: "DPS",
)
),
new \Gs2Cdk\Formation\Model\SlotModel(
name: "dps_2",
propertyRegex: "grn:.*",
options: new \Gs2Cdk\Formation\Model\Options\SlotModelOptions(
metadata: "DPS",
)
),
],
options: new \Gs2Cdk\Formation\Model\Options\FormModelOptions(
metadata: "PARTY",
)
),
options: new \Gs2Cdk\Formation\Model\Options\MoldModelOptions(
metadata:"PARTY"
)
),
new \Gs2Cdk\Formation\Model\MoldModel(
name:"equipment",
initialMaxCapacity:20,
maxCapacity:30,
formModel:new \Gs2Cdk\Formation\Model\FormModel(
name: "equipment",
slots: [
new \Gs2Cdk\Formation\Model\SlotModel(
name: "head",
propertyRegex: "grn:.*",
options: new \Gs2Cdk\Formation\Model\Options\SlotModelOptions(
metadata: "HEAD",
)
),
new \Gs2Cdk\Formation\Model\SlotModel(
name: "body",
propertyRegex: "grn:.*",
options: new \Gs2Cdk\Formation\Model\Options\SlotModelOptions(
metadata: "BODY",
)
),
new \Gs2Cdk\Formation\Model\SlotModel(
name: "leg",
propertyRegex: "grn:.*",
options: new \Gs2Cdk\Formation\Model\Options\SlotModelOptions(
metadata: "LEG",
)
),
],
options: new \Gs2Cdk\Formation\Model\Options\FormModelOptions(
metadata: "EQUIPMENT",
)
),
options: new \Gs2Cdk\Formation\Model\Options\MoldModelOptions(
metadata:"EQUIPMENT"
)
)
],
[
]
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.formation.model.Namespace(
this,
"namespace-0001"
).masterData(
Arrays.asList(
new io.gs2.cdk.formation.model.MoldModel(
"party",
10,
20,
new io.gs2.cdk.formation.model.FormModel(
"party",
Arrays.asList(
new io.gs2.cdk.formation.model.SlotModel(
"tank",
"grn:.*",
new io.gs2.cdk.formation.model.options.SlotModelOptions()
.withMetadata("TANK")
),
new io.gs2.cdk.formation.model.SlotModel(
"healer",
"grn:.*",
new io.gs2.cdk.formation.model.options.SlotModelOptions()
.withMetadata("HEALER")
),
new io.gs2.cdk.formation.model.SlotModel(
"dps_1",
"grn:.*",
new io.gs2.cdk.formation.model.options.SlotModelOptions()
.withMetadata("DPS")
),
new io.gs2.cdk.formation.model.SlotModel(
"dps_2",
"grn:.*",
new io.gs2.cdk.formation.model.options.SlotModelOptions()
.withMetadata("DPS")
)
),
new io.gs2.cdk.formation.model.options.FormModelOptions()
.withMetadata("PARTY")
),
new io.gs2.cdk.formation.model.options.MoldModelOptions()
.withMetadata("PARTY")
),
new io.gs2.cdk.formation.model.MoldModel(
"equipment",
20,
30,
new io.gs2.cdk.formation.model.FormModel(
"equipment",
Arrays.asList(
new io.gs2.cdk.formation.model.SlotModel(
"head",
"grn:.*",
new io.gs2.cdk.formation.model.options.SlotModelOptions()
.withMetadata("HEAD")
),
new io.gs2.cdk.formation.model.SlotModel(
"body",
"grn:.*",
new io.gs2.cdk.formation.model.options.SlotModelOptions()
.withMetadata("BODY")
),
new io.gs2.cdk.formation.model.SlotModel(
"leg",
"grn:.*",
new io.gs2.cdk.formation.model.options.SlotModelOptions()
.withMetadata("LEG")
)
),
new io.gs2.cdk.formation.model.options.FormModelOptions()
.withMetadata("EQUIPMENT")
),
new io.gs2.cdk.formation.model.options.MoldModelOptions()
.withMetadata("EQUIPMENT")
)
),
Arrays.asList(
)
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Formation.Model.Namespace(
stack: this,
name: "namespace-0001"
).MasterData(
new Gs2Cdk.Gs2Formation.Model.MoldModel[] {
new Gs2Cdk.Gs2Formation.Model.MoldModel(
name: "party",
initialMaxCapacity: 10,
maxCapacity: 20,
formModel: new Gs2Cdk.Gs2Formation.Model.FormModel(
name: "party",
slots: new Gs2Cdk.Gs2Formation.Model.SlotModel[]
{
new Gs2Cdk.Gs2Formation.Model.SlotModel(
name: "tank",
propertyRegex: "grn:.*",
options: new Gs2Cdk.Gs2Formation.Model.Options.SlotModelOptions
{
metadata = "TANK"
}
),
new Gs2Cdk.Gs2Formation.Model.SlotModel(
name: "healer",
propertyRegex: "grn:.*",
options: new Gs2Cdk.Gs2Formation.Model.Options.SlotModelOptions
{
metadata = "HEALER"
}
),
new Gs2Cdk.Gs2Formation.Model.SlotModel(
name: "dps_1",
propertyRegex: "grn:.*",
options: new Gs2Cdk.Gs2Formation.Model.Options.SlotModelOptions
{
metadata = "DPS"
}
),
new Gs2Cdk.Gs2Formation.Model.SlotModel(
name: "dps_2",
propertyRegex: "grn:.*",
options: new Gs2Cdk.Gs2Formation.Model.Options.SlotModelOptions
{
metadata = "DPS"
}
)
},
options: new Gs2Cdk.Gs2Formation.Model.Options.FormModelOptions
{
metadata = "PARTY"
}
),
options: new Gs2Cdk.Gs2Formation.Model.Options.MoldModelOptions
{
metadata = "PARTY"
}
),
new Gs2Cdk.Gs2Formation.Model.MoldModel(
name: "equipment",
initialMaxCapacity: 20,
maxCapacity: 30,
formModel: new Gs2Cdk.Gs2Formation.Model.FormModel(
name: "equipment",
slots: new Gs2Cdk.Gs2Formation.Model.SlotModel[]
{
new Gs2Cdk.Gs2Formation.Model.SlotModel(
name: "head",
propertyRegex: "grn:.*",
options: new Gs2Cdk.Gs2Formation.Model.Options.SlotModelOptions
{
metadata = "HEAD"
}
),
new Gs2Cdk.Gs2Formation.Model.SlotModel(
name: "body",
propertyRegex: "grn:.*",
options: new Gs2Cdk.Gs2Formation.Model.Options.SlotModelOptions
{
metadata = "BODY"
}
),
new Gs2Cdk.Gs2Formation.Model.SlotModel(
name: "leg",
propertyRegex: "grn:.*",
options: new Gs2Cdk.Gs2Formation.Model.Options.SlotModelOptions
{
metadata = "LEG"
}
)
},
options: new Gs2Cdk.Gs2Formation.Model.Options.FormModelOptions
{
metadata = "EQUIPMENT"
}
),
options: new Gs2Cdk.Gs2Formation.Model.Options.MoldModelOptions
{
metadata = "EQUIPMENT"
}
)
},
new Gs2Cdk.Gs2Formation.Model.PropertyFormModel[] {
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import formation from "@/gs2cdk/formation";
class SampleStack extends core.Stack
{
public constructor() {
super();
new formation.model.Namespace(
this,
"namespace-0001",
).masterData(
[
new formation.model.MoldModel(
"party",
10,
20,
new formation.model.FormModel(
"party",
[
new formation.model.SlotModel(
"tank",
"grn:.*",
{
metadata: "TANK"
}
),
new formation.model.SlotModel(
"healer",
"grn:.*",
{
metadata: "HEALER"
}
),
new formation.model.SlotModel(
"dps_1",
"grn:.*",
{
metadata: "DPS"
}
),
new formation.model.SlotModel(
"dps_2",
"grn:.*",
{
metadata: "DPS"
}
),
],
{
metadata: "PARTY"
}
),
{
metadata: "PARTY"
}
),
new formation.model.MoldModel(
"equipment",
20,
30,
new formation.model.FormModel(
"equipment",
[
new formation.model.SlotModel(
"head",
"grn:.*",
{
metadata: "HEAD"
}
),
new formation.model.SlotModel(
"body",
"grn:.*",
{
metadata: "BODY"
}
),
new formation.model.SlotModel(
"leg",
"grn:.*",
{
metadata: "LEG"
}
),
],
{
metadata: "EQUIPMENT"
}
),
{
metadata: "EQUIPMENT"
}
)
],
[
]
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, formation
class SampleStack(Stack):
def __init__(self):
super().__init__()
formation.Namespace(
stack=self,
name="namespace-0001",
).master_data(
mold_models=[
formation.MoldModel(
name='party',
initial_max_capacity=10,
max_capacity=20,
form_model=formation.FormModel(
name='party',
slots=[
formation.SlotModel(
name='tank',
property_regex='grn:.*',
options=formation.SlotModelOptions(
metadata='TANK',
),
),
formation.SlotModel(
name='healer',
property_regex='grn:.*',
options=formation.SlotModelOptions(
metadata='HEALER',
),
),
formation.SlotModel(
name='dps_1',
property_regex='grn:.*',
options=formation.SlotModelOptions(
metadata='DPS',
),
),
formation.SlotModel(
name='dps_2',
property_regex='grn:.*',
options=formation.SlotModelOptions(
metadata='DPS',
),
),
],
options=formation.FormModelOptions(
metadata='PARTY',
),
),
options=formation.MoldModelOptions(
metadata = 'PARTY'
),
),
formation.MoldModel(
name='equipment',
initial_max_capacity=20,
max_capacity=30,
form_model=formation.FormModel(
name='equipment',
slots=[
formation.SlotModel(
name='head',
property_regex='grn:.*',
options=formation.SlotModelOptions(
metadata='HEAD',
),
),
formation.SlotModel(
name='body',
property_regex='grn:.*',
options=formation.SlotModelOptions(
metadata='BODY',
),
),
formation.SlotModel(
name='leg',
property_regex='grn:.*',
options=formation.SlotModelOptions(
metadata='LEG',
),
),
],
options=formation.FormModelOptions(
metadata='EQUIPMENT',
),
),
options=formation.MoldModelOptions(
metadata = 'EQUIPMENT'
),
),
],
property_form_models=[
],
)
print(SampleStack().yaml()) # Generate TemplateFormModel
フォームモデル
フォームモデルは編成状況を表すエンティティです。
編成できる領域として スロット を定義できます。
武器・防具 であれば 「右手」「左手」「胴」「腕」のような部位をスロットとし、
パーティであれば「前衛」「中衛」「後衛」のようなポジションをスロットとして表現できます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| formModelId | string | ✓* | ~ 1024文字 | フォームモデル
GRN ※ サーバー側で自動的に設定 | ||
| name | string | ✓ | ~ 128文字 | フォームモデル名 フォームモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| slots | List<SlotModel> | ✓ | 1 ~ 10 items | スロットモデルリスト |
SlotModel
スロットモデル
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128文字 | スロットモデル名 | ||
| propertyRegex | string | ✓ | “.*” | ~ 512文字 | プロパティとして設定可能な値の正規表現 | |
| metadata | string | ~ 512文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 |
MoldModel
フォームの保存領域モデル
フォームの保存領域モデルは、パーティ編成であれば「火属性パーティ」「水属性パーティ」のような形で保存することを想定しています。
保存できる領域の数は制限することができ、個別に拡張することもできます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| moldModelId | string | ✓* | ~ 1024文字 | フォームの保存領域
GRN ※ サーバー側で自動的に設定 | ||
| name | string | ✓ | ~ 128文字 | フォームの保存領域モデルの名前 フォームの保存領域モデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| initialMaxCapacity | int | ✓ | 1 ~ 2147483646 | フォームを保存できる初期キャパシティ | ||
| maxCapacity | int | ✓ | 1 ~ 2147483646 | フォームを保存できる最大キャパシティ | ||
| formModel | FormModel | ✓ | フォームモデル |
PropertyFormModel
プロパティフォームモデル
プロパティフォームモデルは編成状況を表すエンティティです。
Mold / Form との違いは、スロット数を定義して、各スロットに編成を記録するのが Mold / Form で、
所有している装備に対してスキルを設定するような、数を事前に決めるのが難しい編成を表現するのに利用するのがプロパティフォームモデルです。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| propertyFormModelId | string | ✓* | ~ 1024文字 | プロパティフォームモデル
GRN ※ サーバー側で自動的に設定 | ||
| name | string | ✓ | ~ 128文字 | プロパティフォームモデル名 プロパティフォームモデル固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| metadata | string | ~ 2048文字 | メタデータ メタデータには任意の値を設定できます。 これらの値は GS2 の動作には影響しないため、ゲーム内で利用する情報の保存先として使用できます。 | |||
| slots | List<SlotModel> | ✓ | 1 ~ 10 items | スロットモデルリスト |