Manage lobbies for Android game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Technipion

I want to write an Android game where up to 6 players can play together in real-time. But that means someone has to create a lobby and then up to 5 more players have to join it.
How would you organize that? If I am sitting like in a train and want to play a match with my friends nearby, how can they join my lobby? I have seen people using QR codes for this, but is there some feature of the Godot engine for that? Or would you like generate a code the others have to type in?

Really excited about your opinions about this :wink:

Best regards,
Technipion

:bust_in_silhouette: Reply From: Oen44

#TLDR;
Just follow High level multiplayer and you will achieve what you want. Good luck, you will have a lot to work on and it’s not going to be worth it after all.

#More details

You can create LAN server that will be hosted by one player. So just follow this tutorial about High level multiplayer and you should be fine.
But that means you and your friends have to be connected to the same network otherwise you won’t be able to connect to host.

There is another option that requires Master Server where you will be connecting to and where netcode will be managed. That will require separated machine (dedicated server or VPS) where you can run your server. Even if that’s the best option of all, it’s not recommended because you will have to rewrite networking code of GoDot engine and write separated software that will be headless. Headless GoDot export is added as a new feature in 3.2 (issue) but that will take a year or more before coming out.

Thx for your answer. But I actually have a dedicated server where players connect to. (and some setup with Docker and other stuff)

My actual question was: How would you exchange the lobby id (or something similar) between two player’s smartphones. And do it as easy and simple as possible…

Technipion | 2018-11-19 17:31

If you want to make sure that both players are in the same lobby, then let them choose where they want to join.
Example:
5 players (friends) want to play together. One of them creates lobby (send CreateLobby packet to server, create room there etc.), after successful creation, show lobby Identification Name (like number) on player screen (in lobby). Now, that player shares lobby name with others and they can go to Find Lobby screen and select from lobby list or manually tap in lobby name, and based on that, send SearchLobby packet to server, then send response to client if lobby found, if so, join and then wait for others to join in same way. Now, when every player sends ReadyState packet to server, lobby starts and every player is in the game. Now you are just updating game state based on Lobby Name/Index or whatever you used there. One player does something - send packet to server that will contain lobby id, do stuff on server-side and send response to every player that is in the same lobby (checking by lobby id).

Oen44 | 2018-11-19 17:47