Will match.presences always be in the same order across devices?

Will match.presences be in the same order across all devices? In other words, can I guarantee that if two devices are in the same match match.presences will give them the same list in the same order?


@GTG101 Yes you can assume that the JSON response is ordered but depending on the structures that the response is decoded into in the language of each of the SDKs it may or may not retain the order. Why do you need to guarantee the order?

Would it be best to just use an alphanumeric sort over the presences received to ensure their order is consistent across devices when needed?

1 Like

I need to guarantee the order because I am using it to select spawn points for each character at the start of the game and each spawn point needs to be the same for each character across all devices. I am also using relayed multiplayer.

In that case you should definitely sort the list of presences in a consistent way. I recommend sorting by session ID since that changes on each connection, so you won’t have some players tending to spawn in the same place each time.


@GTG101 I agree with @zyro. If you get all game clients to do an alphanumeric sort on the session ID field of the presences returned when the players have all joined the match you’ll get the result you want and don’t have to do any kind of distributed coordination to determine what the spawn points of the players will be.

1 Like

Thanks for the advice, I really appreciate how responsive these forums are.

1 Like