Loteria: Creating and Joining Lobbies
Today's update is an exciting one for me, I now have communication between all three pieces of my game: Console, Mobile, and Server! What I've worked on is the ability to create lobbies and have players join lobbies from their mobile devices. I'll go more into detail in each individual section.
It all starts with a request from the console to the server. The console sends a socket message to the server saying it needs a lobby created and to send it back a message containing the secret code to connect to that lobby. When the console gets a code back, it will display it on the top of the screen as shown in the image below.
The console will then wait for players to join the lobby with the code the console is providing to them on the screen. As players join the lobby, the "Player List" is populated with their names. In the image above, you can see I connected using a mobile device and my name was displayed in the player list
On the mobile side of the game, we have a screen which allows a user to input a name and a console code. The player will need to look at the screen of the console to see what the code is and input it accordingly.
Given that the player inputs a code to an existing lobby, the player's name will show up in the console's player list. As of now, nothing else that's too exciting happens on the mobile end, but this screen would lead to the player picking which tabla they want.
While the server side will not have as impressive visuals as the mobile and console parts, it by far had the most code written on this update. Below you can see output from the server as it's listening for messages from both the mobile and console pieces.
This was a difficult update and one that will require lots of code refactoring in the future, but this also solves one of the harder problems that I was facing for the game. I look forward to working on the next piece, where I will allow the mobile player to choose from the list of available tablas on the console's screen.
Thanks for reading!
- Michael Hart