Announcement

Collapse
No announcement yet.

Get list of all connected players?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get list of all connected players?

    I recently posted this question on the question board; https://answers.unrealengine.com/que...rendering.html

    And I've since tried even more things to get the output I want. It's a really weird thing why it doesn't work.

    Anyway, in absence I'm forced to consider alternatives. One alternative is to store all logged in players in a database, then update it every time you open or close the game.
    This isn't really a problem to do, as I've already got the basis of a database connection up and running.

    The problem is that I have no idea of how I would create sessions with the data I can store in a database. At most I'd have a user id (from another table) or a username, but since I've yet to find a way to change the Name variable through arguments, I'm stuck with everyone being named Player.

    #2
    The connected players can be get in different ways.

    2 Examples:

    - Iterate through the PlayerControllers. The server has one for every player (but only the server. The Clients only know their own).

    - Get the GameState and get the "PlayerArray". This is an array of all PlayerStates. These contain PlayerName, Score, Ping and such things.

    I would recommened the second example.
    Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

    My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
    (Including 100+ Pages Multiplayer Network Compendium to get you started.)

    Comment


      #3
      Originally posted by eXi View Post
      The connected players can be get in different ways.

      2 Examples:

      - Iterate through the PlayerControllers. The server has one for every player (but only the server. The Clients only know their own).

      - Get the GameState and get the "PlayerArray". This is an array of all PlayerStates. These contain PlayerName, Score, Ping and such things.

      I would recommened the second example.
      Getting the GameState still gives me an extra playerstate I don't want. I run it trough "Run on Sever" replication, and just running it in the editor I'm getting two iterations, running dedicated server and a second client (still in editor) I'm getting 3 iterations. So there's a dud in there somewhere, and I have no idea how to remove it. I tried Has Authority, but that won't run at all.

      [Edit] I solved it. Apparently one of them has an empty PlayerName, so I just check if it's empty. Odd.
      Last edited by Netzone; 04-05-2015, 08:14 AM.

      Comment


        #4
        I'm a tad late, but for anyone wondering, I believe the empty PlayerName/extra player is generated by the GameMode on launch. I found this in the GameModeBase documentation.

        Comment

        Working...
        X