Hello!
I have a question that I am not quite clear on with the documentation:
The documentation defines party and session lobbies. Say that I am playing with with a friend, and I invite him to a party lobby, but the game is 4 player. Would I then potentially put in a button that sends them to a session lobby and then use the party wise feature to bring them to this new lobby, or is it more of an either/or situation, where I can either do party or I do session lobbies, but not both?
#Party vs session lobbies
1 messages · Page 1 of 1 (latest)
A player can be a member of many lobbies
We let you give our tool a "hint" as to what your using a given lobby for so we can help with some basic bits.
So when you flag a lobby as a "party" lobby your telling us that this is a group of friends think "Fire Team" in Halo ... its not the game session group
its for example you and me ... say we want to pay together in a 4v4 match ...
Party lobby would just be you and me, then whcih ever of us is the "leader" will search for that 4v4 session when searching "party wise" it will search for a 4v4 match that has 2 open slots so both members of the party can join
as I recall we also send a signal when joining or creating a "session" lobby to the "party" lobby to let the members know to join that session lobby
so in our 4v4 hypothetical ... say you and me are in a party together, you are the leader, you search for a 4v4 session lobby to join and dont find one with 2 open slots so you create one, that will raise a signal to tell me to join that newly created session lobby
now we are both in a Party lobby and a Session lobby ... the session lobby is public other random players will join it and when full we can play that 4v4 session ... the party lobby is "invisible" it doesn't show in searches
note a "Lobby" is just a collection of Steam users ... it is not in any way part of the network
understanding that can help with the concept
Party is the group of players that want to play together e.g. a couple buddies that want to game together
Session is the group of players matched togetehr for a game session
Do I need two lobby components for that then, or is the one enough and then use some sort of invokations on the play button?
Its 2 separate lobbies
if your using the code free tools that means 2 seperate Lobby components
1 representing your "Party" loby and 1 for your "Session"
the Party lobby would be a invisible type, invite only situation
the "Session" would be quick match sort of thing
Those screen shots show you a real world use case of 2 Steam Lobbies in 1 game on 1 UI
Using DOTA 2 as an example
So am I right in assuming then that if I were to do it programmatically instead, it would go something like Press button -> create party lobby method -> whatever ready check I have -> "host" presses play, -> I call the search method, and if that returns nothing that fits, I call create lobby again but under a session type of configuration?
We make it easier than that for you
Psedo code follows
void OnPlayButtonPressed()
{
int slotsNeeded = -1;
if(LobbyData.PartyLobby(out var partyLobby))
{
// If we come in here then we have a party, so record the count
slotsNeeded = partyLobby.MemberCount;
}
// else -1 means any slot count will do we are solo
var findArgs = new SearchArguments
{
slots = slotsNeeded
}
//If no lobby found make a lobby with these settings
var makeArgs = new CreateArguments
{
slots = 8,
usageHint = SteamLobbyModeType.Session,
//etc
}
LobbyData.QuickMatch(findArgs, makeArgs, HandleCompletion);
}
void HandleCompletion(EResult result, LobbyData lobby, bool ioError)
{
// lobby is the found or created lobby
}
holy crap that IS easy
psedo code but you get the idea
the static funcitons
LobbyData.PartyLobby
and
LobbyDataSessionLobby
simply return true if they found the local player to be in said lobby type and they output the found lobby
and then the LobbyData.QuickMatch function lets you pre-configure search and create args
it will first search and if a matching lobby was found it will join it ... if not it will create
... o and then you would want to let the party members know of the new lobby ... so in your HandleComplete do that
as far as how "we" notify of session lobby on the part
partyLobby[LobbyData.DataSessionLobby] = createdLobby.ToString();
So get your session lobby and then set metadata on it ... we use a standard metadat field "DataSessionLobby" its just the ID of the session lobby the leader chose
Ooooh that makes sense, thank you for all the help!
You can always look at our components code
so if you for example want to see how we detect when DataSessionLobby gets set and what we do when it is
private void HandleDataUpdate(LobbyData lobby, LobbyMemberData? member)
{
// If we are tracking a part, this update is for this party, and the update is a lobby update, not a member update
if (partyLobbyData != null && partyLobbyData.Data == lobby && !member.HasValue)
{
// Get the session ID if any is declared
var sessionId = partyLobbyData.Data[LobbyData.DataSessionLobby];
// If this is not null, then we have a declared session lobby ID
if (!string.IsNullOrEmpty(sessionId))
{
var sessionLobby = LobbyData.Get(sessionId);
JoinSessionLobby(sessionLobby);
}
else if (leaveOnSessionClear && _mInspector.Data.IsValid)
{
// empty session lobby so we should leave if we are in a session lobby
_mInspector.Data.Leave();
_mInspector.Data = CSteamID.Nil;
}
}
}
that is the code in SteamLobybJoinSessionLobby.cs
which is our tools code that does that
bascialyl we are just listening for any change to lobby data
if we find a change we check to see if that change is a change to lobby metadata or a members metadata ... if its lobby metdata we check to see if the sessionId was set, if it was we get the lobby and try to join it
the "JoinSessionLobby" funciton just checks some sanity stuff
- is this a valid lobby
- are we already a member of this lobby
- etc
again you can see all our code its fully provided so you can either use our components or you can base your custom code on ours
excellent, thank you again!