How to Wait Until All Players Are Ready

In a gather-together-and-play type of matchmaking, the room owner is often responsible to decide when to begin the in-game. To do so, it is necessary for the room owner to wait for all members including the owner themselves to be ready.

A room member’s state (whether ready or not yet) can be stored in the room member object on the server as a custom room member property (see How to Implement Lobbies for more information).

To check the states of all members, the following Blueprint function can be used.

../../_images/waitonreadycheckready.png

This function checks if each member’s state value is equal to the Desired State argument. The Check All Room Members State function can be called in a loop. The following Blueprint shows this approach:

../../_images/waitonreadywaitstart.png

Here we call the Check All Room Members State function in the infinite loop, and it completes once all room members are ready.

Note

In the actual game, it may be better to provide players some way to cancel the loop.