Effiecent Way of Updating Player List

I’ve been playing around with this a bit today, and while the GameMode events are exactly what I want - they’re rendered useless simply due to the fact we can not trigger client-side events from the GameMode.

I need to get all widgets in order to get access to the function that generates the player list. Obviously, this would only work for the host if I were to do it in the GM. Basically this is what I tried;

1. I created a custom PlayerController, which has a custom event; Client_TestOutput - outputs a simple “Hello”.
2. In the GameMode, everytime someone logs in - I add their PC to an array.
3. After it’s been added, I loop through this array - casting it to my custom PC in order to execute the Client_TestOutput event.
4. Due to the way GM works, the server will output the message - despite the event being client-sided inside my custom PlayerController.

In other words I’ll see “Server: Hello” multiple times, instead of once and the others being “Client #: Hello”.

This is where I start scratching my head as it violates all my previous experience with Client/Server interaction.

One theory I have is that I could possibly achieve what I want if I make a custom PlayerState and have the event in there instead, but everytime I’ve made a custom PlayerState or GameState - something always breaks and stops working. If I make a custom GameState, it will always fail to retrieve the PlayerArray. If I make a custom PlayerState, it will always fail at getting the PlayerName.

I guess I’ll stick with the method I’m currently using which just checks the size of the PlayerArray inside GameState every second(might simply just have to reduce the delay). I was hoping to be able to use the GM events but alas, we can’t have everything served on a silver platter. :rolleyes:

Edit:

With the current method I was able to reduce the delay to 100ms without any noticeable performance loss. Now I just gotta find a way to make sure they’re listed in the same order. A real shame the PlayerArray is differently indexed every time you fetch it :frowning: