Page cover image

Party Lobby Control

Code free drag and drop party lobby tool

Like what you are seeing?

Introduction

Create a party lobby and its UI fully featured including in-game friend invite, chat, and more with ZERO code required.

The Party Lobby Control is a UI behaviour component that manages a lobby representing a player party and the UI elements associated with that. This sort of "Party UI" is common in most team and coop games such as MOBAs, Team Shooters, party games and more. One of the most typical examples of a party lobby can seen in DOTA2.

DOTA 2 home screen captured 2022-10-30 by Loden Darkstar
Halo Infinite multiplayer mode scree captured 2022-10-30 by Loden Darkstar

The purpose of a "party lobby" also known as a "group lobby" is to gather Friends that wish to play together, most typically in a coop game though you do see Group/Party systems in competitive games as well particularly party games.

Party or Group type lobbies differ from Session type lobbies in that they only group a set of friends together. They do not attempt to matchmake or define the state of a "session".

In this case let "session" refer to a session of gameplay e.g. a match, mission, race, level, etc.

Session lobbies in contrast are not typically concerned with friends so much as they are with meaningful matchmaking e.g. placing players of similar skill, nearby regions and similar game session preferences together in order to facilitate a timely and entertaining "session". The members in a "Party" would typically join the same "Session" lobby when looking to play a game.

For example in DOTA 2 up to 5 players can form a group/party, this is a full "team" in DOTA. When the party leader presses the "Play DOTA" button the game performs a quick match looking for a "Session" that can accommodate the party of players. When the session starts the party of players will be placed on the same team.

Features

Create

Automatically handles the creation and exit of a group lobby. You can always fetch the current group lobby from the Lobby structure.

if(Lobby.GroupLobby(out Lobby groupLobby)
{
    //We are in a group lobby
    if(groupLobby.MemberCount > 1)
    {
        //We are not alone in the party
    }
}

Display

Display the user's avatar and the number of slots available to the party/group. When a slot is "filled" that user's avatar will be displayed.

Friend Invite

The provided prefab implements the Friend Invite Drop Down letting the user invite online friends with the click of a button or to type in a friend's "code" to initiate an invite.

Chat

When a user is in a party with other player's a simple text based chat interface is displayed. The chat system is used by other tools to notify party members when they should join a specific session lobby. Heathen's session lobby controls will handle this automatically or you can do this yourself by prefixing the chat message with `[SessionId]` followed by the ulong id of the session lobby to join

Rich Presence

Optionally sets the `steam_player_group` and `steam_player_group_size` fields in Steam's rich presence updating the Friend List group display.

Prefab

A production-ready prefab is available and configured with the features displayed above.

Events

Session Lobby Invite

public LobbyDataEvent evtSessionLobbyInvite;

This event is invoked when the user is invited to join a session lobby by the owner of the group lobby. For example, if you are in a party with user A and user A uses Heathen's Quick Match to create or join a session you will be invited to join that session and this event will be raised.

Group Lobby Invite

public GameLobbyJoinRequestedEvent evtGroupLobbyInvite;

This event is invoked when the user is invited and accepts a lobby invite to a group lobby.

Fields and Attributes

User Owner Pip

public GameObject userOwnerPip;

A reference to the GameObject that should be toggled on or off to indicate the local user is the owner of the party/group lobby or not.

Ready Button

public Button readyButton;

Optional, if null this feature will be ignored

A reference to the button the user will click to indicate they are ready to play. This is used to update metadata on the lobby and display a "ready" flag on the UI.

Not Ready Button

public Button notReadyButton;

Optional, if null this feature will be ignored

A reference to the button the user will click to indicate they are not ready to play. This is used to update metadata on the lobby and clear the display of the "ready" flag on the UI.

Leave Button

public Button leaveButton;

A reference to the button the user will click when they want to leave the group/party.

Auto Join On Invite

public bool autoJoinOnInvite;

If toggled to true then when a GameLobbyJoinRequest event is detected if the target lobby is of type group the tool will leave any existing group lobby and join this new lobby.

This is not generally recomended as you should be validating the game state and lobby state before blindly joining but can be useful for quick testing.

Invite Panel

public RectTransfrom invitePanel;

A reference to the root GameObject representing the "invite panel". This will be toggled on if an empty slot is clicked and toggled off if the control is "clicked off of"

Invite Dropdown

public FriendInviteDropDown inviteDropdown;

A reference to the invite dropdown to be used by the control.

Slots

public LobbyMemberSlot[] slots;

An array indicating the number of slots this party will support and the configuration of those slots. See the Lobby Member Slot article for more information.

Update Rich Presence Group Data

public bool updateRichPResenceGroupData;

If true then the `steam_player_group` and `steam_player_group_size` rich presence fields will be set based on the current state of this lobby. This is used to group friends in the friends list in the Steam client.

Max Messages

public int maxMessages;

The number of message entries to keep in the chat history. The system will delete the oldest chat message from the chat log when this number is exceeded.

Chat Panel

public GameObject chatPanel;

The root of the chat UI will be enabled when the lobby has 2 or more members including the local user.

Input Field

public TMP_InputField inputField;

A reference to the TextMesh Pro input field to be used as the chat's input field.

Scroll View

public ScrollRect scrollView;

A reference to the scroll rect wrapping the chat message root. This is used to force the scroll to the bottom so the newest message received is always visible.

Message Root

public Transform messageRoot;

A reference to the transform which will be made the parent of each incoming chat message.

My Chat Template

public GameObject myChatTemplate;

A reference to the GameObject or Prefab that should be instantiated for each message received from the local user.

Their Chat Template

public GameObject theirChatTemplate;

A reference to the GameObject or Prefab that should be instantiated for each message received from users other than the local user.

Lobby

public Lobby Lobby { get; set; }

The lobby (if any) that is being managed by this control

Has Lobby

public bool HasLobby => get;

True if this control is currently managing a lobby

Is Player Owner

public bool IsPlayerOwner => get;

True if the local player is the owner of this lobby

All Players Ready

public bool AllPlayersReady => get;

True if all players in this lobby have indicated they are ready to play

Is Player Ready

public bool IsPlayerReady { get; set; }

Indicates rather or not the local player has been set as ready. This can be read or written to, writing to this field will update the LobbyMetadata of the local user for this lobby.

Last updated