GodotSteam / MultiplayerPeer

An ecosystem of tools for Godot Engine and Valve's Steam. For the Windows, Linux, and Mac platforms.
https://godotsteam.com
MIT License
3 stars 2 forks source link

SteamMultiplayerPeer: lobby_created signal isn't firinig #1

Open Fifut opened 2 months ago

Fifut commented 2 months ago

Describe the bug lobby_created signal isn't firing after calling (SteamMultiplayerPeer) create_lobby(SteamMultiplayerPeer.LOBBY_TYPE_PUBLIC) Only lobby_joined signal is firing But work with Steam.createLobby(Steam.LOBBY_TYPE_PUBLIC, 8)

To Reproduce Init steam Connect lobby_created signal Create a new SteamMultiplayerPeer call create_lobby(SteamMultiplayerPeer.LOBBY_TYPE_PUBLIC) on this peer

Desktop (please complete the following information):

Version of GodotSteam: Godot 4.3 - Steamworks 1.60 - GodotSteam MultiplayerPeer 4.10

Additional context I didn't forget Steam.run_callbacks() in _process()

Gramps commented 2 months ago

Sorry for the late reply, I don't typically handle the MultiplayerPeer stuff. I would have to test this to see what is happening so I will have to get back to you in a bit.

Fifut commented 2 months ago

Here the minimal code to reproduce the bug:

extends Node

var _peer: SteamMultiplayerPeer = SteamMultiplayerPeer.new()

func _ready():

    # This signal will be triggered
    Steam.lobby_joined.connect(
    func(lobby_id, permissions, locked, response):
        print("Steam lobby joined")
    )

    # This signal won't be triggered
    Steam.lobby_created.connect(
        func(connect, lobby_id):
            print("Steam lobby created")
    )

    _init_steam()
    _create_lobby()

func _process(delta):
    Steam.run_callbacks()

func _init_steam():
    var init = Steam.steamInit(true, 480, false)
    if init.status != 1:
        print("Steam initialization failed " + str(init.verbal) )
    else:
        print("Steam initialization ok")

func _create_lobby():
    var err = _peer.create_lobby(SteamMultiplayerPeer.LOBBY_TYPE_PUBLIC)
    if err != OK:
        print("Failed to start steam server")
Gramps commented 2 months ago

I am actually reviewing a patch for all this code so this is perfect timing! Thank you.

swAAn01 commented 2 months ago

@Fifut is this in an autoload script? Have you tried making _peer an onready var ?

Fifut commented 2 months ago

@swAAn01 It's not an autoload and I get the same result with an onready.

It's just this signal that doesn't work, the others work perfectly. If something goes wrong with peer, Steam.run_callbacks() or onready var, the other signals won't work either I think.

NiclasEriksen commented 1 month ago

I'm having the same issue, lobby_match_list isn't being fired either so I don't know a way of seeing if the lobby was created in the first place.

steamInit() returns { "status": 1, "verbal": "Steamworks active." }, getSteamId and getPersonaName both return expected values.

This is with the AssetLib version 4.11 on Godot 4.3.stable, running on Linux. Tried connecting signals and setting up Steam in both an autoload script and as an instanced node in a scene, same result.

var lobby_id: int = 0

func _ready() -> void:
    Steam.lobby_created.connect(_on_lobby_created)
    Steam.lobby_joined.connect(_on_lobby_joined)
    Steam.p2p_session_request.connect(_on_p2p_session_request)

func create_lobby():
    if lobby_id == 0:
        print("Create lobby")
        Steam.createLobby(Steam.LOBBY_TYPE_PUBLIC, lobby_members_max)

func _on_lobby_created(connect: int, this_lobby_id: int) -> void:
    print("_ON_LOBBY_CREATED")
# etc etc