Skip to content
v2.274.0

Experimental

@aws-cdk/aws-gamelift-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

RuleSetContent Class ​

The rule set determines the two key elements of a match: your game's team structure and size, and how to group players together for the best possible match.

For example, a rule set might describe a match like this:

  • Create a match with two teams of five players each, one team is the defenders and the other team the invaders.
  • A team can have novice and experienced players, but the average skill of the two teams must be within 10 points of each other.
  • If no match is made after 30 seconds, gradually relax the skill requirements.

Example ​

ts
new gamelift.MatchmakingRuleSet(this, 'RuleSet', {
  matchmakingRuleSetName: 'my-test-ruleset',
  content: gamelift.RuleSetContent.fromJsonFile(path.join(__dirname, 'my-ruleset', 'ruleset.json')),
});
python
gamelift.MatchmakingRuleSet(self, "RuleSet",
    matchmaking_rule_set_name="my-test-ruleset",
    content=gamelift.RuleSetContent.from_json_file(path.join(__dirname, "my-ruleset", "ruleset.json"))
)
java
MatchmakingRuleSet.Builder.create(this, "RuleSet")
        .matchmakingRuleSetName("my-test-ruleset")
        .content(RuleSetContent.fromJsonFile(join(__dirname, "my-ruleset", "ruleset.json")))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.GameLift.Alpha
new MatchmakingRuleSet(this, "RuleSet", new MatchmakingRuleSetProps {
    MatchmakingRuleSetName = "my-test-ruleset",
    Content = RuleSetContent.FromJsonFile(Join(__dirname, "my-ruleset", "ruleset.json"))
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkgameliftalpha/v2
gamelift.NewMatchmakingRuleSet(this, jsii.String("RuleSet"), &MatchmakingRuleSetProps{
	MatchmakingRuleSetName: jsii.String("my-test-ruleset"),
	Content: gamelift.RuleSetContent_FromJsonFile(path.join(__dirname, jsii.String("my-ruleset"), jsii.String("ruleset.json"))),
})

Initializer ​

ts
new RuleSetContent(props: RuleSetContentProps)
python
RuleSetContent(props: RuleSetContentProps)
java
new RuleSetContent(RuleSetContentProps props)
csharp
new RuleSetContent(RuleSetContentProps props)
go
NewRuleSetContent(Props RuleSetContentProps)

Properties ​

contentIRuleSetBodycontentIRuleSetBodycontentIRuleSetBodyContentIRuleSetBodyContentIRuleSetBodyrequired#
RuleSet body content.

Methods ​

bind(_scope: Construct): RuleSetBodyConfigdef bind(self, _scope: Construct) -> RuleSetBodyConfigpublic RuleSetBodyConfig bind(Construct _scope)public RuleSetBodyConfig Bind(Construct _scope)func Bind(_scope Construct) RuleSetBodyConfig#
Called when the matchmaking ruleSet is initialized to allow this object to bind to the stack and add resources.
1 parameter

Parameters

  • _scope_scope_scope_scope_scope — The binding scope.
fromInline(body: string): IRuleSetContent@staticmethod def from_inline(body: str) -> IRuleSetContentpublic static IRuleSetContent fromInline(String body)public static IRuleSetContent FromInline(string body)func FromInline(Body *string) IRuleSetContentstatic#
Inline body for Matchmaking ruleSet.
1 parameter · returns

Parameters

  • bodybodybodybodyBody — The actual ruleSet body (maximum 65535 characters).

Returns: RuleSetContent with inline code.

fromJsonFile(path: string): IRuleSetContent@staticmethod def from_json_file(path: str) -> IRuleSetContentpublic static IRuleSetContent fromJsonFile(String path)public static IRuleSetContent FromJsonFile(string path)func FromJsonFile(Path *string) IRuleSetContentstatic#
Matchmaking ruleSet body from a file.
1 parameter · returns

Parameters

  • pathpathpathpathPath — The path to the ruleSet body file.

Returns: RuleSetContentBase based on JSON file content.