GS2-Matchmaking Deploy/CDK Reference

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

Entities

Resources targeted by the Deploy operation

Namespace

Namespace

A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. 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.

Request

Resource creation and update requests

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSettingTransaction Settings
Configuration for controlling how transactions are processed when executing matchmaking operations.
enableRatingboolfalseEnable Rating
Whether to enable the Glicko-2 based rating calculation function.
When enabled, players can submit match results via the Vote system and have their ratings automatically updated.
Requires RatingModel master data to be configured. Defaults to false.
enableDisconnectDetectionString Enum
enum {
  “disable”,
  “enable”
}
“disable”Disconnect Detection
Controls whether players in matchmaking must periodically report they are still waiting.
When enabled, if a player does not send a keep-alive within the configured timeout period, they are automatically removed from the Gathering.
This prevents “ghost” players from blocking matchmaking completion. Defaults to “disable”.
DefinitionDescription
“disable”Disable
“enable”Enable
disconnectDetectionTimeoutSecondsint{enableDisconnectDetection} == “enable”
✓*
15 ~ 600Disconnect Detection Timeout (seconds)
The number of seconds to wait without a keep-alive report before a player is considered disconnected and removed from the Gathering.
Only applies when disconnect detection is enabled. Must be between 15 and 600 seconds.
* Required if enableDisconnectDetection is “enable”
createGatheringTriggerTypeString Enum
enum {
  “none”,
  “gs2_realtime”,
  “gs2_script”
}
“none”Create Gathering Trigger Type
The type of action to execute when a new Gathering is created.
Can trigger GS2-Realtime room creation for real-time communication, or execute a GS2-Script for custom logic. Defaults to “none”.
DefinitionDescription
“none”None
“gs2_realtime”GS2-Realtime Room Creation
“gs2_script”GS2-Script Execution
createGatheringTriggerRealtimeNamespaceIdstring{createGatheringTriggerType} == “gs2_realtime”
✓*
~ 1024 charsGS2-Realtime namespace to create rooms when creating a gathering
* Required if createGatheringTriggerType is “gs2_realtime”
createGatheringTriggerScriptIdstring{createGatheringTriggerType} == “gs2_script”
✓*
~ 1024 charsGS2-Script script GRN to be executed when creating a gathering
* Required if createGatheringTriggerType is “gs2_script”
completeMatchmakingTriggerTypeString Enum
enum {
  “none”,
  “gs2_realtime”,
  “gs2_script”
}
“none”Complete Matchmaking Trigger Type
The type of action to execute when matchmaking completes (all role slots are filled).
Can trigger GS2-Realtime room creation for the matched players, or execute a GS2-Script for custom post-match logic. Defaults to “none”.
DefinitionDescription
“none”None
“gs2_realtime”GS2-Realtime Room Creation
“gs2_script”GS2-Script Execution
completeMatchmakingTriggerRealtimeNamespaceIdstring{completeMatchmakingTriggerType} == “gs2_realtime”
✓*
~ 1024 charsGS2-Realtime namespace GRN to create rooms when matchmaking is complete
* Required if completeMatchmakingTriggerType is “gs2_realtime”
completeMatchmakingTriggerScriptIdstring{completeMatchmakingTriggerType} == “gs2_script”
✓*
~ 1024 charsGS2-Script script GRN to be executed when matchmaking is complete
* Required if completeMatchmakingTriggerType is “gs2_script”
enableCollaborateSeasonRatingString Enum
enum {
  “enable”,
  “disable”
}
“disable”Enable Season Rating Collaboration
Whether to enable integration with GS2-SeasonRating for season-based rating calculations.
When enabled, a rating calculation session is automatically created in the specified GS2-SeasonRating namespace when matchmaking completes.
Defaults to “disable”.
DefinitionDescription
“enable”Enable
“disable”Disable
collaborateSeasonRatingNamespaceIdstring{enableCollaborateSeasonRating} == “enable”
✓*
~ 1024 charsSeason Rating Namespace GRN
* Required if enableCollaborateSeasonRating is “enable”
collaborateSeasonRatingTtlint{enableCollaborateSeasonRating} == “enable”6060 ~ 7200Season Rating Result TTL (seconds)
The maximum time in seconds to wait for match result submissions via GS2-SeasonRating after matchmaking completes.
If results are not submitted within this period, the rating session expires. Must be between 60 and 7200 seconds. Defaults to 60.
* Required if enableCollaborateSeasonRating is “enable”
changeRatingScriptScriptSettingScript setting to be executed when the rating value changes
Script Trigger Reference - changeRating
joinNotificationNotificationSettingJoin Notification
Push notification settings for when a new player joins a Gathering.
Notifies existing participants that a new player has joined, allowing the game client to update the matchmaking UI.
leaveNotificationNotificationSettingLeave Notification
Push notification settings for when a player leaves a Gathering.
Notifies remaining participants that a player has left, allowing the game client to reflect the change.
completeNotificationNotificationSettingComplete Notification
Push notification settings for when matchmaking completes (all role slots are filled).
Notifies all participants that the Gathering is full and the match can begin.
changeRatingNotificationNotificationSettingChange Rating Notification
Push notification settings for when a player’s rating value changes after vote processing.
Notifies the affected player of their new rating, allowing the game client to display the updated value.
logSettingLogSettingLog Output Settings
Configuration for outputting API request/response logs to GS2-Log.
When configured, matchmaking operations (create/join/leave gathering, vote, rating changes, etc.) are logged for monitoring and analysis.

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

