GS2-Matchmaking GS2-Deploy/CDK リファレンス
エンティティ
Deloy処理で操作する対象リソース
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128文字 | ネームスペース名 | ||||||||||
| description | string | ~ 1024文字 | 説明文 | |||||||||||
| transactionSetting | TransactionSetting | トランザクション設定 | ||||||||||||
| enableRating | bool | ✓ | false | レーティング計算機能を使用するか | ||||||||||
| enableDisconnectDetection | 文字列列挙型 enum { “disable”, “enable” } | ✓ | “disable” | ~ 128文字 | マッチメイキング中プレイヤーの切断検知
| |||||||||
| disconnectDetectionTimeoutSeconds | int | {enableDisconnectDetection} == “enable” | ✓* | 15 ~ 600 | マッチメイキング中にプレイヤーを切断と見なすまでの待機時間(秒) ※ enableDisconnectDetection が “enable” であれば 必須 | |||||||||
| createGatheringTriggerType | 文字列列挙型 enum { “none”, “gs2_realtime”, “gs2_script” } | ✓ | ~ 128文字 | ギャザリング新規作成時のアクション
| ||||||||||
| createGatheringTriggerRealtimeNamespaceId | string | {createGatheringTriggerType} == “gs2_realtime” | ✓* | ~ 1024文字 | ギャザリング作成時にルームを作成する GS2-Realtime のネームスペース ※ createGatheringTriggerType が “gs2_realtime” であれば 必須 | |||||||||
| createGatheringTriggerScriptId | string | {createGatheringTriggerType} == “gs2_script” | ✓* | ~ 1024文字 | ギャザリング作成時に実行される GS2-Script のスクリプト ※ createGatheringTriggerType が “gs2_script” であれば 必須 | |||||||||
| completeMatchmakingTriggerType | 文字列列挙型 enum { “none”, “gs2_realtime”, “gs2_script” } | ✓ | ~ 128文字 | マッチメイキング完了時のアクション
| ||||||||||
| completeMatchmakingTriggerRealtimeNamespaceId | string | {completeMatchmakingTriggerType} == “gs2_realtime” | ✓* | ~ 1024文字 | マッチメイキング完了時にルームを作成する GS2-Realtime のネームスペース ※ completeMatchmakingTriggerType が “gs2_realtime” であれば 必須 | |||||||||
| completeMatchmakingTriggerScriptId | string | {completeMatchmakingTriggerType} == “gs2_script” | ✓* | ~ 1024文字 | マッチメイキング完了時に実行される GS2-Script のスクリプト ※ completeMatchmakingTriggerType が “gs2_script” であれば 必須 | |||||||||
| enableCollaborateSeasonRating | 文字列列挙型 enum { “enable”, “disable” } | ✓ | “disable” | ~ 128文字 | GS2-SeasonRating との連携を有効にするか
| |||||||||
| collaborateSeasonRatingNamespaceId | string | {enableCollaborateSeasonRating} == “enable” | ✓* | ~ 1024文字 | マッチメイキング完了時にセッションを作成する GS2-SeasonRating のネームスペース ※ enableCollaborateSeasonRating が “enable” であれば 必須 | |||||||||
| collaborateSeasonRatingTtl | int | {enableCollaborateSeasonRating} == “enable” | ✓* | 60 | 60 ~ 7200 | GS2-SeasonRating の結果を受け付ける最大時間(秒) ※ enableCollaborateSeasonRating が “enable” であれば 必須 | ||||||||
| changeRatingScript | ScriptSetting | レーティング値が変化した時に実行するスクリプト | ||||||||||||
| joinNotification | NotificationSetting | ギャザリングに新規プレイヤーが参加したときのプッシュ通知 | ||||||||||||
| leaveNotification | NotificationSetting | ギャザリングからプレイヤーが離脱したときのプッシュ通知 | ||||||||||||
| completeNotification | NotificationSetting | マッチメイキングが完了したときのプッシュ通知 | ||||||||||||
| changeRatingNotification | NotificationSetting | レーティングの値が変動したときのプッシュ通知 | ||||||||||||
| logSetting | LogSetting | ログの出力設定 |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | Namespace | 作成したネームスペース |
実装例
Type: GS2::Matchmaking::Namespace
Properties:
Name: namespace-0001
Description: null
TransactionSetting: null
EnableRating: true
EnableDisconnectDetection: null
DisconnectDetectionTimeoutSeconds: null
CreateGatheringTriggerType: none
CreateGatheringTriggerRealtimeNamespaceId: null
CreateGatheringTriggerScriptId: null
CompleteMatchmakingTriggerType: none
CompleteMatchmakingTriggerRealtimeNamespaceId: null
CompleteMatchmakingTriggerScriptId: null
EnableCollaborateSeasonRating: disable
CollaborateSeasonRatingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001
CollaborateSeasonRatingTtl: 60
ChangeRatingScript: null
JoinNotification: null
LeaveNotification: null
CompleteNotification: null
ChangeRatingNotification: 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/matchmaking"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
matchmaking.NewNamespace(
&SampleStack,
"namespace-0001",
matchmaking.NamespaceCreateGatheringTriggerTypeNone,
matchmaking.NamespaceCompleteMatchmakingTriggerTypeNone,
matchmaking.NamespaceOptions{
EnableRating: true,
EnableCollaborateSeasonRating: matchmaking.NamespaceEnableCollaborateSeasonRatingDisable,
CollaborateSeasonRatingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001"),
CollaborateSeasonRatingTtl: pointy.Int32(60),
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\Matchmaking\Model\Namespace_(
stack: $this,
name: "namespace-0001",
createGatheringTriggerType: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceCreateGatheringTriggerType::NONE,
completeMatchmakingTriggerType: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceCompleteMatchmakingTriggerType::NONE,
options: new \Gs2Cdk\Matchmaking\Model\Options\NamespaceOptions(
enableRating: True,
enableCollaborateSeasonRating: Gs2Cdk\Matchmaking\Model\Enums\NamespaceEnableCollaborateSeasonRating::DISABLE,
collaborateSeasonRatingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001",
collaborateSeasonRatingTtl: 60,
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.matchmaking.model.Namespace(
this,
"namespace-0001",
io.gs2.cdk.matchmaking.model.enums.NamespaceCreateGatheringTriggerType.NONE,
io.gs2.cdk.matchmaking.model.enums.NamespaceCompleteMatchmakingTriggerType.NONE,
new io.gs2.cdk.matchmaking.model.options.NamespaceOptions()
.withEnableRating(true)
.withEnableCollaborateSeasonRating(io.gs2.cdk.matchmaking.model.enums.NamespaceEnableCollaborateSeasonRating.DISABLE)
.withCollaborateSeasonRatingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001")
.withCollaborateSeasonRatingTtl(60)
.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.Gs2Matchmaking.Model.Namespace(
stack: this,
name: "namespace-0001",
createGatheringTriggerType: Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCreateGatheringTriggerType.None,
completeMatchmakingTriggerType: Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCompleteMatchmakingTriggerType.None,
options: new Gs2Cdk.Gs2Matchmaking.Model.Options.NamespaceOptions
{
enableRating = true,
enableCollaborateSeasonRating = Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceEnableCollaborateSeasonRating.Disable,
collaborateSeasonRatingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001",
collaborateSeasonRatingTtl = 60,
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 matchmaking from "@/gs2cdk/matchmaking";
class SampleStack extends core.Stack
{
public constructor() {
super();
new matchmaking.model.Namespace(
this,
"namespace-0001",
matchmaking.model.NamespaceCreateGatheringTriggerType.NONE,
matchmaking.model.NamespaceCompleteMatchmakingTriggerType.NONE,
{
enableRating: true,
enableCollaborateSeasonRating: matchmaking.model.NamespaceEnableCollaborateSeasonRating.DISABLE,
collaborateSeasonRatingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001",
collaborateSeasonRatingTtl: 60,
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, matchmaking
class SampleStack(Stack):
def __init__(self):
super().__init__()
matchmaking.Namespace(
stack=self,
name='namespace-0001',
create_gathering_trigger_type=matchmaking.NamespaceCreateGatheringTriggerType.NONE,
complete_matchmaking_trigger_type=matchmaking.NamespaceCompleteMatchmakingTriggerType.NONE,
options=matchmaking.NamespaceOptions(
enable_rating=True,
enable_collaborate_season_rating=matchmaking.NamespaceEnableCollaborateSeasonRating.DISABLE,
collaborate_season_rating_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001',
collaborate_season_rating_ttl=60,
log_setting=core.LogSetting(
logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
),
),
)
print(SampleStack().yaml()) # Generate TemplateScriptSetting
スクリプト設定
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” | ~ 128文字 | 非同期スクリプトの実行方法 非同期実行で使用するスクリプトの種類を指定します。 「非同期実行のスクリプトを使用しない(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” であれば有効 |
NotificationSetting
プッシュ通知に関する設定
GS2 のマイクロサービス内で何らかのイベントが発生した際に、プッシュ通知を送信するための設定です。
ここでいうプッシュ通知は GS2-Gateway の提供する WebSocket インターフェースを経由した処理であり、スマートフォンのプッシュ通知とは性質が異なります。
たとえば、マッチメイキングが完了した時やフレンドリクエストが届いた時など、ゲームクライアントの操作とは関係なく状態が変化した際に GS2-Gateway を経由してプッシュ通知をすることで、ゲームクライアントは状態の変化を検知することができます。
GS2-Gateway のプッシュ通知は通知先のデバイスがオフラインだった時に追加の処理としてモバイルプッシュ通知を送信できます。
モバイルプッシュ通知をうまく利用すれば、マッチメイキング中にゲームを終了しても、モバイルプッシュ通知を使用してプレイヤーに通知し、ゲームに戻ってくるフローを実現できる可能性があります。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gatewayNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:gateway:default” | ~ 1024文字 | プッシュ通知に使用する GS2-Gateway のネームスペース 「grn:gs2:」から始まる GRN 形式で GS2-Gateway のネームスペースIDを指定します。 | |||||||
| enableTransferMobileNotification | bool? | false | モバイルプッシュ通知へ転送するか この通知を送信しようとした時、通知先のデバイスがオフラインだった場合、モバイルプッシュ通知へ転送するかどうかを指定します。 | |||||||||
| sound | string | {enableTransferMobileNotification} == true | ~ 1024文字 | モバイルプッシュ通知で使用するサウンドファイル名 ここで指定したサウンドファイル名は、モバイルプッシュ通知を送信する際に使用され、特別なサウンドで通知を出すことができます。 ※ enableTransferMobileNotification が true であれば有効 | ||||||||
| enable | 文字列列挙型 enum { “Enabled”, “Disabled” } | ✓ | “Enabled” | ~ 128文字 | プッシュ通知を有効にするか
|
LogSetting
ログの書き出し設定
ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用される GS2-Log 名前空間の識別子(Namespace ID)を保持します。
ログ名前空間ID(loggingNamespaceId)には、ログデータを収集し保存する GS2-Log の名前空間を、GRNの形式で指定します。
この設定をすることで、設定された名前空間内で発生したAPIリクエスト・レスポンスのログデータが、対象の GS2-Log 名前空間側へ出力されるようになります。
GS2-Log ではリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024文字 | ログを出力する GS2-Log のネームスペースGRN |
TransactionSetting
トランザクション設定
トランザクション設定は、トランザクションの実行方法・整合性・非同期処理・競合回避の仕組みを制御する設定です。
自動実行(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 のネームスペース |
CurrentModelMaster
現在有効なマスターデータ
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール内にマスターデータエディタを提供しています。
また、よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
Note
JSONファイルの形式については GS2-Matchmaking マスターデータリファレンス をご参照ください。| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128文字 | ネームスペース名 | ||||||||
| mode | 文字列列挙型 enum { “direct”, “preUpload” } | ✓ | “direct” | ~ 128文字 | 更新モード
| |||||||
| settings | string | {mode} == “direct” | ✓* | ~ 5242880 バイト (5MB) | マスターデータ ※ mode が “direct” であれば 必須 | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024文字 | プレアップロードで取得したトークン ※ mode が “preUpload” であれば 必須 |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | CurrentModelMaster | 更新した現在有効なレーティングマスター |
実装例
Type: GS2::Matchmaking::CurrentModelMaster
Properties:
NamespaceName: namespace-0001
Mode: direct
Settings: {
"version": "2020-06-24",
"ratingModels": [
{
"name": "rating-0001",
"initialValue": 1500,
"volatility": 100,
"metadata": "RATING_0001"
},
{
"name": "rating-0002",
"initialValue": 1500,
"volatility": 150,
"metadata": "RATING_0002"
}
],
"seasonModels": [
{
"name": "season-0001",
"maximumParticipants": 50,
"challengePeriodEventId": "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
},
{
"name": "season-0002",
"maximumParticipants": 100,
"challengePeriodEventId": "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
}
]
}
UploadToken: nullimport (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/matchmaking"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
matchmaking.NewNamespace(
&SampleStack,
"namespace-0001",
matchmaking.NamespaceCreateGatheringTriggerTypeNone,
matchmaking.NamespaceCompleteMatchmakingTriggerTypeNone,
matchmaking.NamespaceOptions{},
).MasterData(
[]matchmaking.RatingModel{
matchmaking.NewRatingModel(
"rating-0001",
1500,
100,
matchmaking.RatingModelOptions{
Metadata: pointy.String("RATING_0001"),
},
),
matchmaking.NewRatingModel(
"rating-0002",
1500,
150,
matchmaking.RatingModelOptions{
Metadata: pointy.String("RATING_0002"),
},
),
},
[]matchmaking.SeasonModel{
matchmaking.NewSeasonModel(
"season-0001",
50,
"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001",
matchmaking.SeasonModelOptions{
},
),
matchmaking.NewSeasonModel(
"season-0002",
100,
"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002",
matchmaking.SeasonModelOptions{
},
),
},
)
println(SampleStack.Yaml()) // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
(new \Gs2Cdk\Matchmaking\Model\Namespace_(
stack: $this,
name: "namespace-0001",
createGatheringTriggerType: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceCreateGatheringTriggerType::NONE,
completeMatchmakingTriggerType: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceCompleteMatchmakingTriggerType::NONE
))->masterData(
[
new \Gs2Cdk\Matchmaking\Model\RatingModel(
name:"rating-0001",
initialValue:1500,
volatility:100,
options: new \Gs2Cdk\Matchmaking\Model\Options\RatingModelOptions(
metadata:"RATING_0001"
)
),
new \Gs2Cdk\Matchmaking\Model\RatingModel(
name:"rating-0002",
initialValue:1500,
volatility:150,
options: new \Gs2Cdk\Matchmaking\Model\Options\RatingModelOptions(
metadata:"RATING_0002"
)
)
],
[
new \Gs2Cdk\Matchmaking\Model\SeasonModel(
name:"season-0001",
maximumParticipants:50,
challengePeriodEventId:"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
),
new \Gs2Cdk\Matchmaking\Model\SeasonModel(
name:"season-0002",
maximumParticipants:100,
challengePeriodEventId:"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
)
]
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.matchmaking.model.Namespace(
this,
"namespace-0001",
io.gs2.cdk.matchmaking.model.enums.NamespaceCreateGatheringTriggerType.NONE,
io.gs2.cdk.matchmaking.model.enums.NamespaceCompleteMatchmakingTriggerType.NONE
).masterData(
Arrays.asList(
new io.gs2.cdk.matchmaking.model.RatingModel(
"rating-0001",
1500,
100,
new io.gs2.cdk.matchmaking.model.options.RatingModelOptions()
.withMetadata("RATING_0001")
),
new io.gs2.cdk.matchmaking.model.RatingModel(
"rating-0002",
1500,
150,
new io.gs2.cdk.matchmaking.model.options.RatingModelOptions()
.withMetadata("RATING_0002")
)
),
Arrays.asList(
new io.gs2.cdk.matchmaking.model.SeasonModel(
"season-0001",
50,
"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
),
new io.gs2.cdk.matchmaking.model.SeasonModel(
"season-0002",
100,
"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
)
)
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Matchmaking.Model.Namespace(
stack: this,
name: "namespace-0001",
createGatheringTriggerType: Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCreateGatheringTriggerType.None,
completeMatchmakingTriggerType: Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCompleteMatchmakingTriggerType.None
).MasterData(
new Gs2Cdk.Gs2Matchmaking.Model.RatingModel[] {
new Gs2Cdk.Gs2Matchmaking.Model.RatingModel(
name: "rating-0001",
initialValue: 1500,
volatility: 100,
options: new Gs2Cdk.Gs2Matchmaking.Model.Options.RatingModelOptions
{
metadata = "RATING_0001"
}
),
new Gs2Cdk.Gs2Matchmaking.Model.RatingModel(
name: "rating-0002",
initialValue: 1500,
volatility: 150,
options: new Gs2Cdk.Gs2Matchmaking.Model.Options.RatingModelOptions
{
metadata = "RATING_0002"
}
)
},
new Gs2Cdk.Gs2Matchmaking.Model.SeasonModel[] {
new Gs2Cdk.Gs2Matchmaking.Model.SeasonModel(
name: "season-0001",
maximumParticipants: 50,
challengePeriodEventId: "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
),
new Gs2Cdk.Gs2Matchmaking.Model.SeasonModel(
name: "season-0002",
maximumParticipants: 100,
challengePeriodEventId: "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
)
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import matchmaking from "@/gs2cdk/matchmaking";
class SampleStack extends core.Stack
{
public constructor() {
super();
new matchmaking.model.Namespace(
this,
"namespace-0001",
matchmaking.model.NamespaceCreateGatheringTriggerType.NONE,
matchmaking.model.NamespaceCompleteMatchmakingTriggerType.NONE
).masterData(
[
new matchmaking.model.RatingModel(
"rating-0001",
1500,
100,
{
metadata: "RATING_0001"
}
),
new matchmaking.model.RatingModel(
"rating-0002",
1500,
150,
{
metadata: "RATING_0002"
}
)
],
[
new matchmaking.model.SeasonModel(
"season-0001",
50,
"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
),
new matchmaking.model.SeasonModel(
"season-0002",
100,
"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
)
]
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, matchmaking
class SampleStack(Stack):
def __init__(self):
super().__init__()
matchmaking.Namespace(
stack=self,
name="namespace-0001",
create_gathering_trigger_type=matchmaking.NamespaceCreateGatheringTriggerType.NONE,
complete_matchmaking_trigger_type=matchmaking.NamespaceCompleteMatchmakingTriggerType.NONE,
options=matchmaking.NamespaceOptions(
enable_rating=True,
enable_collaborate_season_rating=matchmaking.NamespaceEnableCollaborateSeasonRating.DISABLE,
collaborate_season_rating_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001',
collaborate_season_rating_ttl=60,
log_setting=core.LogSetting(
logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
),
),
).master_data(
rating_models=[
matchmaking.RatingModel(
name='rating-0001',
initial_value=1500,
volatility=100,
options=matchmaking.RatingModelOptions(
metadata = 'RATING_0001'
),
),
matchmaking.RatingModel(
name='rating-0002',
initial_value=1500,
volatility=150,
options=matchmaking.RatingModelOptions(
metadata = 'RATING_0002'
),
),
],
season_models=[
matchmaking.SeasonModel(
name='season-0001',
maximum_participants=50,
challenge_period_event_id='grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001'
),
matchmaking.SeasonModel(
name='season-0002',
maximum_participants=100,
challenge_period_event_id='grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002'
),
],
)
print(SampleStack().yaml()) # Generate TemplateRatingModel
レーティングモデル
GS2 ではレーティングアルゴリズムとして Glicko-2 を採用しています。
Glicko-2 には複数のパラメータがありますが、GS2-Matchmaking ではそれらを総合的に表す ボラティリティ という1つのパラメータに集約しています。
ボラティリティ は変化の大きさを表すパラメータで、値が大きいほどレーティングの値の変動量が大きくなります。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| ratingModelId | string | ✓ | ~ 1024文字 | レーティングモデルGRN | ||
| name | string | ✓ | ~ 128文字 | レーティングモデル名 | ||
| metadata | string | ~ 128文字 | メタデータ | |||
| initialValue | int | ✓ | 1500 | 100 ~ 10000 | レート値の初期値 | |
| volatility | int | ✓ | 100 | 1 ~ 20000 | レート値の変動の大きさ |
SeasonModel
シーズンモデル
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| seasonModelId | string | ✓ | ~ 1024文字 | レーティングモデルGRN | ||
| name | string | ✓ | ~ 128文字 | シーズンモデル名 | ||
| metadata | string | ~ 128文字 | メタデータ | |||
| maximumParticipants | int | ✓ | 2 ~ 1000 | 最大参加人数 | ||
| experienceModelId | string | ~ 1024文字 | ティアーを保持する GS2-Experience の経験値モデル | |||
| challengePeriodEventId | string | ✓ | ~ 1024文字 | シーズンの期間を設定した GS2-Schedule イベントGRN |