I'm trying to create a challenge with this requirements:
- many players are challenged
- one and only one player can join
- as soon as the first player join, challenge starts
So, I created a challenge with:
- no start time
- no min players
- 2 max players
- autoStartJoinedChallengeOnMaxPlayers set to TRUE
- a list of players challenged (3)
After that, I tried to join with the first player. The player was correctly been joined, but the first issue I encountered was that the state of the challenge remains "ISSUED" instead of becoming "STARTED".
"Not declaring a start time means the Challenge will start if the minimum number of players are met. If minimum players is not declared, the Challenge will start when at least one player joins the Challenge."
It also says (which I find a little confusing):
"If autoStartJoinedChallengeOnMaxPlayers = true, then the Challenge will start when maxPlayers value is met (If start time is declared. If start time is not met, then the game will start when minimum players is met)."
So I tried to recreate the challenge with autoStartJoinedChallengeOnMaxPlayers set to FALSE, but the result was the same.
But the real issue is the second one. I tried to join with another player (the 3rd) and it let me do so! I therefore completely misunderstood the meaning of the parameter "max players": I have set it to 2, but the challenge didn't start when 2 players joined and a third player could join after all.
Can someone clarify this to me?
For whom is interested, I solved by making the challenge PUBLIC and doing a WithdrawChallengeRequest in the ChallengeJoinedMessage, so as soon as the first player join the challenge it becomes "closed".
Clearly min players and max players parameters are used only for the autostart, and the list of challenged users is actually used to start it.
So, I was also forced to modify the list of challengers: I created the challenge with no challenged users and I sent the invitation to them with a custom Message. I stored in any case the challenged array in the ScriptData of the challenge, so to be able to send another Message to players when the first player joined the challenge.