TypeDescription
ItemNamespaceNamespace created

Implementation Example

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:seasonRating:namespace-0001
  CollaborateSeasonRatingTtl: 60
  ChangeRatingScript: null
  JoinNotification: null
  LeaveNotification: null
  CompleteNotification: null
  ChangeRatingNotification: 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/matchmaking"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
matchmaking.NewNamespace(
    &SampleStack,
    "namespace-0001",
    matchmaking.NamespaceOptions{
        EnableRating: true,
        CreateGatheringTriggerType: matchmaking.NamespaceCreateGatheringTriggerTypeNone,
        CompleteMatchmakingTriggerType: matchmaking.NamespaceCompleteMatchmakingTriggerTypeNone,
        EnableCollaborateSeasonRating: matchmaking.NamespaceEnableCollaborateSeasonRatingDisable,
        CollaborateSeasonRatingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:seasonRating: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",
            options: new \Gs2Cdk\Matchmaking\Model\Options\NamespaceOptions(
                enableRating: true,
                createGatheringTriggerType: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceCreateGatheringTriggerType::NONE,
                completeMatchmakingTriggerType: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceCompleteMatchmakingTriggerType::NONE,
                enableCollaborateSeasonRating: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceEnableCollaborateSeasonRating::DISABLE,
                collaborateSeasonRatingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:seasonRating: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",
                new io.gs2.cdk.matchmaking.model.options.NamespaceOptions()
                        .withEnableRating(true)
                        .withCreateGatheringTriggerType(io.gs2.cdk.matchmaking.model.enums.NamespaceCreateGatheringTriggerType.NONE)
                        .withCompleteMatchmakingTriggerType(io.gs2.cdk.matchmaking.model.enums.NamespaceCompleteMatchmakingTriggerType.NONE)
                        .withEnableCollaborateSeasonRating(io.gs2.cdk.matchmaking.model.enums.NamespaceEnableCollaborateSeasonRating.DISABLE)
                        .withCollaborateSeasonRatingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:seasonRating: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 Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Matchmaking.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Matchmaking.Model.Options.NamespaceOptions
            {
                enableRating = true,
                createGatheringTriggerType = Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCreateGatheringTriggerType.None,
                completeMatchmakingTriggerType = Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCompleteMatchmakingTriggerType.None,
                enableCollaborateSeasonRating = Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceEnableCollaborateSeasonRating.Disable,
                collaborateSeasonRatingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:seasonRating: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 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",
            {
                enableRating: true,
                createGatheringTriggerType: matchmaking.model.NamespaceCreateGatheringTriggerType.NONE,
                completeMatchmakingTriggerType: matchmaking.model.NamespaceCompleteMatchmakingTriggerType.NONE,
                enableCollaborateSeasonRating: matchmaking.model.NamespaceEnableCollaborateSeasonRating.DISABLE,
                collaborateSeasonRatingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:seasonRating: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',
            options=matchmaking.NamespaceOptions(
                enable_rating=True,
                create_gathering_trigger_type=matchmaking.NamespaceCreateGatheringTriggerType.NONE,
                complete_matchmaking_trigger_type=matchmaking.NamespaceCompleteMatchmakingTriggerType.NONE,
                enable_collaborate_season_rating=matchmaking.NamespaceEnableCollaborateSeasonRating.DISABLE,
                collaborate_season_rating_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:seasonRating: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 Template

TransactionSetting

Transaction Settings

Transaction Settings control how transactions are executed, their consistency, asynchronous processing, and conflict avoidance mechanisms. Combining features like AutoRun, AtomicCommit, asynchronous execution using GS2-Distributor, batch application of script results, and asynchronous Acquire Actions via GS2-JobQueue enables robust transaction management tailored to game logic.

TypeConditionRequiredDefaultValue LimitsDescription
enableAutoRunboolfalseWhether to automatically execute issued transactions on the server side
enableAtomicCommitbool{enableAutoRun} == truefalseWhether to commit the execution of transactions atomically
* Applicable only if enableAutoRun is true
transactionUseDistributorbool{enableAtomicCommit} == truefalseWhether to execute transactions asynchronously
* Applicable only if enableAtomicCommit is true
commitScriptResultInUseDistributorbool{transactionUseDistributor} == truefalseWhether to execute the commit processing of the script result asynchronously
* Applicable only if transactionUseDistributor is true
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalseWhether to use GS2-JobQueue to execute the acquire action
* Applicable only if enableAtomicCommit is true
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024 charsGS2-Distributor Namespace GRN used to execute transactions
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024 charsGS2-JobQueue Namespace GRN used to execute transactions

ScriptSetting

Script Setting

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’s execution results to halt API execution or control the API’s response content.

In contrast, asynchronous execution does not block processing until the script has finished executing. However, because the script result cannot be used to stop the API execution or modify the API response, asynchronous execution does not affect the API response flow and 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 charsGS2-Script script GRN executed synchronously when the API is executed
Must be specified in GRN format starting with “grn:gs2:”.
doneTriggerTargetTypeString Enum
enum {
  “none”,
  “gs2_script”,
  “aws”
}
“none”How to execute asynchronous scripts
Specifies the type of script to use for asynchronous execution.
You can choose from “Do not use asynchronous execution (none)”, “Use GS2-Script (gs2_script)”, and “Use Amazon EventBridge (aws)”.
DefinitionDescription
“none”None
“gs2_script”GS2-Script
“aws”Amazon EventBridge
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsGS2-Script script GRN for asynchronous execution
Must be specified in GRN format starting with “grn:gs2:”.
* Applicable only 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 are not many cases where GS2-JobQueue is required, so you generally do not need to specify it unless you have a specific reason.
* Applicable only if doneTriggerTargetType is “gs2_script”

NotificationSetting

Push Notification Settings

This is a setting for sending push notifications when an event occurs in a GS2 microservice. The push notification here refers to the processing via the WebSocket interface provided by GS2-Gateway, and is different from the push notification of a smartphone. For example, when a matchmaking is completed or a friend request is received, the GS2-Gateway can send a push notification via the WebSocket interface, and the game client can detect the change of the state.

GS2-Gateway’s push notifications can be used to forward notifications to mobile push notification services when the destination device is offline. By properly utilizing mobile push notifications, you can implement a flow in which players are notified even if they exit the game during matchmaking and later return to it.

TypeConditionRequiredDefaultValue LimitsDescription
gatewayNamespaceIdstring“grn:gs2:{region}:{ownerId}:gateway:default”~ 1024 charsGS2-Gateway namespace to use for push notifications
Specify the GS2-Gateway namespace ID in GRN format starting with “grn:gs2:”.
enableTransferMobileNotificationbool?falseWhether to forward the notification as a mobile push notification
When this notification is sent and the destination device is offline, specify whether to forward it as a mobile push notification.
soundstring{enableTransferMobileNotification} == true~ 1024 charsSound file name to be used for mobile push notifications
The sound file name specified here is used when sending mobile push notifications, and you can send notifications with a special sound.
* Applicable only if enableTransferMobileNotification is true
enableString Enum
enum {
  “Enabled”,
  “Disabled”
}
“Enabled”Whether to enable push notifications
DefinitionDescription
“Enabled”Enabled
“Disabled”Disabled

LogSetting

Log Output Setting

Log Output Setting defines how log data is exported. 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, debugging, and other operational purposes.

TypeConditionRequiredDefaultValue LimitsDescription
loggingNamespaceIdstring
~ 1024 charsGS2-Log namespace GRN to output logs
Must be specified in GRN format starting with “grn:gs2:”.

CurrentModelMaster

Currently active Models master data

This master data describes the definitions of Models currently active within the namespace. GS2 uses JSON format files for managing master data. By uploading these files, the master data settings are updated on the server.

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

Request

Resource creation and update requests

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
modeString Enum
enum {
  “direct”,
  “preUpload”
}
“direct”Update mode
DefinitionDescription
“direct”Directly update master data
“preUpload”Upload master data and then update
settingsstring{mode} == “direct”
✓*
~ 5242880 charsMaster Data
* Required if mode is “direct”
uploadTokenstring{mode} == “preUpload”
✓*
~ 1024 charsToken obtained by pre-upload
Used to apply the uploaded master data.
* Required if mode is “preUpload”

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

TypeDescription
ItemCurrentModelMasterUpdated master data of the currently active Models

Implementation Example

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: null
import (
    "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 Template
public 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 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
        ).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:seasonRating: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 Template

RatingModel

Rating Model

GS2 uses Glicko-2 as its rating algorithm. Glicko-2 has several parameters, but GS2-Matchmaking aggregates them into a single parameter, volatility, which represents the totality of the parameters. Volatility is a parameter that expresses the magnitude of change; the larger the value, the greater the change in the rating value.

TypeConditionRequiredDefaultValue LimitsDescription
ratingModelIdstring
*
~ 1024 charsRating Model GRN
* Set automatically by the server
namestring
~ 128 charsRating Model name
Rating Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 128 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
initialValueint1500100 ~ 10000Initial Rating Value
The starting rate value assigned to new players when they first participate in rated matchmaking.
Defaults to 1500. All players begin at the same rating and it adjusts based on match results.
volatilityint1001 ~ 20000Rating Volatility
A Glicko-2 parameter that controls how much the rating value changes after each match.
Higher values cause larger rating fluctuations, making ratings adjust more quickly.
Lower values result in more stable ratings that change gradually. Defaults to 100.

SeasonModel

Season Model

Defines the season-specific settings for Season Matchmaking, including the period of persistent gatherings, maximum participant count, and tier integration settings. Managed by GS2-Schedule for period control, and can be linked with GS2-Experience for persistent gathering within the same tier as needed.

TypeConditionRequiredDefaultValue LimitsDescription
seasonModelIdstring
*
~ 1024 charsSeason Model GRN
* Set automatically by the server
namestring
~ 128 charsSeason Model name
Season Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
metadatastring~ 128 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
maximumParticipantsint
2 ~ 1000Maximum Number of Participants
The maximum number of players that can join a single Season Gathering.
Once this limit is reached, the Season Gathering is considered full and no more players can join.
Must be between 2 and 1000.
experienceModelIdstring~ 1024 charsExperience Model GRN for Tier Management
The GRN of the GS2-Experience experience model used to determine player tiers.
The player’s rank within this experience model is used as their tier for matchmaking, ensuring players are grouped with others at a similar level.
If not specified, tier-based grouping is disabled and all players are matched together regardless of level.
challengePeriodEventIdstring
~ 1024 charsChallenge Period Event GRN
The GRN of the GS2-Schedule event that defines the active period for this season.
Season Gatherings can only be created and joined while this event is active.
When the event period ends, the season closes and new matchmaking is no longer possible.