I currently have some logic that stems from receiving data from Game State’s Player Array to then receive a custom variable on the player state class which is an Alias, string, that players can update for their display name.
From Game Mode, on post login/logout, I am calling an event called Update Player States List on the game state. This was the only way that I have been able to find to keep the player state in the same order across all connected clients. For some reason on 5.1, it seems to fluctuate randomly. Same thing in C++.
From that, I am collecting a list of all player states and controllers and storing them to their own custom arrays to limit casts—making sure to clear these each time someone logs in and out to keep them up to date.
Up until now, this has resolved the issue I have been noticing with the Player Arrays being different across the server and all clients. At this point, I start populating a custom string array with each Player State’s Alias so that I can just iterate through the entire sessions in one go for my display widgets.
Here’s where everything, again, appears to have gone wonky. When the clients connect, they do not all appear to execute the Update Player State List when they join, so momentarily—unless I manually re-fire my reference creation chain—they do not properly populate the Player Alias, string array when joining. If I print the custom GS ref arrays, everything is fine. If I print the alias array, which populates by default to the Player ID, they sometimes hold 0 and throw an error upon closing.
Thoughts or recommendations?