Since I’ve finally got my lobby system to work with Steam*(albeit only with European clients)*, I’m now working on refactoring stuff. Currently, I’m updating the player list via using the array of players stored in the gamestate. I’m doing this every second, and while it works - it does result in a lagspike every second.
Simply what I’m doing is recreating the player list every second. I clear it, rebuild it - I know it’s a lousy way of doing things but it worked for basic testing. This includes getting their player name and Steam avatar*(thanks to Mordentrals awesome plugin!)*.
What confuses me is how I would go about to make events instead, every time someone either joins or leaves the session. One method I had in mind was to store the player array upon widget construct, and simply check the size every second instead to see if it’s larger or smaller and if a change is found - compare the old array to the new to find what’s changed.
But I’m afraid I’ll run into issues because people might join and leave at around the same time. If anyone has any suggestions of a better approach I’d greatly appreciate it!
Worth noting that I can not create my own GameState, whenever I do - I can never access the player array. I’ve no idea if this is intended behaviour or a bug.