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

Unable to join another lobby with SteamMultiplayerPeer after calling close(). #3

Open
PeanutButterRat opened this issue May 24, 2024 · 3 comments
Assignees

Comments

@PeanutButterRat
Copy link

Describe the bug
SteamMultiplayerPeer will complain that the user is still in a lobby even after calling close(). This prevents the user from joining another lobby and forces the creation of another SteamMultiplayerPeer object.

To Reproduce
Steps to reproduce the behavior:

  1. Create a script that with two buttons: the first should create a lobby through SteamMultiplayerPeer.create_lobby() and the second should close the connection with SteamMultiplayerPeer.close().
  2. Click the first button to create a lobby.
  3. Click the second button to close the peer.
  4. Click the first button again to create a different lobby. An error in the console should pop up stating that the user is already in a lobby.

Expected behavior
I expect the multiplayer peer to create a different lobby and connect the user to that one instead.

Screenshots
Initial state before joining a lobby.
image
After clicking on "Create" which calls SteamMultiplayerPeer.create_lobby() and updates the lobby ID.
image
After clicking on "Leave" which calls SteamMultiplayerPeer.close() and clears the lobby ID.
image
After clicking on "Create" again. Notice that the lobby ID is still "None".
image
The error that is displayed in the terminal.
image

Desktop (please complete the following information):

  • OS: Microsoft Windows 10 Home
  • Version: 10.0.19045 Build 19045

Version of Godot:
Godot Engine v4.3.dev.custom_build.d00734053

Version of GodotSteam:
GodotSteam Multiplayer Peer 4.8 (Module) (Latest Version)

Additional context
I think the fix is very simple, just add a line to reset the lobby_state in the close method back to disconnected.
image

@Gramps
Copy link
Member

Gramps commented May 24, 2024

Hey there! I've still not used the MultiplayerPeer stuff but yeah, it should definitely reset that, I'd think. I'll check it out!

@PeanutButterRat
Copy link
Author

After cross referencing with ENetMultiplayerPeer, it looks like some other state should probably be reset as well such as flushing any incoming packets. https://github.com/godotengine/godot/blob/b7feebefabc2d48b0d4794cd31fc141f1caecc5c/modules/enet/enet_multiplayer_peer.cpp#L294

@Gramps
Copy link
Member

Gramps commented May 25, 2024

Yeah, looks like there are a few big differences indeed. Seems like something that should be patched in.

@Gramps Gramps transferred this issue from GodotSteam/GodotSteam Oct 6, 2024
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