Sign In Register

How can we help you today?

Start a new topic
Answered

Challenger is the same no matter who create game

Hello,I've followed the HeartStone Tutorial and i made a game that need 4 people to start, the problem is that no matter the order that they send the MatchmakingRequest, the challenger and challenged order is the same.

I want the first one that send the MatchmakingRequest to be the challenger and then the challenged order to be the same as the order they join ! Thanks

image

image

image



Best Answer

Hi,


It's because of the IF function at the top that checks for participant[0] and makes them create a Challenge (Hence why they're the challenger). If you want that to change you'll need to find a creative way to determine who called the matchmaking request first. 


You could save your players timestamp from the moment they started searching into the pending match data or participant data and then do a comparison once a match has been found.


Give that a go. 


Cheers,

Omar


Answer

Hi,


It's because of the IF function at the top that checks for participant[0] and makes them create a Challenge (Hence why they're the challenger). If you want that to change you'll need to find a creative way to determine who called the matchmaking request first. 


You could save your players timestamp from the moment they started searching into the pending match data or participant data and then do a comparison once a match has been found.


Give that a go. 


Cheers,

Omar

thanks for your answer, the think that i don't understand is why Spark.getData().participants[0].id is always the same (xxx026 in my case) what determinate  the order in participants who will be 0/1/2 .. 

I think its sorted based on string value. Which results in the list always being the same.


Cheers,

Omar

Login to post a comment