Unity-Technologies / multiplayer-community-contributions

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

Steam Transport: "Join Code Not Found" #187

Open daniellochner opened 1 year ago

daniellochner commented 1 year ago

Hi there,

I'm trying to use the Steam Networking Transport, however, I seem to be getting a “Join Code Not Found” error? The join code is definitely correct, and it works perfectly fine using the Unity relay.

Occasionally it does work though (i.e., I can join a connect to other players over the Steam relay), which is incredibly confusing? It seems to be random? Could it be timing out somehow?

Thanks!

JamesMcGhee commented 1 year ago

SteamNetworking transport is the legacy SteamNetworking interface

I recommend you use SteamNetworkingSockets transport. We use it in our own project and have no issues with it.

daniellochner commented 1 year ago

SteamNetworking transport is the legacy SteamNetworking interface

I recommend you use SteamNetworkingSockets transport. We use it in our own project and have no issues with it.

Great, thank you! How are you handling lobby-relay integrations? For the Unity transport, the following works: https://docs.unity.com/lobby/relay-integration.html

daniellochner commented 1 year ago

Hi @JamesMcGhee, I still seem to be getting this issue? Could you possibly share a small snippet of your join and create methods?

daniellochner commented 1 year ago

Hi again, I've just release the source code of my game (https://github.com/daniellochner/creature-creator-game) so that may help with diagnosing! Could you possibly have a quick look at the MultiplayerUI.cs script to see if I'm doing something wrong? I would really appreciate it! 😊

JamesMcGhee commented 1 year ago

Sorry GitHub notifications are hard to see :) We have a discord your welcome to join its all about supporting indie game devs ... as well as our assets but we do just cover general game dev stuff as well. https://discord.gg/6X3xrRc

I see some relay stuff in there not sure why you have that but just glancing through

Also not sure why your managing your connection info that way ... Steam lobby has a concept of "Set Game Server" where you can set the Steam ID, IP and or Port that players should connect to ... this will trigger a callback that all members of the lobby will get that tells them its time to connect and how to connect. We have more info on that in our Knowledge Base for Steamworks it is written with our Steamworks integration in mind but is applicable rather or not you use it or raw Steam API.

Given the way your getting at it I am not sure if your "host id" is correct, it should be the CSteamID of the user that stated the server but the typical way of getting that is from the lobby's server info or some people will simply assume that the lobby owner is the host and will just use the owner's ID.

It looks to me like your doing A LOT of work but dont need to ... here is our logic working in our game and generally how we see most of our community do it.

internal static void StartNetwork(LobbyGameServer server)
{
       networkTransport.ConnectToSteamID = server.id.m_SteamID;
       networkManager.StartClient();
}

If your wondering what calls that, its our "session manager" which is a script that runs on start up of our gameplay scene ... we do not allow network managers to control our scenes :) so we do that manually

anyway all its doing is calling that method passing in the LobbyGameServer object from our LobbyData ... that is part of Heathen's Steamworks Complete and asset we created that makes working with Steam a TON easier but you can do it raw as well of course. ... here is the raw Steam API code ot fetch the server info off a lobby Steamworks.SteamMatchmaking.GetLobbyGameServer(lobby, out uint punGameServerIP, out ushort punGameServerPort, out CSteamID psteamIDGameServer);

If your wondering how that info gets set, its done by the lobby owner who should call SetGameSerer when they are ready for other player's to join. so Steamworks.SteamMatchmaking.SetLobbyGameServer(lobby, ip, port, gameServerId); and in that case the gamesServerId that would be your hosts CSteamID of course ... assuming your doing P2P .. if your doing Client/Server then you should use the Steam Game Server Id.