DevBytes: Play Games - Deciding Who Goes First in Multiplayer
Why Stack Overflow recommends it
Stack Overflow users link it when answering how to pick a host, leader or shared decision-maker among peers in Google Play Games real-time multiplayer rooms.
Recommended by 2 people across 2 different months, 2014 to 2017.
What it is
A short Android Developers DevBytes episode on a common multiplayer problem: getting all players to agree on who goes first or who acts as host or judge. It walks through one approach using the Google Play Games API and several approaches to avoid.
What people said
Recommends ianhanniballake · 2014-01 · Stack Overflow · on “Google play game service ,determining a host or server”
Google provided a video specifically on Google Play Games: Choosing a specific user [this video] which explains how to work around agreeing and assigning a specific user a special roll. In summary: sort the participantIds and have the first by sorted order randomly choose the host and broadcast that to the other players. This ensures that all users agree on the host and the host is randomly chosen each time.
Recommends Teyam · 2017-10 · Stack Overflow · on “How to define a host in google play games real time multiplayer?”
AFAIK, it's recommended to add a waiting room UI [LINK] which you can launch from the RoomUpdateListener.onRoomConnected . Use a participant ID as a temporary identifier for the participants and should be valid only for a particular room. Then, as participants join and get connected, you can initiate assigning a specific user and consider the logic suggested in this related SO post [LINK] . Check this video [this video] for additional insights and the sample implementation in this GitHub post [LINK] might also help.
Cites Darrell · 2015-05 · Stack Overflow · on “Shared seed for Google Play Services Realtime Multiplayer?”
I'm working on a Google Play Services Realtime Multiplayer game where I'd like all clients to have a shared seed before the game starts (for determinism when initializing "random" game state). I was planning on using Room.getCreationTimestamp [LINK] however upon testing not all players receive the same value. Likewise Room.getCreatorId [LINK] is not guaranteed to be the same value for auto-match peers. There is a video Google Play Games: Choosing a specific user [this video] that suggests the peers can choose one peer (say, first from the sorted list) to elect to make a decision. I'm concerned that can misbehave if game starts before the maximum number of players have joined and thus a new player