GS2-Matchmaking GS2-Deploy/CDK リファレンス
エンティティ
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
name | string | ✓ | | ~ 32文字 | ネームスペース名 |
description | string | | | ~ 1024文字 | 説明文 |
enableRating | bool | ✓ | false | | レーティング計算機能を使用するか |
createGatheringTriggerType | string | ✓ | | ~ 128文字 | ギャザリング新規作成時のアクション |
createGatheringTriggerRealtimeNamespaceId | string | {createGatheringTriggerType} == “gs2_realtime” | | ~ 1024文字 | ギャザリング作成時にルームを作成する GS2-Realtime のネームスペース |
createGatheringTriggerScriptId | string | {createGatheringTriggerType} == “gs2_script” | | ~ 1024文字 | ギャザリング作成時に実行される GS2-Script のスクリプト |
completeMatchmakingTriggerType | string | ✓ | | ~ 128文字 | マッチメイキング完了時のアクション |
completeMatchmakingTriggerRealtimeNamespaceId | string | {completeMatchmakingTriggerType} == “gs2_realtime” | | ~ 1024文字 | マッチメイキング完了時にルームを作成する GS2-Realtime のネームスペース |
completeMatchmakingTriggerScriptId | string | {completeMatchmakingTriggerType} == “gs2_script” | | ~ 1024文字 | マッチメイキング完了時に実行される GS2-Script のスクリプト |
changeRatingScript | ScriptSetting | | | | レーティング値が変化した時に実行するスクリプト |
joinNotification | NotificationSetting | | | | ギャザリングに新規プレイヤーが参加したときのプッシュ通知 |
leaveNotification | NotificationSetting | | | | ギャザリングからプレイヤーが離脱したときのプッシュ通知 |
completeNotification | NotificationSetting | | | | マッチメイキングが完了したときのプッシュ通知 |
changeRatingNotification | NotificationSetting | | | | レーティングの値が変動したときのプッシュ通知 |
logSetting | LogSetting | | | | ログの出力設定 |
GetAttr
実装例
Type: GS2::Matchmaking::Namespace
Properties:
Name: namespace1
Description: null
EnableRating: true
CreateGatheringTriggerType: none
CreateGatheringTriggerRealtimeNamespaceId: null
CreateGatheringTriggerScriptId: null
CompleteMatchmakingTriggerType: none
CompleteMatchmakingTriggerRealtimeNamespaceId: null
CompleteMatchmakingTriggerScriptId: null
ChangeRatingScript: null
JoinNotification: null
LeaveNotification: null
CompleteNotification: null
ChangeRatingNotification: null
LogSetting:
LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001
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,
log_setting=core.LogSetting(
logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
),
),
)
print(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\Enum\NamespaceCreateGatheringTriggerType::NONE,
completeMatchmakingTriggerType: \Gs2Cdk\Matchmaking\Model\Enum\NamespaceCompleteMatchmakingTriggerType::NONE,
options: new \Gs2Cdk\Matchmaking\Model\Options\NamespaceOptions(
enableRating: True,
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() {
{
enableRating = true;
logSetting = new io.gs2.cdk.core.model.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
);
}
}
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Template
import 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,
logSetting: new core.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
)
}
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Matchmaking.Model.Namespace(
this,
"namespace-0001",
Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCreateGatheringTriggerType.None,
Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCompleteMatchmakingTriggerType.None,
new Gs2Cdk.Gs2Matchmaking.Model.Options.NamespaceOptions {
enableRating = true,
logSetting = new Gs2Cdk.Core.Model.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
),
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Template
CurrentRatingModelMaster
現在有効なマスターデータ
GS2ではマスターデータの管理にJSON形式のファイルを使用します。
ファイルをアップロードすることで、実際にサーバーに設定を反映することができます。
JSONファイルを作成する方法として、マネージメントコンソール上でのマスターデータエディタを提供していますが
よりゲームの運営に相応しいツールを作成し、適切なフォーマットのJSONファイルを書き出すことでもサービスを利用可能です。
JSONファイルの形式についてはドキュメントを参照ください。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
settings | string | ✓ | | ~ 5242880文字 | マスターデータ |
GetAttr
実装例
Type: GS2::Matchmaking::CurrentRatingModelMaster
Properties:
NamespaceName: namespace1
Settings: {
"version": "2020-06-24",
"ratingModels": [
{
"name": "mode1",
"metadata": "MODE1",
"volatility": 100
},
{
"name": "mode2",
"metadata": "MODE2",
"volatility": 150
}
]
}
from gs2_cdk import Stack, core, matchmaking
class SampleStack(Stack):
def __init__(self):
super().__init__()
matchmaking.Namespace(
stack=self,
# 省略
).master_data(
[
matchmaking.RatingModel(
name='mode1',
volatility=100,
options=matchmaking.RatingModelOptions(
metadata='MODE1',
),
),
matchmaking.RatingModel(
name='mode2',
volatility=150,
options=matchmaking.RatingModelOptions(
metadata='MODE2',
),
),
],
)
print(SampleStack().yaml()) # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
(new \Gs2Cdk\Matchmaking\Model\Namespace_(
stack: $this,
// 省略
))->masterData(
[
new \Gs2Cdk\Matchmaking\Model\RatingModel(
name:"mode1",
volatility:100,
options: new \Gs2Cdk\Matchmaking\Model\Options\RatingModelOptions(
metadata:"MODE1",
),
),
new \Gs2Cdk\Matchmaking\Model\RatingModel(
name:"mode2",
volatility:150,
options: new \Gs2Cdk\Matchmaking\Model\Options\RatingModelOptions(
metadata:"MODE2",
),
),
],
);
}
}
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,
// 省略
).masterData(
Arrays.asList(
new io.gs2.cdk.matchmaking.model.RatingModel(
"mode1",
100,
new io.gs2.cdk.matchmaking.model.options.RatingModelOptions() {
{
metadata: "MODE1";
}
}
),
new io.gs2.cdk.matchmaking.model.RatingModel(
"mode2",
150,
new io.gs2.cdk.matchmaking.model.options.RatingModelOptions() {
{
metadata: "MODE2";
}
}
)
)
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Template
import core from "@/gs2cdk/core";
import matchmaking from "@/gs2cdk/matchmaking";
class SampleStack extends core.Stack
{
public constructor() {
super();
new matchmaking.model.Namespace(
this,
// 省略
).masterData(
[
new matchmaking.model.RatingModel(
"mode1",
100,
{
metadata: "MODE1"
}
),
new matchmaking.model.RatingModel(
"mode2",
150,
{
metadata: "MODE2"
}
)
]
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Matchmaking.Model.Namespace(
this,
// 省略
).MasterData(
new [] {
new Gs2Cdk.Gs2Matchmaking.Model.RatingModel(
"mode1",
100,
new Gs2Cdk.Gs2Matchmaking.Model.Options.RatingModelOptions {
metadata = "MODE1",
}
),
new Gs2Cdk.Gs2Matchmaking.Model.RatingModel(
"mode2",
150,
new Gs2Cdk.Gs2Matchmaking.Model.Options.RatingModelOptions {
metadata = "MODE2",
}
)
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Template
ScriptSetting
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
triggerScriptId | string | | | ~ 1024文字 | スクリプトGRN |
doneTriggerTargetType | enum [’none’, ‘gs2_script’, ‘aws’] | ✓ | “none” | ~ 128文字 | 完了通知の通知先 |
doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | | ~ 1024文字 | スクリプトGRN |
doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | | ~ 1024文字 | ネームスペースGRN |
NotificationSetting
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
gatewayNamespaceId | string | ✓ | | ~ 1024文字 | ネームスペースGRN |
enableTransferMobileNotification | bool? | | | | モバイルプッシュ通知へ転送するか |
sound | string | | | ~ 1024文字 | モバイルプッシュ通知で使用するサウンドファイル名 |
LogSetting
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
loggingNamespaceId | string | ✓ | | ~ 1024文字 | ネームスペースGRN |
GitHubCheckoutSetting
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
apiKeyId | string | ✓ | | ~ 1024文字 | GitHub のAPIキーGRN |
repositoryName | string | ✓ | | ~ 1024文字 | リポジトリ名 |
sourcePath | string | ✓ | | ~ 1024文字 | ソースコードのファイルパス |
referenceType | enum [‘commit_hash’, ‘branch’, ’tag’] | ✓ | | ~ 128文字 | コードの取得元 |
commitHash | string | {referenceType} == “commit_hash” | | ~ 1024文字 | コミットハッシュ |
branchName | string | {referenceType} == “branch” | | ~ 1024文字 | ブランチ名 |
tagName | string | {referenceType} == “tag” | | ~ 1024文字 | タグ名 |
AttributeRange
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
name | string | ✓ | | ~ 128文字 | 属性名 |
min | int | ✓ | 0 | ~ 2147483646 | ギャザリング参加可能な属性値の最小値 |
max | int | ✓ | 0 | ~ 2147483646 | ギャザリング参加可能な属性値の最大値 |
CapacityOfRole
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
roleName | string | ✓ | “default” | ~ 128文字 | ロール名 |
roleAliases | List<string> | | [] | | ロール名の別名リスト |
capacity | int | ✓ | | 1 ~ 256 | 募集人数 |
participants | List<Player> | | [] | | 参加者のプレイヤー情報リスト |
Attribute
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
name | string | ✓ | | ~ 128文字 | 属性名 |
value | int | ✓ | 0 | ~ 2147483646 | 属性値 |
Player
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
userId | string | ✓ | | ~ 128文字 | ユーザーID |
attributes | List<Attribute> | | [] | | 属性値のリスト |
roleName | string | ✓ | “default” | ~ 128文字 | ロール名 |
denyUserIds | List<string> | | [] | | 参加を拒否するユーザIDリスト |
GameResult
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
rank | int | ✓ | | ~ 2147483646 | 順位 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
Ballot
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
userId | string | ✓ | | ~ 128文字 | ユーザーID |
ratingName | string | ✓ | | ~ 128文字 | レーティング計算に使用するレーティング名 |
gatheringName | string | ✓ | | ~ 128文字 | 投票対象のギャザリング名 |
numberOfPlayer | int | ✓ | | 2 ~ 10 | 参加人数 |
SignedBallot
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
body | string | ✓ | | ~ 1024文字 | 投票用紙の署名対象のデータ |
signature | string | ✓ | | ~ 256文字 | 投票用紙の署名 |
WrittenBallot
TimeSpan
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
days | int | ✓ | 0 | ~ 365 | 現在時刻からの日数 |
hours | int | ✓ | 0 | ~ 24 | 現在時刻からの時間 |
minutes | int | ✓ | 0 | ~ 60 | 現在時刻からの分 |