Unity-Technologies / multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
MIT License
415 stars 160 forks source link

[Steam Networking Sockets Transport] Leaving whiles joining disconnects the host #245

Closed Pixel-Gamer closed 5 months ago

Pixel-Gamer commented 6 months ago

[Steam Networking Sockets Transport] I have an issue where when a client shutdowns their Network Manager while it is trying to join a lobby, the host of that lobby then breaks. This will also occur if the client closes the game through task manager while joining or if the connection is interrupted during the joining process.

Outcome The client part of the host(server, client) will disconnect, but the host's Network Manager will still be connected to other clients and running as the host. (DontDestroyWithOwner bool set to false) The host's player Object will be deleted (DontDestroyWithOwner bool set to True) The host's player NetworkObject will lose it's observers The host's game won't receive ClientRpc's anymore The host gets the OnClientDisconnect callback of the clientId: 0

I have attached a download link for a empty scene setup to reproduce the issue https://www.dropbox.com/scl/fi/8cdkp18xb7p0fjrp4ayko/Empty-Scene-Network-Test.zip?rlkey=3gwjew11asr3cka20c625ph3u&dl=0

Instructions: build the game and add the appid 480 txt to the builds folder on two computers run one as the host by clicking the button and join the other to your game through steam friends the script will automaticly disconnect you as soon as you connect producing the error "game broke" on the hosts' game

Myxcil commented 6 months ago

I have the same issue. It also happens if you don't approve the connection in the ConnectionApproval callback. Facepunch Transport 2.0.0 Netcode for GameObjects 1.6.0

Pixel-Gamer commented 5 months ago

Is there a fix for Steam Networking Sockets Transport (The Transport used in the empty scene setup) Because this is a really bad issue for public lobbies because players can just join then leave completely destroying the host's lobbies and do this for all the public lobbies making them not viable

@Myxcil I see you added a workround/potential fix for Facepunch Transport. How hard would it be to do the same in Steam Networking Sockets Transport or how much effort would it be to convert a full project to work with Facepunch Transport.

Sorry for the very late reply

Myxcil commented 5 months ago

Sorry, I have no idea how to fix that in Steamworks as I only use the Facepunch transport package and don't have the Facepunch sources in my project. Can't even say if it's an issue in the Facepunch plugin or Steamworks itself.

Pixel-Gamer commented 5 months ago

I switched the transport for the blank project over to the Facepunch transport and it worked with the implied fix from #246. To any people who come across this post DO NOT USE "Steam Networking Sockets Transport" it has bad a bug that does not look like it will be fixed any time soon