Setting UserNames
Author: Najee Jackson
Problem
The player list only showed their laptop name whenever a player joined the server. This was confusing and made it hard to tell what players were in the game. It also made saving players' user names and data difficult, as the laptop name would change at the start of each session.
To fix this, I researched Unreal's replication functions and how they work. This was a daunting task at first, as there was a lot to take in for multiplayer functionality, but after a day of research, I got an idea of how to do it. I first used Unreal's On Post Login event, which tells the server if a new player has joined. Using this, I could call a series of functions in the Playerstate and Gamemode to check if the player has been registered before and already has a valid username. Once these functions were called, I would get the controllers' PlayerState and check if the player's name was registered on the host server. If it were, I would call a function on the server that assigns the loaded username to that playerStates' UserName variable. If it wasn't on the main server, I asked the player to input a username they would like to use in future sessions. This helped make saving players' Items and Weapons more manageable between sessions.
Host Players Username has been changed to host
Comments
Post a Comment