Hello! I am currently in the process of creating my own custom playerlist for a game, and I am wondering how much it should display. I was planning to include money balance and such, and then update the playerlist whenever someone’s balance changes, which could potentially cause lag. Any input on this? Although I could include money balance and such, and only update the playerlist once in a while.
This is probably the best approach. This shouldn’t lag if you do this, unless the leaderboard was very poorly scripted.
Question, why do you need money in the player list in the first place? I have seen a few games that show money and things in the player list but it doesn’t really help with the game, it doesn’t serve any real purpose except maybe bragging rights. I would consider thinking about what you really need to show in a playerlist that all the players need to see. This is just my opinion though.
That’s true, I believe putting it in the playerlist will motivate players to play and grind more to show off, but that is only an assumption.
Yeah, the way I update playerlists is to clear all children at first, then creating new frames for each player. I suppose this is a pretty bad method as it has to iterate through each player…
The main reason I bring it up is so you don’t waste time programming it if you don’t really need it. This system in itself shouldn’t be too intensive on the server or client.
I wouldn’t clear all the children and create new frames, I would just update the values. In the script, I would keep a reference to the GUI object that is created in a table with the player’s name or ID and then when a request is sent from the server to update the player list, you can use the table on the client and access the GUI there and update it without having to iterate (If you update for each balance change).
If you choose to update every minute or so, something I would do is if someone’s balance changes on the server, you put a value in their table saying needingUpdate = true or something. So when you send client requests to update the playerlist, it only needs to iterate through the ones actually needing updating.
Instead of clearing all children, attach a .Changed event to the money value and update it based on that. Only delete the player from the list whenever they leave the game.
All of this can be done on the client.
Yeah, I just started using UIGridLayout as well, up until now I have been sorting grid systems manually with code, so I guess I could listen to a .Changed event, since the UIGridLayout sorts each frame automatically