I’m using flexmatch to connect players for my game in unity. My ruleset, which is on us-west-2, is basically the same as one of the examples, and as follows (called defaultRuleSet).
{
"name": "free-for-all",
"ruleLanguageVersion": "1.0",
"playerAttributes": [{
"name": "skill",
"type": "number"
}],
"algorithm": {
"balancedAttribute": "skill",
"strategy": "balanced",
"batchingPreference": "largestPopulation"
},
"teams": [{
"name": "players",
"maxPlayers": 200,
"minPlayers": 30
}],
"rules": [{
"name": "low-latency",
"description": "Sets maximum acceptable latency",
"type": "latency",
"maxLatency": 150
}],
"expansions": [{
"target": "rules[low-latency].maxLatency",
"steps": [{
"waitTimeSeconds": 12,
"value": 200
}],
"target": "teams[players].minPlayers",
"steps": [{
"waitTimeSeconds": 10,
"value": 20
}, {
"waitTimeSeconds": 15,
"value": 10
}, {
"waitTimeSeconds": 20,
"value": 5
}]
}]
}
When I attempt to start matchmaking, I get a 400 error. My code is as follows:
public void startMatchMaking()
{
ticketId = Guid.NewGuid().ToString();
inMatchMaking = false;
AttributeValue skill = new AttributeValue
{
N = 1.0
};
Player player = new Player
{
PlayerId = playerId, //already defined, guid
LatencyInMs = new Dictionary<string, int>{
{ "us-west-2" , 1 }
},
PlayerAttributes = new Dictionary<string, AttributeValue>
{
{ "skill", skill }
}
};
Debug.Log("Player prepared");
try
{
var mmRequest = new StartMatchmakingRequest();
mmRequest.Players = new List<Player> { player };
mmRequest.TicketId = ticketId;
mmRequest.ConfigurationName = "defaultRuleSet";
//algc defined earlier as aglc = new AmazonGameLiftClient(credentials, config);
StartMatchmakingResponse mmResponse = aglc.StartMatchmaking(mmRequest);
inMatchMaking = true;
}
catch (InvalidRequestException e)
{
Debug.Log(e.StatusCode.ToString() + " :( startMatchMaking FAILED. InvalidRequestException " + e.Message);
}
}
Am I missing something obvious? What about this request is wrong? Would appreciate help figuring this out. I thought maybe I had to use the internal name (free-for-all), but ding that does not prevent the error.
Thanks!