Dynamically Assemble and Match Players
Dynamically Assemble and Match Players
Connect Cross-Platform Accounts and Identity Management
Grow and Commercialize Your Game
Build a Vibrant Community
Track Player Progression and Game State Across Platforms
Track, Engage, and Retain Players
Player Portal, Launcher, and Patcher
Make Informed Decisions with Player and Game Telemetry
Get a 360 view on game health by combining crash reporting, performance analytics, build quality and binary distribution into one toolbox
Want to Kickstart Your Early Game?
Foundations is our free offering for indie studios with big ambitions
In this guide, we will do a quick rundown of how to create a lobby party with AccelByte. This guide is Unity specific but the flow is identical in any other SDK.
You can grab our SDK from our public GitHub: https://github.com/AccelByte/accelbyte-unity-sdk.
This guide will focus on implementing Party Lobby using AccelByte SDK for Unity.
Here is the list that is needed for the implementation and later on will be expanded based on each role.
Party actions :
Before progressing into this guide, you will need to complete the guides below :
Whoever creates a party will become the party leader, only the party leader can invite other players to the party.
First things first, we need to make sure that the player is already logged-in and in the lobby.
Then create party lobby function along with the callback that contains PartyInfo as it’s parameter. Inside PartyInfo there are PartyID, leaderID, members, invitees and invitationToken.
The CreateParty function can also be implemented right after the player presses the “InviteToParty” button in friend list and before calling “InviteToParty” function. It will check if the host/inviter already has a party, if not then create a party.
The party leader is the only one that can invite other players to the party via their friend list. The party leader can only invite friends who are online.
The first step begins with the party leader inviting a player, then the invited player will get the invitation. In this demo game, when the invited user gets the invitation, the game will show a popup invitation.
The callback, OnInviteParty() located in FriendPrefab (created in Friends System) that is assigned for each friend in friend list. On the invited player, there is an event callback that needs to be setup.
Right after the party leader invite, the invitation should arrive through the invitedToParty event. The PartyInvitation should be cached to a variable so it can be used with the JoinParty function in the next step. The abPartyInfo variable will be used to store information about the party that will be useful to update our UI later on.
The “From” value in PartyInvitation data is a userID, so we need to call GetUserData in order to get the displayname to show to the invited player, then set the popup text and show it on the screen. After the popup is shown to the screen player will be greeted with 2 options, “accept the invitation” or “decline the invitation”.
Decline invitation just closes the popup invitation by calling SetActive to “false” on the popup’s gameobject, however, accepting the invitation will call the JoinParty function and the callback will update the current party with the latest info and also update to UI party slot once the partyInfo is retrieved successfully.
The party slot will show us all the party members from abPartyInfo.members visually. It will record the userId, display name, and email.
The steps are :
Those four slots are divided into 2 sections, one PlayerButton (local), and 3 AddFriendButton. The one that we need to be managed is the 3 AddFriendButtons. Reference those 3 buttons with a Transform array to make use of it later.
After the party slot data is cleaned up, we then call GetPartyMemberInfo to get the info that we need to fill in partyMemberList.
Then after all the member’s info collected, the coroutine will start to run RefreshPartySlots() to execute updates on the UI.
This way UI info about the party member will be updated. Right after this, all the party members will receive the JoinedParty event. Just like InvitedToParty, for this event, we need to set up the listener.
The OnMemberJoinedParty function does some update to the party info variable in the AccelbyteLobbyLogic and updates to UI party slot once the partyInfo is retrieved successfully.
The ability to kick from party is also one of Party Leader’s available actions. The party leader can kick one of the party members and then kicked player will leave the party after receiving the kick notification.
By hovering over the party slot button, the player profile popup will appear, the kick from party button is available here. This is part of PopupPartyControl as the party leader you can kick a party member and leave the party, as a member you can only leave the party. Figure 10b is showing the scene of the popup.
There are a few grouped game objects such as :
On the memberCommand gameObject, add a listener for the kickFromParty button to kick each userId registered to each PartyPrefab.
The kicked player will receive KickedFromParty Notification right after being kicked by the party leader. The callback of this event will be used for updating/clearing the party slot.
All the other members will be getting LeaveFromParty event as the result of this action to update the PartyInfo and the UI party slot to the newest info where the kicked player is already gone.
This action can be used by every member including the party leader. A member will be calling LeaveParty function and the other members will be getting the LeaveFromParty event just like kick from party section.
Here is the leave party function that is available on a party slot profile popup, which will call the AccelByte LeaveParty function. Right after that, the callback function clears the party slots, marking that they left the party.
Right after getting the event, all the remaining members will have to update their PartyInfo and their UI party slot as can be seen in Figures 13a, 13b and 13c on Kick From Party Section. If the one that leaves the party is party leader, the leader title will be transferred to the second player on the PartyInfo.members list.
That just about covers it for the Lobby feature. While this guide highlights what is available in our out of the box feature set, it is important to note that we can customize the platform to match your exact needs, from small changes to complete, bespoke features.
No two games are the same and we believe it is important to tailor our services to match each individual customer’s needs.
Please reach out to us at firstname.lastname@example.org if you have any questions.
Reach out to the AccelByte team to learn more.