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.
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.
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
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)
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.
var lobby = lobbies 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)