Added Lobby System


author: Sephen Smothers

Posted on 06/27/2024

Blog Entry Part 1: The Problem


The biggest challenge I faced this week was getting the lobby system to work. I was having issues with getting a lobby created that can communicate with Unity services and allow us to connect across devices. Before our game could only be locally tested and now it has the ability to communicate over the internet. The main issue was understanding how the initialization process works. To communicate with unity services, you have to set up async functions that will authenticate the client with Unity Relay. Unity Relay just takes the clients packets of data and sends them where they need to go which allows users to not be detected on the net. It simply adds a layer of security and also makes multiplayer possible. This was a critical feature that held up other development processes, however it now provides a seamless experience to join up with friends in a game you want to play. 

Blog Entry Part 2: Problem Solution

Represented in the photo above is one of the async calls I had to make. async allows a method to be called while unaligned with multithreaded functions going on in the background. And the await before the Create Client makes all other functions wait until the completion of that function call before all other processes can continue. This is critical for things that needs to be authenticated and verified across the internet before you continue. I then had to make sure that the client that joins a lobby is joining to the correct one through the use of a join code that gets automatically generated. And the owning client uses that to get sent to the correct server/host game. And finally, I set up the UI and did all the buttons so make a more seamless experience.  

Get Mirrors

Leave a comment

Log in with itch.io to leave a comment.