Jump to content

Recommended Posts

Posted

I've gotten reports that people have trouble with joining friends-only lobbies i.e. they simply do not appear in the list.

I've spend the past 2 hours experimenting and I noticed that the Lobby::Public setting works fine, but lobbies set to Lobby::FriendsOnly simply aren't detected by Lobby::Count().
Here's the lobby creation code:

std::string lobbytype = "private";
if (permissions == 0)
{
	lobbytype = "public";
	currentlobby = Lobby::Create(4, Lobby::Public);
}
else if (permissions == 1)
{
	lobbytype = "friends";
	currentlobby = Lobby::Create(4, Lobby::FriendsOnly);
}
else
	currentlobby = Lobby::Create(4, Lobby::Private);

if (currentlobby != nullptr)
{				
  world->Clear(true);
  currentlobby->SetString("game", title);
  currentlobby->SetString("type", lobbytype);
  currentlobby->SetString("mission", "0");
  currentlobby->SetString("description", serverdescription->GetText());

etc...


And here I fetch the lobbies when someone goes into the join menu:

int count = Lobby::Count();
System::Print("Lobbies available: " + std::to_string(count));
for (int n = 0; n < count; n++)
{
  Lobby* lobby = Lobby::Get(n);
  if (lobby->GetString("game") == title && lobby->GetString("type") == jointype)
  {
    std::string desc = lobby->GetString("description");
    if (desc == "") desc = "(No name)";
    desc += "  |  " + std::to_string(lobby->CountMembers()) + "/4";

    if (lobbylist->CountItems() == 0)
    {
      lobbylist->AddItem(desc, true);
      selectedlobby = lobby;
    }
    else
    {
      lobbylist->AddItem(desc);
    }
  }
}



I've solved it now by setting friends-only lobbies to Public and setting lobby owner's SteamID in the lobby strings (SetString()). When I fetch the lobbies in the join menu I simply check if the steamID is this user's friend by using the GetFriendRelationship() API call.

This seems to work fine for now, but I'm wondering if I'm missing something dumb with the FriendsOnly thing :P

Posted

That might not be a good idea. I know the API is supposed to stay the same, but it's a bad idea to mismatch headers and libraries.

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

I replaced both headers and libraries and I ran into zero issues. Granted, I am not using the the built in Steamworks singleton class nor any networking features, but things like Steam Input (Which isn't in the library packaged) and app verification works.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Posted

Ok I'll dive into that source code. Not sure if I can still get to doing that today, busy busy haha

Oh, something else that came to mind: Lobby::GetOwner() only returns a valid ID if you actually joined that lobby already. This isn't mentioned in the docs anywhere and might give some confusion for people :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...