Documentation

Home
• Networked multiplayer• Lobbies• Fetch lobbies• API reference

Lobbies

The GDScript plugin gives you a complete solution for managing player-hosted lobbies. It lets your players host and join multiplayer sessions within your game without the need of an invitation link. Try it out!

Host a lobby in one screen and refresh the list in the other screen. Click "Join" on the listed lobby to join it.

The above game example uses the GDScript plugin and NetworkedMultiplayerENet to connect players in a shared drawing session. See the source code for more details.

Get started

Install the plugin from the AssetLib in the Godot Editor and follow its installation instructions. The example project already comes with the plugin installed.

You do not need to run your game on Gotm to test the plugin on your local network. To test it across networks, use the web player.

1. Host lobby

Call Gotm.host_lobby to host a lobby.

### Suppress invitation popup with 'false'.
Gotm.host_lobby(false)

You can now change its name and other properties by accessing it at Gotm.lobby.

Gotm.lobby.name = "My Lobby!"

Lobbies are hidden from fetch results by default. Make your lobby visible by setting its hidden property to false.

Gotm.lobby.hidden = false

If your game uses networked multiplayer, you are now ready to run your game's server startup code. Here is an example using NetworkedMultiplayerENet.

var peer = NetworkedMultiplayerENet.new()
peer.create_server(8070)
2. Fetch lobbies

Before you can join the lobby you must fetch it by calling GotmLobbyFetch.first. This call is asynchronous, which means that you must use yield to retrieve its return value.

var fetch = GotmLobbyFetch.new()
var lobbies = yield(fetch.first(), "completed")

If your lobby is not fetched, make sure you set its hidden property to false in the previous step.

3. Join lobby

Using the lobbies fetched in the previous step, you can join the lobby using GotmLobby.join. This call is asynchronous, which means that you must use yield to retrieve its return value.

var lobby = lobbies[0]
var success = yield(lobby.join(), "completed")

You have now joined the lobby and are able to communicate with other peers in it. If your game uses networked multiplayer, you are now ready to connect to the GotmUser.address of GotmLobby.host. Here is an example using NetworkedMultiplayerENet.

var peer = NetworkedMultiplayerENet.new()
peer.create_client(Gotm.lobby.host.address, 8070)