How to prevent starting an empty game

As the host you can click start before anybody has connected, which then calls rpc hide menu. so if somebody joins the game after you’ve started their menu will remain open.

So when the start button is pressed I’ve added a check to see if the size of the “players” dictionary is greater than 1. If its 1 it displays a message saying waiting for more players, if greater than 1 then the game starts.

But is there an easier way to do this? Is there a way to check how many peers are currently connected?

you can do multiplayer.get_peers() which will give you the ids of all peers.
but since we are already tracking the connected players with the players dictionary I think your approach is totally valid.

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms