Retrieving players’ avatars
In this section, we will implement the retrieve_avatar()
method on the LobbyServer.gd
script, which will allow players to request their avatar data from the server. The avatar data is stored in the fake database. The server will respond with some RPCs to update all players with the appropriate data, displaying their avatars in the shared lobby.
With this method in place, we will complete the functionality of our Lobby project. Players will be able to authenticate themselves and display their avatars in the lobby. This will provide a solid foundation for building more complex multiplayer games in the upcoming chapter, as the basics of networking have been covered.
Let’s do it!
- In the
retrieve_avatar()
method, check whether the user is logged in by verifying that the user exists in thelogged_users
dictionary. If the user is not logged in, exit the function:func retrieve_avatar(user, session_token): if not...