Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game closes on peer.create_host() and no errors are shown in logs #19

Open
Myle21 opened this issue Jun 29, 2024 · 2 comments
Open

Game closes on peer.create_host() and no errors are shown in logs #19

Myle21 opened this issue Jun 29, 2024 · 2 comments

Comments

@Myle21
Copy link

Myle21 commented Jun 29, 2024

the os is windows 10 x64, godot version is 4.2.2 and the steam is in fact intializing correctly and is doing so before the multiplayer peer.
here's the only place in code that uses SteamMultiplayerPeer:

func create_lobby(lobby_type = Steam.LOBBY_TYPE_PUBLIC, lobby_max_members = 16) -> void:
	if lobby_id == 0:
		Steam.createLobby(lobby_type, lobby_max_members)

func _on_lobby_created(connect: int, this_lobby_id: int) -> void:
	if connect == 1:
		lobby_id = this_lobby_id
		print("Created a lobby: %s" % lobby_id)

		Steam.setLobbyJoinable(lobby_id, true)
		
		var set_relay: bool = Steam.allowP2PPacketRelay(true)

		print("Allowing Steam to be relay backup: %s" % set_relay)
		
		create_lobby()
		peer = SteamMultiplayerPeer.new()
		var err = peer.create_host(0,[])
		multiplayer.multiplayer_peer = peer
@KiroTheBlueFox
Copy link

Got the same issue with Godot 4.3 Beta 3

@arnaudvergnet
Copy link

Hey, I had the same issue while using GodotSteam and this addon but it was because I was creating both the host and the client at the same time.

When you create a lobby, both lobby_created and lobby_joined signals are fired. So if you create the client in the callback to lobby_joined, make sure to check if you are not the host by using Steam.getLobbyOwner(lobby_id)

Check out this example, it helped a lot https://github.com/MichaelMacha/SteamMultiplayerPeerExample/blob/demo/gamestate.gd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants